-
Notifications
You must be signed in to change notification settings - Fork 38
189 lines (175 loc) · 7.25 KB
/
test.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
# This GitHub Action flow works as follows:
# Each directory in the examples and tests directory represents an example project and is intended to have tests that ensure the canisters contained in that example function properly.
# These tests are currently written in TypeScript and are intended to be run in a Node.js environment.
# This GitHub Action takes care of deploying to npm and GitHub.
name: Test
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened
workflow_dispatch:
inputs:
fuzz:
description: 'Run fuzz tests'
required: true
type: boolean
default: false
exclude-slow-tests:
description: 'Exclude slow tests'
required: true
type: boolean
default: true
exclude-unstable-tests:
description: 'Exclude unstable tests'
required: true
type: boolean
default: true
exclude-release-only-tests:
description: 'Exclude release-only tests'
required: true
type: boolean
default: true
link-azle:
description: 'Link to development version of azle'
required: true
type: boolean
default: true
jobs:
workflow-config:
name: Determine workflow config
runs-on: ubuntu-latest
outputs:
exclude-slow: ${{ steps.determine-workflow-config.outputs.exclude-slow }}
exclude-unstable: ${{ steps.determine-workflow-config.outputs.exclude-unstable }}
exclude-release-only: ${{ steps.determine-workflow-config.outputs.exclude-release-only }}
link-azle: ${{ steps.determine-workflow-config.outputs.link-azle }}
fuzz: ${{ steps.determine-workflow-config.outputs.fuzz }}
steps:
- uses: actions/checkout@v4
- id: determine-workflow-config
uses: ./.github/actions/determine_workflow_config
with:
is-workflow-dispatch: ${{ github.event_name == 'workflow_dispatch' }}
exclude-slow-dispatch-input-value: ${{ inputs.exclude-slow-tests }}
exclude-unstable-dispatch-input-value: ${{ inputs.exclude-unstable-tests }}
exclude-release-only-dispatch-input-value: ${{ inputs.exclude-release-only-tests }}
link-azle-dispatch-input-value: ${{ inputs.link-azle }}
fuzz-dispatch-input-value: ${{ inputs.fuzz }}
get-exclude-dirs:
name: Get exclude directories
needs: workflow-config
runs-on: ubuntu-latest
outputs:
exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }}
steps:
- uses: actions/checkout@v4
- id: get-exclude-dirs
uses: ./.github/actions/get_exclude_dirs
with:
exclude-slow: ${{ needs.workflow-config.outputs.exclude-slow }}
exclude-unstable: ${{ needs.workflow-config.outputs.exclude-unstable }}
exclude-release-only: ${{ needs.workflow-config.outputs.exclude-release-only }}
run-tests:
name: ${{ matrix.test_group.name }}
needs:
- workflow-config
- get-exclude-dirs
strategy:
fail-fast: false
matrix:
test_group:
- {
name: 'Stable Demo',
directories: './examples/stable/demo'
}
- {
name: 'Stable Demo (Experimental)',
directories: './examples/stable/demo',
run-experimental: true
}
- {
name: 'Experimental Demo',
directories: './examples/experimental/demo'
}
- {
name: 'Stable E2E CRPC',
directories: './examples/stable/test/end_to_end/candid_rpc'
}
- {
name: 'Stable E2E CRPC (Experimental)',
directories: './examples/stable/test/end_to_end/candid_rpc',
run-experimental: true
}
- {
name: 'Experimental E2E CRPC',
directories: './examples/experimental/test/end_to_end/candid_rpc'
}
- {
name: 'Experimental E2E HTTP Server',
directories: './examples/experimental/test/end_to_end/http_server'
}
- {
name: 'Stable Property CRPC',
directories: './examples/stable/test/property/candid_rpc'
}
- {
name: 'Stable Property CRPC (Experimental)',
directories: './examples/stable/test/property/candid_rpc',
run-experimental: true
}
- {
name: 'Experimental Property CRPC',
directories: './examples/experimental/test/property/candid_rpc'
}
- {
name: 'Stable Property IC API',
directories: './examples/stable/test/property/ic_api'
}
- {
name: 'Stable Property IC API (Experimental)',
directories: './examples/stable/test/property/ic_api',
run-experimental: true
}
uses: ./.github/workflows/run_test.yml
with:
directories: ${{ matrix.test_group.directories }}
exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }}
link-azle: ${{ needs.workflow-config.outputs.link-azle == 'true' }}
run-experimental: ${{ matrix.test_group.run-experimental || false }}
fuzz: ${{ needs.workflow-config.outputs.fuzz == 'true' }}
top-level-checks:
name: Top level checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_node
- uses: ./.github/actions/setup_dfx
- uses: ./.github/actions/retry_command
with:
command: 'npm install'
- run: npm run typecheck
- run: npm run lint
check-test-success:
name: Check Azle tests succeeded
needs:
- run-tests
- top-level-checks
runs-on: ubuntu-latest
if: success()
steps:
- run: exit 0
check-test-failure:
name: Check Azle tests didn't fail
needs:
- run-tests
- top-level-checks
runs-on: ubuntu-latest
if: failure()
steps:
- run: exit 1