-
Notifications
You must be signed in to change notification settings - Fork 3
108 lines (89 loc) · 2.99 KB
/
Copy pathci-rust.yml
File metadata and controls
108 lines (89 loc) · 2.99 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
name: CI Rust
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches: [main]
paths:
- 'rsworkspace/**'
- '.mise.toml'
- '.config/mise/tasks/**'
- '.github/workflows/ci-rust.yml'
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: jdx/mise-action@v4.0.1
- name: Install Rust components
run: rustup component add rustfmt clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.9.1
with:
workspaces: rsworkspace -> target
save-if: always
- name: Check formatting
run: cargo fmt --all -- --check
working-directory: rsworkspace
- name: Run clippy
run: cargo clippy --all-targets --all-features
working-directory: rsworkspace
test:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
persist-credentials: true
- uses: jdx/mise-action@v4.0.1
- name: Install Rust components
run: rustup component add llvm-tools-preview
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.9.1
with:
workspaces: rsworkspace -> target
save-if: always
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Run tests with coverage
run: cargo cov --cobertura --output-path coverage.xml
working-directory: rsworkspace
- name: Coverage report and gate
# TODO: Add a fork-safe read-only coverage comparison path; this action writes to
# _xml_coverage_reports, but fork PR tokens cannot push to the base repo.
uses: insightsengineering/coverage-action@v3
with:
path: rsworkspace/coverage.xml
threshold: 95
fail: true
publish: true
diff: true
diff-branch: main
diff-storage: _xml_coverage_reports
uncovered-statements-increase-failure: ${{ !contains(github.event.pull_request.labels.*.name, 'rust:coverage-baseline-reset') }}
new-uncovered-statements-failure: ${{ !contains(github.event.pull_request.labels.*.name, 'rust:coverage-baseline-reset') }}
coverage-rate-reduction-failure: ${{ !contains(github.event.pull_request.labels.*.name, 'rust:coverage-baseline-reset') }}
togglable-report: true
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: jdx/mise-action@v4.0.1
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.9.1
with:
workspaces: rsworkspace -> target
save-if: always
- name: Build release
run: cargo build --release
working-directory: rsworkspace