3
3
push :
4
4
branches :
5
5
- main
6
+ # pull_request:
7
+ # branches:
8
+ # - "**"
6
9
workflow_call :
7
10
8
- # on:
9
- # push:
10
- # branches:
11
- # - main
12
- # pull_request:
13
- # branches:
14
- # - "**"
15
- #
16
-
17
11
jobs :
18
12
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
21
19
steps :
22
20
- name : Checkout
23
21
uses : actions/checkout@v4
22
+
24
23
- name : Cache Rust
25
24
uses : actions/cache@v4
26
25
with :
@@ -29,42 +28,76 @@ jobs:
29
28
~/.cargo/registry
30
29
~/.cargo/git
31
30
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-
34
33
35
34
- name : Install Rust Toolchain
36
35
uses : dtolnay/rust-toolchain@master
37
36
with :
38
37
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
40
67
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
43
71
44
72
- 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
47
76
48
77
- 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
51
80
52
81
- name : Run cargo doc
82
+ env :
83
+ RUSTDOCFLAGS : " -Dwarnings"
53
84
run : cargo doc --no-deps
85
+ if : matrix.os == 'ubuntu-latest' # Run doc only on Linux
54
86
55
87
- name : Spell Check
56
- env :
57
- RUSTDOCFLAGS : " -Dwarnings"
58
88
uses : crate-ci/typos@master
89
+ if : matrix.os == 'ubuntu-latest' # Run typos only on Linux
59
90
60
- - name : Audit
91
+ - name : Audit Dependencies
61
92
uses : actions-rust-lang/audit@v1
62
93
with :
63
94
token : ${{ secrets.GITHUB_TOKEN }}
95
+ if : matrix.os == 'ubuntu-latest' # Run audit only on Linux
64
96
65
97
- name : Run Tests
66
- run : |
67
- cargo make test
98
+ run : cargo make test
99
+ shell : bash # Ensure consistent shell
100
+
68
101
- 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