Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit be847b4

Browse files
committed
Actually run the tests
1 parent ddf0b70 commit be847b4

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

.github/workflows/rust-tests.yml

+22-32
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ jobs:
9999
RPC_ENDPOINT_MAINNET: ${{ secrets.JUNO_ENDPOINT_MAINNET }}
100100
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
101101
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
102+
TEST_COLLECT_COVERAGE: 1
102103
strategy:
103104
fail-fast: false
104105
matrix:
@@ -162,6 +163,13 @@ jobs:
162163
- name: Run tests (${{ matrix.target }})
163164
run: make ${{ matrix.target }}
164165

166+
- name: Save coverage report
167+
if: steps.restore-report.outputs.cache-hit != 'true' && ${{ matrix.target }} != 'test-doctest'
168+
uses: actions/cache/save@v3
169+
with:
170+
path: lcov-${{ matrix.target }}.info
171+
key: coverage-cache-${{ github.sha }}-${{ matrix.target }}
172+
165173
coverage:
166174
name: Generate and upload coverage report
167175
runs-on: ubuntu-latest
@@ -171,48 +179,30 @@ jobs:
171179
- name: Checkout
172180
uses: actions/checkout@v3
173181

174-
- name: Install Rust nightly
175-
uses: dtolnay/rust-toolchain@master
176-
with:
177-
toolchain: nightly
178-
179-
- uses: Swatinem/rust-cache@v2
180-
with:
181-
cache-on-failure: true
182-
183-
- name: Cache coverage report
182+
- name: Fetch coverage report for test-cairo-1
184183
id: restore-report
185184
uses: actions/cache/restore@v3
186185
with:
187-
path: lcov.info
188-
key: coverage-cache-${{ github.sha }}
186+
path: lcov-test-cairo-1.info
187+
key: coverage-cache-${{ github.sha }}-test-cairo-1
189188

190-
- name: Python3 Build
191-
uses: actions/setup-python@v4
192-
with:
193-
python-version: '3.9'
194-
cache: 'pip'
195-
- uses: Swatinem/rust-cache@v2
189+
- name: Fetch coverage report for test-cairo-2
190+
id: restore-report
191+
uses: actions/cache/restore@v3
196192
with:
197-
cache-on-failure: true
198-
199-
- name: Install deps
200-
run: make deps
193+
path: lcov-test-cairo-2.info
194+
key: coverage-cache-${{ github.sha }}-test-cairo-2
201195

202-
- name: Generate coverage report
203-
if: steps.restore-report.outputs.cache-hit != 'true'
204-
run: make coverage-report
205-
206-
- name: Save coverage report
207-
if: steps.restore-report.outputs.cache-hit != 'true'
208-
uses: actions/cache/save@v3
196+
- name: Fetch coverage report for test-cairo-native
197+
id: restore-report
198+
uses: actions/cache/restore@v3
209199
with:
210-
path: lcov.info
211-
key: coverage-cache-${{ github.sha }}
200+
path: lcov-test-cairo-native.info
201+
key: coverage-cache-${{ github.sha }}-test-cairo-native
212202

213203
- name: Upload coverage to codecov.io
214204
uses: codecov/codecov-action@v3
215205
with:
216206
fail_ci_if_error: true
217207
token: ${{ secrets.CODECOV_TOKEN }}
218-
files: lcov.info
208+
files: lcov-test-cairo-1.info lcov-test-cairo-2.info lcov-test-cairo-native.info

Makefile

+2-7
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ clippy: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sier
197197

198198
TEST_COMMAND:=cargo nextest run --release
199199
ifdef TEST_COLLECT_COVERAGE
200-
TEST_COMMAND:=cargo +nightly llvm-cov nextest --release --ignore-filename-regex 'main.rs' --no-report
200+
#TEST_COMMAND=cargo +nightly llvm-cov nextest --release --ignore-filename-regex 'main.rs' --lcov --output-path lcov-$%.info
201+
TEST_COMMAND=cargo llvm-cov nextest --release --lcov --output-path lcov-$%.info
201202
endif
202203

203204
test: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra
@@ -218,12 +219,6 @@ test-cairo-native: compile-cairo compile-starknet compile-cairo-1-casm compile-c
218219
test-doctests:
219220
cargo test --workspace --doc
220221

221-
coverage: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-2-casm
222-
$(MAKE) coverage-report
223-
224-
coverage-report: compile-cairo compile-starknet compile-cairo-1-casm compile-cairo-1-sierra compile-cairo-2-casm compile-cairo-2-sierra
225-
cargo +nightly llvm-cov report --lcov --output-path lcov.info
226-
227222
heaptrack:
228223
./scripts/heaptrack.sh
229224

0 commit comments

Comments
 (0)