-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (98 loc) · 2.97 KB
/
Copy pathrust.yml
File metadata and controls
121 lines (98 loc) · 2.97 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0 # Disable incremental compilation for CI (not reused)
CARGO_PROFILE_DEV_DEBUG: 0 # Disable debug info in dev builds (faster compile)
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "test"
cache-on-failure: true
- name: Cache par2cmdline
id: cache-par2
uses: actions/cache@v4
with:
path: ~/bin/par2
key: ${{ runner.os }}-par2cmdline
- name: Install par2cmdline
if: steps.cache-par2.outputs.cache-hit != 'true'
run: |
sudo apt-get update && sudo apt-get install -y par2
mkdir -p ~/bin
cp /usr/bin/par2 ~/bin/par2
- name: Add par2 to PATH
run: echo "$HOME/bin" >> $GITHUB_PATH
- name: Run tests
run: cargo test --all-features --workspace
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "coverage"
cache-on-failure: true
- name: Cache par2cmdline
id: cache-par2-coverage
uses: actions/cache@v4
with:
path: ~/bin/par2
key: ${{ runner.os }}-par2cmdline
- name: Install par2cmdline
if: steps.cache-par2-coverage.outputs.cache-hit != 'true'
run: |
sudo apt-get update && sudo apt-get install -y par2
mkdir -p ~/bin
cp /usr/bin/par2 ~/bin/par2
- name: Add par2 to PATH
run: echo "$HOME/bin" >> $GITHUB_PATH
- name: Cache cargo-llvm-cov binary
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-llvm-cov
key: ${{ runner.os }}-cargo-llvm-cov-0.6.14
- name: Install cargo-llvm-cov
run: |
if ! command -v cargo-llvm-cov &> /dev/null; then
cargo install cargo-llvm-cov --version 0.6.14 --locked
fi
- name: Generate coverage report
run: |
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: lcov.info