Skip to content

Commit

Permalink
chore: update GitHub Actions CI + remove redundant job (#19)
Browse files Browse the repository at this point in the history
The following updates are performed:
* update [`actions/checkout`](https://github.com/actions/checkout) to v3
* replace
[unmaintained](actions-rs/toolchain#216)
`actions-rs/toolchain` by
[`dtolnay/rust-toolchain`](https://github.com/dtolnay/rust-toolchain)
* replace unmaintained `actions-rs/cargo` by direct invocations of
`cargo`

Still using the outdated / unmaintained actions will generate several
warnings in CI runs, for example in
https://github.com/alexkirsz/dispatch/actions/runs/4903327790:

> Node.js 12 actions are deprecated. Please update the following actions
to use Node.js 16: actions/checkout@v2, actions-rs/toolchain@v1,
actions-rs/cargo@v1. For more information see:
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

The PR will get rid of those warnings.


Futhermore, the redundant `combo` job is removed, because just does what
the the two previous jobs ('Clippy` and `Format`) in the same workflow
do, so there's no need to keep it.
  • Loading branch information
striezel committed May 6, 2023
1 parent c4e4141 commit 0c42da4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 73 deletions.
51 changes: 4 additions & 47 deletions .github/workflows/nightly_lints.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Based on https://github.com/actions-rs/meta

on: [push, pull_request]

name: Nightly lints
Expand All @@ -13,19 +11,13 @@ jobs:
uses: actions/checkout@v3

- name: Install nightly toolchain with clippy available
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly
override: true
components: clippy

- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: true # WARNING: only for this example, remove it!
with:
command: clippy
args: -- -D warnings
run: cargo clippy -- -D warnings

rustfmt:
name: Format
Expand All @@ -35,45 +27,10 @@ jobs:
uses: actions/checkout@v3

- name: Install nightly toolchain with rustfmt available
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt

- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: true # WARNING: only for this example, remove it!
with:
command: fmt
args: --all -- --check

combo:
name: Clippy + rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: true # WARNING: only for this example, remove it!
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
continue-on-error: true # WARNING: only for this example, remove it!
with:
command: clippy
args: -- -D warnings
run: cargo fmt --all -- --check
36 changes: 10 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,46 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
run: cargo test

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
run: cargo clippy -- -D warnings

0 comments on commit 0c42da4

Please sign in to comment.