-
-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (61 loc) · 2.25 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: 🧪 Test
on: [pull_request, push]
jobs:
test-lib:
name: Test library
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
toolchain: [stable, nightly]
continue-on-error: true
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Setup Rust
- name: Setup Rust
run: |
rustup toolchain add ${{ matrix.toolchain }} --component llvm-tools-preview
rustup override set ${{ matrix.toolchain }}
# Configure cache
- name: Configure cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
# Run tests with all features
- name: Run tests with all features
id: run-tests-all-features
run: cargo test --verbose --workspace --all-features
# Install grcov
- name: Install grcov
# Only run this job on the main branch when a commit is pushed.
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: install-grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Use grcov to generate a coverage report
- name: Generate coverage report
# Only run this job on the main branch when a commit is pushed.
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: generate-code-coverage
uses: actions-rs/cargo@v1
with:
command: xtask
args: coverage
# Upload the coverage report to codecov
- name: Upload coverage report to codecov
# Only run this job on the main branch when a commit is pushed.
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: upload-report-codecov
uses: codecov/codecov-action@v4
with:
files: coverage/*.lcov