-
Notifications
You must be signed in to change notification settings - Fork 98
78 lines (76 loc) · 2.68 KB
/
test.yaml
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
name: Build, Test & Coverage
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
rust-version:
- stable
- nightly
cargo-args:
- ''
- '--all-features'
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo binaries
uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
- name: Toolchain setup
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: llvm-tools-preview
- name: Install grcov
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
- name: Run tests
run: cargo test --all-features --no-fail-fast
env:
RUSTFLAGS: '-Cinstrument-coverage'
- name: Run grcov
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
# Important! Keep in grcov flags in sync with Makefile.internal.toml.
run: >
grcov .
--binary-path target/debug/deps/
--source-dir .
--branch
--ignore-not-existing
--ignore '../**'
--ignore '/*'
--ignore 'fluent-testing/*'
--ignore 'fluent-syntax/src/bin/*'
--output-type 'lcov'
--output-path 'coverage.lcov'
--excl-start '^#\[cfg\(test\)\]|^// coverage\(off\)'
--excl-br-start '^#\[cfg\(test\)\]|^// coverage\(off\)'
--excl-stop '^// coverage\(on\)'
--excl-br-stop '^// coverage\(on\)'
--excl-line '\#\[derive\(|// cov\(skip\)'
--excl-br-line '\#\[derive\(|// cov\(skip\)'
- name: Coveralls upload
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov