Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: combine lint, format and test to save ci time and cache #2307

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 15 additions & 38 deletions .github/workflows/check-rs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ concurrency:
cancel-in-progress: true

jobs:
lint-and-format:
name: lint, format and spell check
lint-format-test:
name: lint, format, spell check, test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -34,6 +34,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 +46,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 +69,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