-
Notifications
You must be signed in to change notification settings - Fork 39
238 lines (220 loc) · 8.9 KB
/
openzeppelin_test_1_5_and_12_15.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: OCT 1-5 And 12-15
on:
merge_group:
workflow_dispatch:
inputs:
dispatch:
type: string
description: "'regression' or the JSON of a PR's context"
required: true
jobs:
openzeppelin-contracts-1:
strategy:
matrix:
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
# When the permissions key is used, all unspecified permissions are set to no access,
# with the exception of the metadata scope, which always gets read access.
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
statuses: write
env:
IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
IS_REGRESSION: ${{ github.event.inputs.dispatch == 'regression' }}
steps:
- name: Get the git ref of Axon
uses: actions/github-script@v7
id: axon_git_ref
with:
script: |
if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false' && `${{ github.event.inputs.dispatch }}`) {
const dispatch = JSON.parse(`${{ github.event.inputs.dispatch }}`);
const prNum = dispatch.issue.number;
const { data: pullRequest } = await github.rest.pulls.get({
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
pull_number: dispatch.issue.number,
});
return pullRequest.head.sha;
}
return `${{ github.sha }}`;
result-encoding: string
# The `statuses: write` permission is required in this step.
- name: Update the commit Status
if: always()
uses: actions/github-script@v7
with:
script: |
if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') {
github.rest.repos.createCommitStatus({
state: 'pending',
owner: context.repo.owner,
repo: context.repo.repo,
context: '${{ github.workflow }}',
sha: '${{ steps.axon_git_ref.outputs.result}}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});
}
- name: Checkout Axon commit ${{ steps.axon_git_ref.outputs.result}}
uses: actions/checkout@v4
with:
ref: ${{ steps.axon_git_ref.outputs.result}}
- name: Git checkout axonweb3/openzeppelin-contracts
uses: actions/checkout@v4
with:
repository: axonweb3/openzeppelin-contracts
ref: db3e3f521aedf17e3b12b4f92875bc7c1c745cfb
path: openzeppelin-contracts
- uses: actions/setup-node@v4
with:
# TODO: upgrade node-version
node-version: "16"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Node Cache
uses: actions/cache@v3
id: npm-and-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
~/.npm
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build
- name: Build Axon in the development profile
run: |
# check for AVX2 support by inspecting `/proc/cpuinfo` or running `lscpu`
# related issue: https://github.com/axonweb3/axon/issues/1387
lscpu
# PORTABLE=1 USE_SSE=1 tell rocksdb to target AVX2
PORTABLE=1 USE_SSE=1 cargo build
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon init \
--config devtools/chain/config.toml \
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \
> /tmp/log 2>&1
./target/debug/axon run \
--config devtools/chain/config.toml \
>> /tmp/log 2>&1 &
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
- name: Check Axon web3_clientVersion Before Test
run: |
MAX_RETRIES=10
for i in $(seq 1 $MAX_RETRIES); do
sleep 10
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
http_code=$(echo "$response" | tail -n1)
response_body=$(echo "$response" | sed '$d')
if [[ "$http_code" -eq 200 ]]; then
echo "$response_body"
exit 0
else
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
if [[ "$i" -eq $MAX_RETRIES ]]; then
echo "Axon status check failed after $MAX_RETRIES attempts."
exit 1
fi
fi
done
- name: Run prepare
if: success() || failure()
id: runtest
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm install
npm run test:init
- name: Run Pipeline 5-1
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-1
- name: Run Pipeline 5-2
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-2
- name: Run Pipeline 5-3
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-3
- name: Run Pipeline 5-4
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-4
- name: Run Pipeline 5-5
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-5
- name: Run Pipeline 5-12
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-12
- name: Run Pipeline 5-13
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-13
- name: Run Pipeline 5-14
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-14
- name: Run Pipeline 5-15
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/openzeppelin-contracts
npm run test:pipeline5-15
- name: Check Axon Status
if: success() || failure()
run: |
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
await retry(3, '6s', () => waitXBlocksPassed('http://127.0.0.1:8000', 2))
EOF
- name: Publish reports
if: always()
uses: actions/upload-artifact@v3
with:
name: jfoa-build-reports-${{ runner.os }}
path: openzeppelin-contracts/mochawesome-report/
# The `statuses: write` permission is required in this step.
- name: Update the commit Status
if: always()
uses: actions/github-script@v7
with:
script: |
if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false') {
github.rest.repos.createCommitStatus({
state: '${{ job.status }}',
owner: context.repo.owner,
repo: context.repo.repo,
context: '${{ github.workflow }}',
sha: '${{ steps.axon_git_ref.outputs.result}}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});
}