-
Notifications
You must be signed in to change notification settings - Fork 7
194 lines (189 loc) · 6.96 KB
/
checks.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI Checks
on:
push:
branches:
- main
pull_request:
jobs:
formatting:
runs-on: ubuntu-20.04
env:
DFX_NETWORK: mainnet
# In order to trigger the CLA after committing formatting changes, we need
# to use the GIX_CREATE_PR_PAT token. This token is not available for all
# users. So on PRs where the token is not available, we don't commit
# changes and instead just fail if the formatting is incorrect.
steps:
- name: Check if commits can be added
id: check_can_add_commit
run: |
echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GIX_CREATE_PR_PAT }}
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'false'
uses: actions/checkout@v4
- name: Install shfmt
run: sudo snap install --classic shfmt
- name: Format shell scripts
run: ./scripts/fmt-sh
- name: Restore dfx.json
run: cp dfx.json.original dfx.json
- name: Check formatting changes
id: check_format
run: |
if git diff --exit-code; then
echo "formatting_needed=false" >> $GITHUB_OUTPUT
else
echo "formatting_needed=true" >> $GITHUB_OUTPUT
fi
- name: Commit Formatting changes
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true'
uses: EndBug/[email protected]
with:
add: .
default_author: github_actions
message: "Updating formatting"
# do not pull: if this branch is behind, then we might as well let
# the pushing fail
pull_strategy: "NO-PULL"
- name: Fail for formatting issues without personal access token
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true'
run: |
echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available or this isn't a pull request."
exit 1
shell-checks:
needs: formatting
name: ShellCheck
runs-on: ubuntu-20.04
steps:
- name: Install apt-dependencies
run: sudo apt-get update && sudo apt-get install moreutils -yy && command -v more
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC1090 -e SC2119 -e SC1091 -e SC2121 -e SC2155 -e SC2094 -e SC2015
clap-checks:
needs: formatting
name: Clap checks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Clap works
run: ./bin/clap.test
sns-aggregator-canister-checks:
needs: formatting
name: SNS aggregator tools
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install apt-dependencies
run: sudo apt-get update && sudo apt-get install moreutils -yy && command -v more
- name: Install cargo binstall
uses: ./.github/actions/install_binstall
- name: Install tools
run: |
. bin/versions.bash
cargo binstall --force --no-confirm "ic-wasm@${IC_WASM_VERSION}"
- name: "Test the sns aggregator version command"
run: ./bin/dfx-software-sns-aggregator-version.test
env:
GH_TOKEN: ${{ github.token }}
- name: "Test the aggregator wasm download command"
run: ./bin/dfx-software-sns-aggregator-ci-wasm-url.test --verbose
env:
GH_TOKEN: ${{ github.token }}
- name: Install dfx
uses: dfinity/setup-dfx@main
- name: "Test the aggregator wasm install command"
run: ./bin/dfx-software-sns-aggregator-install.test --verbose
env:
GH_TOKEN: ${{ github.token }}
ckbtc-checks:
needs: formatting
name: CKBTC tools
runs-on: ubuntu-20.04
steps:
- name: Install apt-dependencies
run: sudo apt-get update && sudo apt-get install moreutils -yy && command -v more
- uses: actions/checkout@v3
- name: Install dfx
uses: dfinity/setup-dfx@main
- name: Import ckbtc works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-ckbtc-import.test
git clean -dfx
- name: Deploy ckbtc works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-ckbtc-deploy.test
git clean -dfx
- name: Import token works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-token-import.test
git clean -dfx
- name: Deploy token works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-token-deploy.test
git clean -dfx
- name: Install mock bitcoin canister works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-software-mock-bitcoin-install.test
git clean -dfx
nns-dapp-canister-checks:
needs: formatting
name: NNS dapp tools
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Test the nns-dapp version command"
run: ./bin/dfx-software-nns-dapp-version.test
env:
GH_TOKEN: ${{ github.token }}
- name: Install cargo binstall
uses: ./.github/actions/install_binstall
- name: Install tools
run: |
. bin/versions.bash
cargo binstall --force --no-confirm "ic-wasm@${IC_WASM_VERSION}"
- name: "Test the nns-dapp url command"
run: ./bin/dfx-software-nns-dapp-ci-wasm-url.test
env:
GH_TOKEN: ${{ github.token }}
dfx-canister-url-checks:
needs: formatting
name: Canister URL checks
runs-on: ubuntu-20.04
steps:
- name: Install apt-dependencies
run: sudo apt-get update && sudo apt-get install moreutils -yy && command -v more
- uses: actions/checkout@v3
- name: Install dfx
uses: dfinity/setup-dfx@main
- name: dfx-canister-url works
run: |
set -euxo pipefail
echo "This modifies files, so make sure the state is clean before and after"
git clean -dfx
bin/dfx-canister-url.test --verbose
git clean -dfx