-
Notifications
You must be signed in to change notification settings - Fork 242
313 lines (256 loc) · 10 KB
/
ci.canary.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
name: CI | Canary (Dev)
on:
push:
branches: ["dev"]
paths:
- ".github/workflows/ci.canary.yml"
- ".github/workflows/call.*.yml"
- "package.json"
- "yarn.lock"
- "packages/**"
- "codecov.yml"
# - "**.md" are commented out because docs updates should go into the packages
jobs:
check:
name: Checking what packages need to be built
runs-on: ubuntu-latest
defaults:
run:
shell: nix develop .#ci-minimum -c bash -xe {0}
outputs:
build_subgraph: ${{ env.BUILD_SUBGRAPH }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v13
- name: Initialize nix dev shell
run: |
node --version
yarn --version
shellcheck --version
actionlint --version
- name: Show contexts
env:
HEAD_REF: ${{ github.head_ref }}
GITHUB_REF: ${{ github.ref }}
run: |
echo github.event_name: ${{ github.event_name }}
echo github.sha: ${{ github.sha }}
echo github.repository: ${{ github.repository }}
echo github.ref: "$GITHUB_REF"
echo github.head_ref: "$HEAD_REF"
echo github.base_ref: ${{ github.base_ref }}
- name: Run global lint
run: |
npm run lint:shellcheck
npm run lint:actionlint
- name: Create build set
run: tasks/create-build-set.sh ${{ github.sha }} dev origin
test-spec-haskell:
uses: ./.github/workflows/call.test-spec-haskell.yml
name: Build and Test Spec Haskell (Canary Branch)
needs: [check]
test-solidity-semantic-money:
name: Build and Test Solidity Semantic Money (Canary Branch)
uses: ./.github/workflows/call.test-solidity-semantic-money.yml
needs: [check]
test-ethereum-contracts:
name: Test ethereum-contracts (Canary Branch)
uses: ./.github/workflows/call.test-ethereum-contracts.yml
needs: [check]
with:
run-coverage-tests: false
coverage-ethereum-contracts:
name: Coverage test ethereum-contracts (Canary Branch)
uses: ./.github/workflows/call.test-ethereum-contracts.yml
needs: [check]
with:
run-coverage-tests: true
test-hot-fuzz:
uses: ./.github/workflows/call.test-hot-fuzz.yml
name: Hot Fuzz (Development Branch)
needs: [check]
test-sdk-core:
uses: ./.github/workflows/call.test-sdk-core.yml
name: Build and Test SDK-Core (Development Branch)
needs: [check]
with:
subgraph-release: local
subgraph-endpoint: http://localhost:8000/subgraphs/name/superfluid-test
run-coverage-tests: false
coverage-sdk-core:
uses: ./.github/workflows/call.test-sdk-core.yml
name: Build and Test SDK-Core Coverage (Canary Branch)
needs: [check]
with:
subgraph-release: local
subgraph-endpoint: http://localhost:8000/subgraphs/name/superfluid-test
run-coverage-tests: true
test-subgraph:
uses: ./.github/workflows/call.test-local-subgraph.yml
name: Build and Test Subgraph (Development Branch)
needs: [check]
test-automation-contracts:
uses: ./.github/workflows/call.test-automation-contracts.yml
name: Build and Test Automation Contracts (Canary Branch)
needs: [check]
# deploy subgraph if changes are made, we can call this every time, but we won't actually do any deployments
# if the IPFS hash generated stays the same (no mapping logic changes)
deploy-subgraph-changes:
uses: ./.github/workflows/call.deploy-subgraph.yml
name: "Deploy Hosted Service Subgraph to dev endpoints on all networks"
needs: [check, test-subgraph]
if: needs.check.outputs.build_subgraph
with:
vendor: graph
deployment_env: dev
network: "all"
secrets:
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
upload-coverage-reports:
name: Upload Coverage Reports (Feature Branch)
uses: ./.github/workflows/call.upload-coverage-reports.yml
needs: [coverage-ethereum-contracts, coverage-sdk-core]
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
all-packages-tested:
name: All packages tested (Dev Branch)
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs
if: ${{ always() }}
needs: [ test-spec-haskell
, test-solidity-semantic-money
, test-ethereum-contracts, coverage-ethereum-contracts
, test-hot-fuzz
, test-sdk-core, coverage-sdk-core
, test-subgraph
, test-automation-contracts
]
steps:
- name: Test Results
run: |
function check_result() {
local package_name="$1"
local result="$2"
if [ "$result" == "skipped" ];then
echo "Skipped $package_name package."
else
echo "Checking if $package_name package test passes..."
test "$result" == "success"
echo "Passed."
fi
}
check_result spec-haskell ${{ needs.test-spec-haskell.result }}
check_result solidity-semantic-money ${{ needs.test-solidity-semantic-money.result }}
check_result test-ethereum-contracts ${{ needs.test-ethereum-contracts.result }}
check_result coverage-ethereum-contracts ${{ needs.coverage-ethereum-contracts.result }}
check_result hot-fuzz ${{ needs.test-hot-fuzz.result }}
check_result test-sdk-core ${{ needs.test-sdk-core.result }}
check_result coverage-sdk-core ${{ needs.coverage-sdk-core.result }}
check_result subgraph ${{ needs.test-subgraph.result }}
check_result automation-contracts ${{ needs.test-automation-contracts.result }}
publish-npm-packages:
name: Publish canary packages to registries
permissions: write-all
needs: [all-packages-tested]
runs-on: ubuntu-latest
defaults:
run:
shell: nix develop .#ci-default -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v13
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: |
yarn --cwd packages/sdk-core set-default-subgraph-release-tag
yarn build
env:
SUBGRAPH_RELEASE_TAG: dev
- name: Setup canary package versions locally
run: |
shortRev=$(git rev-parse --short ${{ github.sha }})
preId=dev.${shortRev}
yarn lerna version prerelease --yes --no-git-tag-version --preid "${preId}"
- name: Publish to npm
run: |
tasks/npm-publish.sh packages/ethereum-contracts/ dev --verbose
tasks/npm-publish.sh packages/sdk-core/ dev --verbose
tasks/npm-publish.sh packages/sdk-redux/ dev --verbose
tasks/npm-publish.sh packages/metadata/ dev --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }}
publish-sdk-html-docs:
name: Publish canary HTML docs
needs: [all-packages-tested]
runs-on: ubuntu-latest
defaults:
run:
shell: nix develop .#ci-default -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: superfluid-finance/build-scripts
path: build-scripts
- uses: DeterminateSystems/nix-installer-action@v13
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: |
yarn --cwd packages/sdk-core set-default-subgraph-release-tag
yarn build
env:
SUBGRAPH_RELEASE_TAG: dev
- name: Build HTML documentation of SDK-s
run: |
yarn --cwd packages/sdk-core doc:html
yarn --cwd packages/sdk-redux doc:html
- name: Upload sdk-core HTML documentation
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: packages/sdk-core/dist/docs
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-core@dev', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }}
cloudfront_distribution_id: E3JEO5R14CT8IH
- name: Upload sdk-redux HTML documentation
uses: ./build-scripts/s3cloudfront-hosting/actions/sync
with:
local_build_dir: packages/sdk-redux/dist/docs
aws_region: eu-west-2
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }}
s3_uri: ${{ format('{0}sdk-redux@dev', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }}
cloudfront_distribution_id: E3JEO5R14CT8IH
upgrade-contracts:
name: Upgrade ethereum-contracts on canary testnet (protocol release version "canary")
if: false # disable this for now
needs: [all-packages-tested]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
network: [optimism-sepolia]
defaults:
run:
shell: nix develop .#ci-default -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v13
- name: Build
run: |
yarn install --frozen-lockfile
yarn build
- name: Deploy to ${{ matrix.network }}
run: |
cd packages/ethereum-contracts
npx truffle exec --network ${{ matrix.network }} ops-scripts/deploy-test-environment.js
npx truffle exec --network ${{ matrix.network }} ops-scripts/info-print-contract-addresses.js : addresses.vars
tasks/etherscan-verify-framework.sh ${{ matrix.network }} addresses.vars
env:
RELEASE_VERSION: canary
OPTIMISM_SEPOLIA_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }}
OPTIMISM_SEPOLIA_PROVIDER_URL: ${{ secrets.OPTIMISM_SEPOLIA_PROVIDER_URL }}