Skip to content

Commit

Permalink
ci: combine lint, format and test to save ci time and cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Mar 16, 2023
1 parent 4e9764a commit 3d764c5
Showing 1 changed file with 16 additions and 38 deletions.
54 changes: 16 additions & 38 deletions .github/workflows/check-rs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ concurrency:
cancel-in-progress: true

jobs:
lint-and-format:
name: lint, format and spell check
lint-format-test:
timeout-minutes: 30
name: lint, format, test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -34,6 +35,10 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install toolchain
run: rustup show

Expand All @@ -42,16 +47,21 @@ jobs:
with:
shared-key: check

- name: Spell Check
uses: crate-ci/typos@master
with:
files: .

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

- name: Run cargo check
- name: Run Cargo Check
run: cargo check --workspace --all-targets --release --locked

- name: Run clippy
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
Expand All @@ -60,42 +70,10 @@ jobs:
- name: Check Dependencies
run: node ./scripts/check_rust_dependency.js

- name: Spell Check
uses: crate-ci/typos@master
with:
files: .

test-rs:
name: Rust test
strategy:
fail-fast: true
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install toolchain
run: rustup show

- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: check

- name: Run test
# We need to install sass first to enable sass-loader
run: |
node -e "console.log(process.arch)"
npm install -g pnpm@7.25.0
pnpm install
cargo test --all -- --nocapture --test-threads=1
cargo test --workspace -- --nocapture --test-threads=1

0 comments on commit 3d764c5

Please sign in to comment.