-
Notifications
You must be signed in to change notification settings - Fork 13
103 lines (100 loc) · 3.52 KB
/
ci.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
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
on:
push:
branches:
- main
pull_request:
branches:
- main
name: Continuous integration
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: dtolnay/rust-toolchain@stable
id: toolchain
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-
${{ runner.os }}-dot-cargo-
- name: Run tests
run: cargo test --release
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: dtolnay/rust-toolchain@nightly
id: toolchain
with:
components: 'llvm-tools-preview'
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-grcov-0.8.18-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-grcov-0.8.18-
${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-${{ hashFiles('**/Cargo.lock') }}-
${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-
${{ runner.os }}-dot-cargo-
- name: Install grcov
run: cargo install grcov --version 0.8.18
- name: Build
run: cargo build
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
- name: Run tests
run: cargo test --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort'
RUSTDOCFLAGS: '-Cpanic=abort'
- name: Run grcov
run: |
zip -0 ccov.zip `find . \( -name "jxl_*.gc*" -or -name "conformance-*.gc*" -or -name "decode-*.gc*" \) -print`
grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '../**' --ignore "/*" -o coverage.lcov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.lcov
flags: rust
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
id: toolchain
with:
components: clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dot-cargo-${{ steps.toolchain.outputs.cacheKey }}-
${{ runner.os }}-dot-cargo-
- run: cargo clippy -- -D warnings