ci: replace deprecated gh actions with alternatives (#814)

This commit is contained in:
SteveLauC
2024-05-25 19:29:17 +08:00
committed by GitHub
parent 3b329fe687
commit d1d8904376
2 changed files with 57 additions and 66 deletions

View File

@@ -17,36 +17,27 @@ jobs:
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- name: setup Rust
uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format - name: Check format
with: run: cargo fmt --all -- --check
command: fmt
args: --all -- --check - name: Run clippy
- uses: actions-rs/cargo@v1.0.1 run: cargo clippy --all-targets --locked -- -D warnings
name: Run clippy
with: - name: Run clippy (All features)
command: clippy run: cargo clippy --all-targets --locked --all-features -- -D warnings
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1.0.1 - name: Run tests
name: Run clippy (All features) run: cargo test
with:
command: clippy - name: Build in Release profile with all features enabled
args: --all-targets --locked --all-features -- -D warnings run: cargo build --release --all-features
- uses: actions-rs/cargo@v1.0.1
name: Run tests
with:
command: test
- uses: actions-rs/cargo@v1.0.1
name: Build
with:
command: build
args: --release --all-features
- name: Rename Release (Unix) - name: Rename Release (Unix)
run: | run: |
cargo install default-target cargo install default-target
@@ -59,6 +50,7 @@ jobs:
ls . ls .
if: ${{ matrix.platform != 'windows-latest' }} if: ${{ matrix.platform != 'windows-latest' }}
shell: bash shell: bash
- name: Rename Release (Windows) - name: Rename Release (Windows)
run: | run: |
cargo install default-target cargo install default-target
@@ -71,6 +63,7 @@ jobs:
ls . ls .
if: ${{ matrix.platform == 'windows-latest' }} if: ${{ matrix.platform == 'windows-latest' }}
shell: bash shell: bash
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:

View File

@@ -13,48 +13,45 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
target: [ "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "x86_64-unknown-freebsd", ] target: [
"aarch64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-musl",
"x86_64-unknown-freebsd",
]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- name: setup Rust
uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable
profile: minimal
default: true
override: true
target: ${{ matrix.target }}
components: rustfmt, clippy components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format - name: install targets
run: rustup target add ${{ matrix.target }}
- name: install cross
uses: taiki-e/install-action@v2
with: with:
use-cross: true tool: cross@0.2.5
command: fmt
args: --all -- --check - name: Check format
- uses: actions-rs/cargo@v1.0.1 run: cross fmt --all -- --check
name: Run clippy
with: - name: Run clippy
command: clippy run: cross clippy --all-targets --locked --target ${{matrix.target}} -- -D warnings
use-cross: true
args: --all-targets --locked --target ${{matrix.target}} -- -D warnings - name: Run clippy (All features)
- uses: actions-rs/cargo@v1.0.1 run: cross clippy --locked --all-features --target ${{matrix.target}} -- -D warnings
name: Run clippy (All features)
with: - name: Run tests
command: clippy run: cross test --target ${{matrix.target}}
use-cross: true
args: --locked --all-features --target ${{matrix.target}} -- -D warnings - name: Build in Release profile with all features enabled
- uses: actions-rs/cargo@v1.0.1 run: cross build --release --all-features --target ${{matrix.target}}
name: Run tests
with:
command: test
use-cross: true
args: --target ${{matrix.target}}
- uses: actions-rs/cargo@v1.0.1
name: Build
with:
command: build
use-cross: true
args: --release --all-features --target ${{matrix.target}}
- name: Rename Release - name: Rename Release
run: | run: |
mkdir assets mkdir assets
@@ -64,6 +61,7 @@ jobs:
tar --format=ustar -czf $FILENAME.tar.gz topgrade tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade rm topgrade
ls . ls .
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with: