-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 2.75 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
name: Continuous Integration
on:
push:
paths:
- Cargo.lock
- Cargo.toml
- resources/assets/*.ttf
- src/**
pull_request:
paths:
- Cargo.lock
- Cargo.toml
- resources/assets/*.ttf
- src/**
jobs:
lint:
name: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
lint: [check, test, clippy, fmt]
exclude: # https://github.com/community/community/discussions/7835
- os: windows-latest
lint: clippy
- os: windows-latest
lint: fmt
- os: macOS-latest
lint: clippy
- os: macOS-latest
lint: fmt
include:
- lint: check
args: " --all-features"
- lint: test
args: ""
- lint: clippy
args: " --all --all-features -- -D warnings"
- lint: fmt
args: " --all -- --check"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1 # faster linker
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-${{ matrix.lint }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.OS }}-${{ matrix.lint }}-
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- run: cargo ${{ matrix.lint }}${{ matrix.args }}
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.19/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up DeepSource CLI
run: curl https://deepsource.io/cli | sh
- name: Install LLVM-profdata
run: rustup component add llvm-tools-preview
- name: Run tests
run: CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
- name: make coverage directory
run: mkdir ./target/coverage
- name: Run GRCOV
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./target/coverage/tests.lcov
- name: Upload to DeepSource
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: ./bin/deepsource report --analyzer test-coverage --key rust --value-file ./target/coverage/tests.lcov