Skip to content

Commit 9d285c1

Browse files
committed
test: update workflow to test on both linux and windows
1 parent c0b6f20 commit 9d285c1

File tree

1 file changed

+60
-27
lines changed

1 file changed

+60
-27
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@ on:
33
push:
44
branches:
55
- main
6+
# pull_request:
7+
# branches:
8+
# - "**"
69
workflow_call:
710

8-
# on:
9-
# push:
10-
# branches:
11-
# - main
12-
# pull_request:
13-
# branches:
14-
# - "**"
15-
#
16-
1711
jobs:
1812
rust_check:
19-
name: Rust check
20-
runs-on: ubuntu-latest
13+
name: Rust Checks (${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest]
18+
fail-fast: false # Continue testing other OSes even if one fails
2119
steps:
2220
- name: Checkout
2321
uses: actions/checkout@v4
22+
2423
- name: Cache Rust
2524
uses: actions/cache@v4
2625
with:
@@ -29,42 +28,76 @@ jobs:
2928
~/.cargo/registry
3029
~/.cargo/git
3130
target
32-
key: ${{ runner.os }}-rust-${{ steps.toolchain.outputs.cachekey }}
33-
restore-keys: ${{ runner.os }}-rust-
31+
key: ${{ matrix.os }}-rust-${{ hashFiles('Cargo.lock') }}
32+
restore-keys: ${{ matrix.os }}-rust-
3433

3534
- name: Install Rust Toolchain
3635
uses: dtolnay/rust-toolchain@master
3736
with:
3837
toolchain: stable
39-
components: rustfmt
38+
components: rustfmt, clippy
39+
40+
- name: Install cargo-make
41+
uses: davidB/rust-cargo-make@v1
42+
43+
- name: Install nextest
44+
uses: taiki-e/install-action@nextest
45+
46+
# install nodejs that is required for tests
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: "20" # Stable Node.js version
51+
cache: "npm" # Cache npm dependencies
52+
# Verify npx is available
53+
- name: Verify npx
54+
run: npx --version
55+
shell: bash
56+
57+
# install Python and uvx that is required for tests
58+
- name: Setup Python
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: "3.11" # Stable Python version
62+
cache: "pip" # Cache pip dependencies
63+
64+
- name: Install uv
65+
run: pip install uv
66+
shell: bash
4067

41-
- uses: davidB/rust-cargo-make@v1
42-
- uses: taiki-e/install-action@nextest
68+
- name: Verify uvx
69+
run: uvx --version
70+
shell: bash
4371

4472
- name: Run Clippy
45-
run: |
46-
cargo make clippy
73+
run: cargo make clippy
74+
continue-on-error: false
75+
if: matrix.os == 'ubuntu-latest' # Run Clippy only on Linux to save time
4776

4877
- name: Run Rustfmt
49-
run: |
50-
cargo make fmt
78+
run: cargo make fmt -- --check
79+
if: matrix.os == 'ubuntu-latest' # Run fmt only on Linux
5180

5281
- name: Run cargo doc
82+
env:
83+
RUSTDOCFLAGS: "-Dwarnings"
5384
run: cargo doc --no-deps
85+
if: matrix.os == 'ubuntu-latest' # Run doc only on Linux
5486

5587
- name: Spell Check
56-
env:
57-
RUSTDOCFLAGS: "-Dwarnings"
5888
uses: crate-ci/typos@master
89+
if: matrix.os == 'ubuntu-latest' # Run typos only on Linux
5990

60-
- name: Audit
91+
- name: Audit Dependencies
6192
uses: actions-rust-lang/audit@v1
6293
with:
6394
token: ${{ secrets.GITHUB_TOKEN }}
95+
if: matrix.os == 'ubuntu-latest' # Run audit only on Linux
6496

6597
- name: Run Tests
66-
run: |
67-
cargo make test
98+
run: cargo make test
99+
shell: bash # Ensure consistent shell
100+
68101
- name: Run Doc Tests
69-
run: |
70-
cargo make doc-test
102+
run: cargo make doc-test
103+
shell: bash # Ensure consistent shell

0 commit comments

Comments
 (0)