-
Notifications
You must be signed in to change notification settings - Fork 3
169 lines (158 loc) · 4.5 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
branches:
- master
merge_group:
pull_request:
branches:
- "**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CC: /usr/bin/clang
CXX: /usr/bin/clang++
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
shell: ${{ steps.filter.outputs.shell }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- 'Cargo.toml'
- 'Cargo.lock'
- '**.rs'
shell:
- '**.sh'
rustfmt:
name: Rustfmt
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
toolchain: nightly
components: rustfmt
install-clang: false
setup-cache: false
- name: Check formatting
run: just check_format
clippy:
name: Clippy
needs: [rustfmt, changes]
if: ${{ needs.changes.outputs.rust == 'true' }} # we duplicate it so gh actions will skip the job and mark it as success
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
components: "clippy,rustfmt"
- name: Clippy check
run: just lint
just_install:
name: just install works
needs: rustfmt
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.shell == 'true'}}
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
components: "clippy,rustfmt"
- name: Clippy check
run: just install
test:
name: Test with codecov
runs-on: [self-hosted, linux]
needs: [rustfmt, changes]
if: ${{ needs.changes.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
components: llvm-tools-preview
fake-procfs: true
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: Run tests
env:
RUSTC_WRAPPER: scripts/coverage.py
RUST_LOG: warn
run: just test_cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: github.repository == 'broxus/tycho'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: codecov.json
fail_ci_if_error: true
integration-test:
name: Integration Test Suite
runs-on: [self-hosted, linux]
if: ${{ needs.changes.outputs.rust == 'true' }}
needs: [rustfmt, changes]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
fake-procfs: true
- name: Run integration tests
env:
RUST_LOG: warn
run: just run_integration_tests
metrics:
name: Metrics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: extractions/setup-just@v2
- name: Check dashboard
run: just check_dashboard
msrv:
name: Check minimum supported Rust version
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: self-hosted
needs: [changes]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
install-clang: false
- uses: taiki-e/install-action@v2
with:
tool: cargo-msrv
- name: Check semver
run: cargo msrv verify --manifest-path cli/Cargo.toml
check-protos:
name: Check protos
if: |
contains(github.event.pull_request.files.*.path, '.proto') ||
(github.event_name == 'push' && contains(join(github.event.commits.*.added, github.event.commits.*.modified), '.proto'))
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
with:
install-clang: false
setup-cache: false
- name: Install protobuf
run: sudo apt update && sudo apt-get -y install protobuf-compiler
- name: Update RPC proto
run: just update_rpc_proto
- name: Check for uncommitted changes
run: git diff --exit-code