@@ -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,31 +74,90 @@ 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
86
86
87
87
test :
88
88
name : Run tests
89
89
runs-on : ubuntu-latest
90
+ permissions :
91
+ checks : write
92
+ pull-requests : write
93
+ contents : read
90
94
steps :
91
95
- name : Check out sources
92
96
uses : actions/checkout@v4
93
97
94
98
- name : Set up Rust toolchain
95
- uses : dtolnay/rust-toolchain@stable
99
+ run : rustup install --profile minimal --component llvm-tools
96
100
97
101
- name : Cache build artifacts
98
102
uses : Swatinem/rust-cache@v2
103
+ with :
104
+ cache-on-failure : true
105
+
106
+ - name : Install nextest (if not cached)
107
+ run : cargo nextest --version || cargo install --locked cargo-nextest
108
+
109
+ - name : Install llvm-cov (if not cached)
110
+ run : cargo llvm-cov --version || cargo install --locked cargo-llvm-cov
111
+
112
+ - name : Run tests
113
+ run : >-
114
+ cargo llvm-cov nextest
115
+ --no-report
116
+ --no-fail-fast
117
+ --locked
118
+ --workspace
119
+ --all-targets
120
+ --all-features
121
+ --profile ci
122
+
123
+ - name : Generate coverage reports
124
+ if : ${{ !cancelled() }} # Generate reports even if tests failed
125
+ shell : bash
126
+ run : |
127
+ cargo llvm-cov report --html
128
+ cargo llvm-cov report --codecov --output-path target/llvm-cov/codecov.json
99
129
100
- - name : Run default tests
101
- run : cargo test --workspace --all-targets --no-fail-fast --locked
130
+ - name : Publish test results
131
+ uses : EnricoMi/publish-unit-test-result-action@v2
132
+ if : ${{ !cancelled() }} # Upload reports even if tests failed
133
+ with :
134
+ check_run : false
135
+ comment_mode : ${{ (github.event_name == 'pull_request') && 'always' || 'off' }}
136
+ files : |
137
+ target/nextest/ci/junit.xml
138
+
139
+ - name : Upload test results to Codecov
140
+ # if: ${{ !cancelled() }} # Upload reports even if tests failed
141
+ if : false # Skip until we set up Codecov for the @purduehackers org
142
+ uses : codecov/test-results-action@v1
143
+ with :
144
+ token : ${{ secrets.CODECOV_TOKEN }}
145
+ file : target/nextest/ci/junit.xml
146
+
147
+ - name : Upload coverage to Codecov
148
+ uses : codecov/codecov-action@v5
149
+ # if: ${{ !cancelled() }} # Upload reports even if tests failed
150
+ if : false # Skip until we set up Codecov for the @purduehackers org
151
+ with :
152
+ token : ${{ secrets.CODECOV_TOKEN }}
153
+ files : target/llvm-cov/codecov.json
154
+
155
+ - name : Upload HTML coverage report
156
+ uses : actions/upload-artifact@v4
157
+ if : ${{ !cancelled() }} # Upload reports even if tests failed
158
+ with :
159
+ name : coverage-html
160
+ path : target/llvm-cov/html/
102
161
103
162
# Adding this because we don't want to run the whole build workflow on each
104
163
# push
@@ -110,10 +169,12 @@ jobs:
110
169
uses : actions/checkout@v4
111
170
112
171
- name : Set up Rust toolchain
113
- uses : dtolnay/rust-toolchain@stable
172
+ run : rustup install --profile minimal
114
173
115
174
- name : Cache build artifacts
116
175
uses : Swatinem/rust-cache@v2
176
+ with :
177
+ cache-on-failure : true
117
178
118
179
- name : Compile project
119
180
run : cargo build --workspace --all-targets --release --locked
0 commit comments