-
Notifications
You must be signed in to change notification settings - Fork 3
170 lines (137 loc) · 4.87 KB
/
checks.yml
File metadata and controls
170 lines (137 loc) · 4.87 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
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
170
name: checks
on:
push:
branches:
- main
paths-ignore:
# NOTE: docs/reference/cli.md is auto-generated and ideally should trigger
# the cli-ref check when manually edited. However, GitHub Actions does not
# support combining paths-ignore with negation patterns, so we accept the
# tradeoff: manual edits to that file won't be caught in isolation, but
# will be caught the next time any Rust source is changed and the checks run.
- "**.md"
- "docs-site/**"
- "npm/**"
pull_request:
paths-ignore:
# See push paths-ignore NOTE above for the tradeoff explanation.
- "**.md"
- "docs-site/**"
- "npm/**"
jobs:
compile:
name: compile:required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Setup image (Linux)
run: ./.github/scripts/provision-linux-build.sh
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
with:
cache-shared-key: ${{ runner.os }}-checks
- name: build
run: cargo build
env:
RUST_BACKTRACE: 1
lint:
name: lint:required
needs: compile # Run after compilation to use the cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Setup image (Linux)
run: ./.github/scripts/provision-linux-build.sh
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
with:
cache-shared-key: ${{ runner.os }}-checks
- name: Run Lint
run: cargo clippy --verbose --tests --benches -- -D warnings
env:
RUST_BACKTRACE: 1
format:
name: fmt:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Setup image (Linux)
run: ./.github/scripts/provision-linux-build.sh
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
with:
cache-shared-key: ${{ runner.os }}-checks
- name: Check formatting
run: cargo fmt --all -- --check
toml-format:
name: toml-fmt:required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Install taplo
run: |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-linux-x86_64.gz \
| gunzip -c > taplo
chmod +x taplo
sudo mv taplo /usr/local/bin/taplo
- name: Check TOML formatting
run: taplo fmt --check
#
# Runs a series of checks to make sure that all the docs
# that need to be generated have been genrated an are up
# to date.
#
cli-ref:
#
# generate the CLI reference file and check if it is up to date
#
name: cli-ref:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Setup image (Linux)
run: ./.github/scripts/provision-linux-build.sh
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
with:
cache-shared-key: ${{ runner.os }}-checks
- name: generate docs
run: ./scripts/generate-cli-docs.sh
- name: Check for uncommitted changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "❌ The cli-reference documentation is not up to date"
echo ""
echo " Run ./scripts/generate-cli-docs.sh to update them"
echo ""
git status --porcelain
exit 1
else
echo "✅ Git state is clean."
fi
icp-yaml-schema:
#
# generate config schemas and check if they are up to date
#
name: icp-yaml-schema:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Setup image (Linux)
run: ./.github/scripts/provision-linux-build.sh
- uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
with:
cache-shared-key: ${{ runner.os }}-checks
- name: generate schemas
run: ./scripts/generate-config-schemas.sh
- name: Check for uncommitted changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "❌ The schema docs are not up to date"
echo ""
echo " Run ./scripts/generate-config-schemas.sh to update them"
echo ""
git status --porcelain
exit 1
else
echo "✅ Git state is clean."
fi