Skip to content

Commit

Permalink
ci: replace deprecated gh actions with alternatives (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC authored May 25, 2024
1 parent 3b329fe commit d1d8904
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 66 deletions.
51 changes: 22 additions & 29 deletions .github/workflows/create_release_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,27 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
args: --all-targets --locked --all-features -- -D warnings
- 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: Check format
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --locked -- -D warnings

- name: Run clippy (All features)
run: cargo clippy --all-targets --locked --all-features -- -D warnings

- name: Run tests
run: cargo test

- name: Build in Release profile with all features enabled
run: cargo build --release --all-features

- name: Rename Release (Unix)
run: |
cargo install default-target
Expand All @@ -59,6 +50,7 @@ jobs:
ls .
if: ${{ matrix.platform != 'windows-latest' }}
shell: bash

- name: Rename Release (Windows)
run: |
cargo install default-target
Expand All @@ -71,6 +63,7 @@ jobs:
ls .
if: ${{ matrix.platform == 'windows-latest' }}
shell: bash

- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down
72 changes: 35 additions & 37 deletions .github/workflows/create_release_assets_cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,45 @@ jobs:
strategy:
fail-fast: false
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
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
override: true
target: ${{ matrix.target }}

- name: setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
use-cross: true
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
use-cross: true
args: --all-targets --locked --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
use-cross: true
args: --locked --all-features --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run tests
with:
command: test
use-cross: true
args: --target ${{matrix.target}}
- uses: actions-rs/cargo@v1.0.1
name: Build

- name: install targets
run: rustup target add ${{ matrix.target }}

- name: install cross
uses: taiki-e/install-action@v2
with:
command: build
use-cross: true
args: --release --all-features --target ${{matrix.target}}
tool: cross@0.2.5

- name: Check format
run: cross fmt --all -- --check

- name: Run clippy
run: cross clippy --all-targets --locked --target ${{matrix.target}} -- -D warnings

- name: Run clippy (All features)
run: cross clippy --locked --all-features --target ${{matrix.target}} -- -D warnings

- name: Run tests
run: cross test --target ${{matrix.target}}

- name: Build in Release profile with all features enabled
run: cross build --release --all-features --target ${{matrix.target}}

- name: Rename Release
run: |
mkdir assets
Expand All @@ -64,6 +61,7 @@ jobs:
tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade
ls .
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down

0 comments on commit d1d8904

Please sign in to comment.