-
Notifications
You must be signed in to change notification settings - Fork 15
183 lines (154 loc) · 6.16 KB
/
offchain-worker.yml
File metadata and controls
183 lines (154 loc) · 6.16 KB
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
# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings
name: offchain worker
# Triger: only call from main workflow(re-usable workflows)
on:
workflow_call:
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
prepare-execution-marix:
name: Prepare execution matrix
runs-on: [ci]
outputs:
matrix: ${{ steps.create_matrix.outputs.matrix }}
steps:
- name: Clean Workspace
uses: AutoModality/action-clean@v1.1.0
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4.1.7
with:
ref: ${{ github.head_ref }} #Checking out head commit
- name: Read .env file
uses: xom9ikk/dotenv@v2.3.0
- name: Create Execution matrix
uses: CertainLach/create-matrix-action@v4
id: create_matrix
with:
matrix: |
network {quartz}, relay_name {kusama}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}
dev_build_int_tests:
needs: prepare-execution-marix
# The type of runner that the job will run on
runs-on: [ci]
timeout-minutes: 1380
name: ${{ matrix.network }}
strategy:
matrix:
include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.
steps:
- name: Skip if pull request is in Draft
if: github.event.pull_request.draft == true
run: exit 1
- name: Clean Workspace
uses: AutoModality/action-clean@v1.1.0
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4.1.7
with:
ref: ${{ github.head_ref }} #Checking out head commit
# Prepare SHA
- name: Prepare SHA
uses: ./.github/actions/prepare
- name: Read .env file
uses: xom9ikk/dotenv@v2.3.0
- name: Log in to Docker Hub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Check and pull polkadot image
id: polkadot
uses: cloudposse/github-action-docker-image-exists@main
with:
registry: registry.hub.docker.com
organization: parity
repository: polkadot
login: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
tag: ${{ matrix.relay_branch }}
- name: Prepare target
uses: ./.github/actions/buildContainer
id: target
with:
container: uniquenetwork/ci-xcm-local
tag: ${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}
context: .
dockerfile: .docker/Dockerfile-unique
args: |
--build-arg FEATURES=${{ matrix.network }}-runtime
dockerhub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
# - name: Prepare target node
# uses: ./.github/actions/buildContainer
# id: node
# with:
# container: uniquenetwork/ci-xcm-local
# tag: ${{ matrix.network }}-${{ env.NODE_BRANCH }}-${{ env.NODE_HASH}}
# context: .docker
# dockerfile: Dockerfile-unique-release
# args: |
# --build-arg FEATURES=${{ matrix.network }}-runtime
# --build-arg CODE_VERSION=${{ env.NODE_BRANCH}}
# --build-arg CODE_HASH=${{ env.NODE_HASH}}
# dockerhub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
# dockerhub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
cache: true
- name: Install baedeker
uses: UniqueNetwork/baedeker-action/setup@v1.2
with:
version: ${{ env.BAEDEKER_VERSION }}
useCache: false
- name: Setup library
run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library
- name: Start network
uses: UniqueNetwork/baedeker-action@v1.2
id: bdk
with:
jpath: |
.baedeker/vendor
input-modules: |
lib:baedeker-library/ops/nginx-dev.libsonnet
lib:baedeker-library/ops/devtools.libsonnet
tla-str: |
relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local
tla-code: |
assethub_spec=import 'assethub-spec.json'
inputs: |
.baedeker/ocw-${{ matrix.network }}.jsonnet
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.image }}:${{ steps.polkadot.outputs.tag }}'}})
snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.target.outputs.name }}'}})
- name: Upload network config
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.network }}-network-config-ocw
path: ${{ steps.bdk.outputs.composeProject }}
retention-days: 2
- name: Ensure network is alive
working-directory: js-packages/tests
id: alive1
if: ${{ !cancelled() && steps.bdk.outcome == 'success' }}
run: |
deno install
../scripts/wait_for_first_block.sh
env:
RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}
- name: Run Offchain worker tests
working-directory: js-packages/tests
id: tests
if: ${{ !cancelled() && steps.alive1.outcome == 'success' }}
run: |
echo "Ready to start tests"
NOW=$(date +%s) && deno task testOcwQuartz
env:
RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}
- name: Remove all containers
if: always() # run this step always
run: |
docker ps -aq | xargs docker rm -f
- name: Remove builder cache
if: always()
run: |
docker system prune -a -f