chore: update ci (#242)
This commit is contained in:
parent
d9706d75ef
commit
204421643d
2 changed files with 38 additions and 37 deletions
10
.github/workflows/ci.yaml
vendored
10
.github/workflows/ci.yaml
vendored
|
@ -29,16 +29,12 @@ jobs:
|
||||||
RUSTFLAGS: --deny warnings
|
RUSTFLAGS: --deny warnings
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Rust Toolchain Components
|
- name: Install Rust Toolchain Components
|
||||||
uses: actions-rs/toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
|
||||||
components: clippy, rustfmt
|
|
||||||
override: true
|
|
||||||
toolchain: stable
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v1
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cargo test --all
|
run: cargo test --all
|
||||||
|
|
63
.github/workflows/release.yaml
vendored
63
.github/workflows/release.yaml
vendored
|
@ -71,30 +71,40 @@ jobs:
|
||||||
use-cross: true
|
use-cross: true
|
||||||
cargo-flags: "--no-default-features"
|
cargo-flags: "--no-default-features"
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
env:
|
||||||
|
BUILD_CMD: cargo
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Check Tag
|
- name: Check Tag
|
||||||
id: check-tag
|
id: check-tag
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tag=${GITHUB_REF##*/}
|
ver=${GITHUB_REF##*/}
|
||||||
echo "::set-output name=version::$tag"
|
echo "version=$ver" >> $GITHUB_OUTPUT
|
||||||
if [[ "$tag" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
|
if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
|
||||||
echo "::set-output name=rc::false"
|
echo "rc=false" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "::set-output name=rc::true"
|
echo "rc=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
- name: Install Rust Toolchain Components
|
- name: Install Rust Toolchain Components
|
||||||
uses: actions-rs/toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
override: true
|
targets: ${{ matrix.target }}
|
||||||
target: ${{ matrix.target }}
|
|
||||||
toolchain: stable
|
- name: Install cross
|
||||||
profile: minimal # minimal component installation (ie, no documentation)
|
if: matrix.use-cross
|
||||||
|
uses: taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: cross
|
||||||
|
|
||||||
|
- name: Overwrite build command env variable
|
||||||
|
if: matrix.use-cross
|
||||||
|
shell: bash
|
||||||
|
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Show Version Information (Rust, cargo, GCC)
|
- name: Show Version Information (Rust, cargo, GCC)
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -107,11 +117,8 @@ jobs:
|
||||||
rustc -V
|
rustc -V
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: actions-rs/cargo@v1
|
shell: bash
|
||||||
with:
|
run: $BUILD_CMD build --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
|
||||||
use-cross: ${{ matrix.use-cross }}
|
|
||||||
command: build
|
|
||||||
args: --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
|
|
||||||
|
|
||||||
- name: Build Archive
|
- name: Build Archive
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -139,15 +146,15 @@ jobs:
|
||||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
archive=$dist/$name.zip
|
archive=$dist/$name.zip
|
||||||
7z a $archive *
|
7z a $archive *
|
||||||
echo "::set-output name=archive::`pwd -W`/$name.zip"
|
echo "archive=$archive" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
archive=$dist/$name.tar.gz
|
archive=$dist/$name.tar.gz
|
||||||
tar czf $archive *
|
tar czf $archive *
|
||||||
echo "::set-output name=archive::$archive"
|
echo "archive=$archive" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Publish Archive
|
- name: Publish Archive
|
||||||
uses: softprops/action-gh-release@v0.1.5
|
uses: softprops/action-gh-release@v1
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
with:
|
with:
|
||||||
draft: false
|
draft: false
|
||||||
|
@ -163,16 +170,16 @@ jobs:
|
||||||
needs: release
|
needs: release
|
||||||
steps:
|
steps:
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
build-args: |
|
build-args: |
|
||||||
REPO=${{ github.repository }}
|
REPO=${{ github.repository }}
|
||||||
|
@ -191,13 +198,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: release
|
needs: release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: stable
|
|
||||||
- name: Publish
|
|
||||||
|
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
env:
|
env:
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||||
run: cargo publish
|
run: cargo publish
|
Loading…
Reference in a new issue