@@ -30,12 +30,12 @@ jobs:
30
30
uses : actions/checkout@v4
31
31
32
32
- name : Set up Rust toolchain
33
- uses : dtolnay/rust-toolchain@stable
34
- with :
35
- components : clippy
33
+ run : rustup install --profile minimal --component clippy
36
34
37
35
- name : Cache build artifacts
38
36
uses : Swatinem/rust-cache@v2
37
+ with :
38
+ cache-on-failure : true
39
39
40
40
- name : Lint Rust code
41
41
run : cargo clippy --all-targets --workspace --locked
@@ -74,12 +74,12 @@ jobs:
74
74
uses : actions/checkout@v4
75
75
76
76
- name : Set up Rust toolchain
77
- uses : dtolnay/rust-toolchain@stable
78
- with :
79
- components : rustfmt
77
+ run : rustup install --profile minimal --component rustfmt
80
78
81
79
- name : Cache build artifacts
82
80
uses : Swatinem/rust-cache@v2
81
+ with :
82
+ cache-on-failure : true
83
83
84
84
- name : Check formatting
85
85
run : cargo fmt --check --all
@@ -92,13 +92,61 @@ jobs:
92
92
uses : actions/checkout@v4
93
93
94
94
- name : Set up Rust toolchain
95
- uses : dtolnay/rust-toolchain@stable
95
+ run : rustup install --profile minimal --component llvm-tools
96
96
97
97
- name : Cache build artifacts
98
98
uses : Swatinem/rust-cache@v2
99
+ with :
100
+ cache-on-failure : true
101
+
102
+ - name : Install nextest (if not cached)
103
+ run : cargo nextest --version || cargo install --locked cargo-nextest
104
+
105
+ - name : Install llvm-cov (if not cached)
106
+ run : cargo llvm-cov --version || cargo install --locked cargo-llvm-cov
107
+
108
+ - name : Run tests
109
+ run : >-
110
+ cargo llvm-cov nextest
111
+ --no-report
112
+ --no-fail-fast
113
+ --locked
114
+ --workspace
115
+ --all-targets
116
+ --all-features
117
+ --profile ci
118
+
119
+ - name : Generate coverage reports
120
+ if : (!cancelled()) # Generate reports even if tests failed
121
+ shell : bash
122
+ run : |
123
+ cargo llvm-cov report --html
124
+ cargo llvm-cov report --codecov --output-path target/llvm-cov/codecov.json
99
125
100
- - name : Run default tests
101
- run : cargo test --workspace --all-targets --no-fail-fast --locked
126
+ - name : Publish test results
127
+ uses : EnricoMi/publish-unit-test-result-action@v2
128
+ if : (!cancelled()) # Upload reports even if tests failed
129
+ with :
130
+ check_run : false
131
+ comment_mode : ${{ (github.event_name == 'pull_request') && 'always' || 'off' }}
132
+ files : |
133
+ target/nextest/ci/junit.xml
134
+
135
+ - name : Upload coverage to Codecov
136
+ uses : codecov/codecov-action@v5
137
+ # if: (!cancelled()) # Upload reports even if tests failed
138
+ if : false # Skip until we set up Codecov for the @purduehackers org
139
+ with :
140
+ token : ${{ secrets.CODECOV_TOKEN }}
141
+ files : target/llvm-cov/codecov.json
142
+ fail_ci_if_error : true
143
+
144
+ - name : Upload HTML coverage report
145
+ uses : actions/upload-artifact@v4
146
+ if : (!cancelled()) # Upload reports even if tests failed
147
+ with :
148
+ name : coverage-html
149
+ path : target/llvm-cov/html/
102
150
103
151
# Adding this because we don't want to run the whole build workflow on each
104
152
# push
@@ -110,10 +158,12 @@ jobs:
110
158
uses : actions/checkout@v4
111
159
112
160
- name : Set up Rust toolchain
113
- uses : dtolnay/rust-toolchain@stable
161
+ run : rustup install --profile minimal
114
162
115
163
- name : Cache build artifacts
116
164
uses : Swatinem/rust-cache@v2
165
+ with :
166
+ cache-on-failure : true
117
167
118
168
- name : Compile project
119
169
run : cargo build --workspace --all-targets --release --locked
0 commit comments