-
Notifications
You must be signed in to change notification settings - Fork 76
111 lines (94 loc) · 3.07 KB
/
pull_request.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
104
105
106
107
108
109
110
111
name: PR Checks
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
SCCACHE_GHA_ENABLED: "on"
container: ghcr.io/xline-kv/build-env:latest
strategy:
fail-fast: true
matrix:
config:
- {
name: "Normal",
args: "",
rustflags: "",
test: "llvm-cov nextest --all-features --workspace --codecov --output-path codecov.info",
}
- {
name: "Madsim",
args: "--package=simulation",
rustflags: "--cfg madsim",
test: "nextest run --package=simulation",
}
name: Tests ${{ matrix.config.name }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure sccache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Trailing spaces check
run: ci/scripts/check-trailing-spaces.sh
- name: Audit
run: cargo audit
- name: Format
run: cargo fmt --all -- --check
- name: Sort crates
run: cargo sort --check --workspace
- name: Check dependencies
run: cargo machete crates/
- name: Workspace hack check
run: cargo hakari generate --diff && cargo hakari manage-deps --dry-run && cargo hakari verify
- run: sccache --zero-stats > /dev/null
- name: Clippy ${{ matrix.config.name }}
env:
RUSTFLAGS: ${{ matrix.config.rustflags }}
run: cargo clippy ${{ matrix.config.args }} --all-targets --all-features -- -D warnings
- name: Sccache stats ${{ matrix.config.name }}
run: sccache --show-stats && sccache --zero-stats > /dev/null
- name: Test ${{ matrix.config.name }}
env:
RUSTFLAGS: ${{ matrix.config.rustflags }}
run: cargo ${{ matrix.config.test }}
- name: Sccache stats ${{ matrix.config.name }}
run: sccache --show-stats
- name: Upload coverage to Codecov
if: matrix.config.name == 'Normal'
run: ci/scripts/upload-codecov.sh codecov.info
commit:
name: Commit Message Validation
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git show-ref
- uses: actions-rs/[email protected]
with:
crate: git-cz
version: latest
- name: Validate commit messages
run: git-cz check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
spell-check:
name: Spell Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Spelling
uses: crate-ci/typos@master