-
Notifications
You must be signed in to change notification settings - Fork 6
189 lines (185 loc) · 5.88 KB
/
tests.yaml
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
name: 'Code tests'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- labeled
merge_group:
types: [checks_requested]
branches:
- main
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .
# sscache environment variables
SCCACHE_GHA_ENABLED: 'true'
RUSTC_WRAPPER: 'sccache'
jobs:
test-rust:
name: 'test-rust:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: 'Test cargo crates'
run: cargo test --locked --workspace --exclude integration-tests
test-node:
name: 'test-node:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup Node'
uses: ./.github/actions/setup-node
- name: 'Install Dependencies'
run: |
pnpm install --frozen-lockfile
- name: 'Check code'
run: |
pnpm test -- --run
# Github Actions only supports jobs to be run in parallel, not steps, so we have to build the packages in
# separate jobs from the integration tests execution to speed up the build.
build-wasms:
name: Build canister
runs-on: ubuntu-latest
strategy:
matrix:
include:
- crate: control-panel
canister: control_panel
- crate: upgrader
canister: upgrader
- crate: station
canister: station
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: 'Build Package'
run: ./scripts/generate-wasm.sh ${{ matrix.crate }}
- name: 'Prepare artifacts'
run: |
mkdir -p artifacts
mv tests/integration/wasms/* artifacts
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v3
with:
name: integration-tests
path: artifacts/${{ matrix.canister }}.wasm.gz
retention-days: 10
if-no-files-found: error
download-canisters:
name: Download Canister
runs-on: ubuntu-latest
strategy:
matrix:
include:
- canister: 'icp_ledger'
name: 'ledger-canister'
- canister: 'icp_index'
name: 'ic-icp-index-canister'
- canister: 'cmc'
name: 'cycles-minting-canister'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Download Canister'
run: ./scripts/download-nns-canister-wasm.sh ${{ matrix.canister }} ${{ matrix.name }}
- name: 'Prepare artifacts'
run: |
mkdir -p artifacts
mv tests/integration/wasms/* artifacts
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v3
with:
name: integration-tests
path: artifacts/${{ matrix.canister }}.wasm.gz
retention-days: 10
if-no-files-found: error
integration-tests:
name: 'integration-tests:required'
needs: [build-wasms, download-canisters]
runs-on: ubuntu-latest
env:
BUILD_WASMS: 'false'
DOWNLOAD_NNS_CANISTERS: 'false'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: 'Download Artifacts'
uses: actions/download-artifact@v3
with:
name: integration-tests
path: tests/integration/wasms
- name: Run integration tests
run: |
./scripts/run-integration-tests.sh 2> logs.txt
grep "rng succesfully initialized" logs.txt
! grep "canister reports healthy already before its initialization has finished" logs.txt
deployment-test:
name: 'deployment-test:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup pnpm'
uses: pnpm/action-setup@v3
with:
version: 8
- name: 'Setup node'
uses: actions/setup-node@v4
with:
node-version: 20
- name: 'Run sccache-cache'
uses: mozilla-actions/[email protected]
- name: 'Install dfx'
uses: dfinity/setup-dfx@main
- name: 'Start local replica'
run: dfx start --clean --host 127.0.0.1:4943 --background
- name: 'Perform local deployment'
run: ./orbit --init
- name: 'Test local deployment'
run: |
curl http://werw6-ayaaa-aaaaa-774aa-cai.localhost:4943/ | grep "<title>Orbit Wallet</title>"
prod-deployment-test:
name: 'prod-deployment-test:required'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup pnpm'
uses: pnpm/action-setup@v3
with:
version: 8
- name: 'Setup node'
uses: actions/setup-node@v4
with:
node-version: 20
- name: 'Run sccache-cache'
uses: mozilla-actions/[email protected]
- name: 'Install dfx'
uses: dfinity/setup-dfx@main
- name: 'Start local replica'
run: dfx start --clean --host 127.0.0.1:4943 --background
- name: 'Test prod deployment script'
run: |
echo y | ./scripts/deploy.sh --local # install
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>"
echo y | ./scripts/deploy.sh --local # upgrade
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>"
echo y | ./scripts/deploy.sh --local reset # uninstall and install
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>"