|
6 | 6 | name: Periodic checks/tasks
|
7 | 7 |
|
8 | 8 | env:
|
9 |
| - CARGO_ARGS: --features ssl,jit |
| 9 | + CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit |
10 | 10 |
|
11 | 11 | jobs:
|
| 12 | + # codecov collects code coverage data from the rust tests, python snippets and python test suite. |
| 13 | + # This is done using cargo-llvm-cov, which is a wrapper around llvm-cov. |
12 | 14 | codecov:
|
13 | 15 | name: Collect code coverage data
|
14 | 16 | runs-on: ubuntu-latest
|
15 | 17 | steps:
|
16 | 18 | - uses: actions/checkout@v3
|
17 | 19 | - uses: dtolnay/rust-toolchain@stable
|
18 |
| - with: |
19 |
| - components: llvm-tools-preview |
20 |
| - - run: sudo apt-get update && sudo apt-get -y install lcov |
21 |
| - - run: cargo build --release --verbose ${{ env.CARGO_ARGS }} |
22 |
| - env: |
23 |
| - RUSTC_WRAPPER: './scripts/codecoverage-rustc-wrapper.sh' |
| 20 | + - uses: taiki-e/install-action@cargo-llvm-cov |
24 | 21 | - uses: actions/setup-python@v4
|
25 | 22 | with:
|
26 | 23 | python-version: "3.11"
|
27 |
| - - run: python -m pip install pytest |
28 |
| - working-directory: ./extra_tests |
29 |
| - - name: run snippets |
30 |
| - run: LLVM_PROFILE_FILE="$PWD/snippet-%p.profraw" pytest -v |
31 |
| - working-directory: ./extra_tests |
| 24 | + - run: sudo apt-get update && sudo apt-get -y install lcov |
| 25 | + - name: Run cargo-llvm-cov with Rust tests. |
| 26 | + run: cargo llvm-cov --no-report --workspace --exclude rustpython_wasm --verbose --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit |
| 27 | + - name: Run cargo-llvm-cov with Python snippets. |
| 28 | + run: python scripts/cargo-llvm-cov.py |
32 | 29 | continue-on-error: true
|
33 |
| - - name: run cpython tests |
34 |
| - run: | |
35 |
| - alltests=($(target/release/rustpython -c 'from test.libregrtest.runtest import findtests; print(*findtests())')) |
36 |
| - i=0 |
37 |
| - # chunk into chunks of 10 tests each. idk at this point |
38 |
| - while subtests=("${alltests[@]:$i:10}"); [[ ${#subtests[@]} -ne 0 ]]; do |
39 |
| - LLVM_PROFILE_FILE="$PWD/regrtest-%p.profraw" target/release/rustpython -m test -v "${subtests[@]}" || true |
40 |
| - ((i+=10)) |
41 |
| - done |
| 30 | + - name: Run cargo-llvm-cov with Python test suite. |
| 31 | + run: cargo llvm-cov --no-report run -- -m test -u all --slowest --fail-env-changed |
42 | 32 | continue-on-error: true
|
43 |
| - - name: prepare code coverage data |
44 |
| - run: | |
45 |
| - rusttool() { |
46 |
| - local tool=$1; shift; "$(rustc --print target-libdir)/../bin/llvm-$tool" "$@" |
47 |
| - } |
48 |
| - rusttool profdata merge extra_tests/snippet-*.profraw regrtest-*.profraw --output codecov.profdata |
49 |
| - rusttool cov export --instr-profile codecov.profdata target/release/rustpython --format lcov > codecov_tmp.lcov |
50 |
| - lcov -e codecov_tmp.lcov "$PWD"/'*' -o codecov_tmp2.lcov |
51 |
| - lcov -r codecov_tmp2.lcov "$PWD"/target/'*' -o codecov.lcov # remove LALRPOP-generated parser |
52 |
| - - name: upload to Codecov |
| 33 | + - name: Prepare code coverage data |
| 34 | + run: cargo llvm-cov report --lcov --output-path='codecov.cov' |
| 35 | + - name: Upload to Codecov |
53 | 36 | uses: codecov/codecov-action@v3
|
54 | 37 | with:
|
55 | 38 | file: ./codecov.lcov
|
|
89 | 72 | steps:
|
90 | 73 | - uses: actions/checkout@v3
|
91 | 74 | - uses: dtolnay/rust-toolchain@stable
|
| 75 | + - uses: actions/setup-python@v4 |
| 76 | + with: |
| 77 | + python-version: "3.11" |
92 | 78 | - name: build rustpython
|
93 | 79 | run: cargo build --release --verbose
|
94 | 80 | - name: Collect what is left data
|
|
0 commit comments