forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (181 loc) · 6.82 KB
/
gluwa.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
---
name: gluwa
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master, release-polkadot-v-*]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions: read-all
env:
RUNNER_VM_NAME: "${{ github.event.repository.name }}-$GITHUB_RUN_ID-attempt-$GITHUB_RUN_ATTEMPT"
LINODE_REGION: "nl-ams"
# Shared CPU, Linode 64 GB, 16 vCPU, disk: 1280 GB, 0.576 $/hr
LINODE_VM_SIZE: "g6-standard-16"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy-github-runner:
name: deploy-github-runner / type=${{ matrix.proxy_type }}
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- proxy_type: check
- proxy_type: test
steps:
- uses: actions/checkout@v4
# See https://github.com/actions/runner/issues/1879#issuecomment-1123196869
- name: Create matrix.txt
run: |
echo "proxy=${{ matrix.proxy }} / ${{ matrix.secret }} / type=${{ matrix.proxy_type }}" > matrix.txt
- name: Evaluate env vars
id: get-env
run: |
HASH_VALUE=$(echo "${{ hashFiles('matrix.txt') }}" | cut -c1-7)
rm matrix.txt
# WARNING: using env.RUNNER_VM_NAME directly in job outputs above
# doesn't evaluate the $GITHUB_RUN_ID reference
echo "runner_vm_name=${{ env.RUNNER_VM_NAME }}-$HASH_VALUE" >> "$GITHUB_OUTPUT"
- name: Provision VM
if: env.LC_GITHUB_REPO_ADMIN_TOKEN
run: |
.github/provision-linode-vm.sh
env:
LC_OWNER_REPO_SLUG: ${{ github.repository }}
LC_GITHUB_REPO_ADMIN_TOKEN: ${{ secrets.GH_REPO_ADMIN_TOKEN }}
LC_RUNNER_VM_NAME: ${{ steps.get-env.outputs.runner_vm_name }}
LC_PROXY_ENABLED: ${{ matrix.proxy }}
LC_PROXY_SECRET_VARIANT: ${{ matrix.secret }}
LC_PROXY_TYPE: ${{ matrix.proxy_type }}
LC_WORKFLOW_ID: ${{ github.run_id }}
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
- name: Upload Linode logs
if: always()
uses: actions/upload-artifact@v4
with:
name: linode-${{ matrix.proxy }}-${{ matrix.secret }}-${{ matrix.proxy_type }}-logs
path: retry*.json
cargo-check:
needs:
- deploy-github-runner
runs-on:
[self-hosted, "workflow-${{ github.run_id }}", "type-check"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set-Up
run: |
sudo apt-get update
sudo apt install -y cmake pkg-config libssl-dev clang libclang-dev llvm protobuf-compiler
- name: Configure rustc version
run: |
# use the version defined in gluwa/creditcoin3
RUSTC_VERSION=$(curl --silent https://raw.githubusercontent.com/gluwa/creditcoin3/dev/rust-toolchain.toml | grep channel | tail -n1 | tr -d " " | cut -f2 -d'"')
echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: gluwa/toolchain@dev
with:
toolchain: ${{ env.RUSTC_VERSION }}
target: wasm32-unknown-unknown
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Check Build
run: |
cargo check --release
cargo-test:
needs:
- deploy-github-runner
runs-on:
[self-hosted, "workflow-${{ github.run_id }}", "type-test"]
steps:
- uses: actions/checkout@v4
- name: Set-Up
run: |
sudo apt-get update
sudo apt install -y cmake pkg-config libssl-dev clang libclang-dev llvm protobuf-compiler
- name: Configure rustc version
run: |
# use the version defined in gluwa/creditcoin3
RUSTC_VERSION=$(curl --silent https://raw.githubusercontent.com/gluwa/creditcoin3/dev/rust-toolchain.toml | grep channel | tail -n1 | tr -d " " | cut -f2 -d'"')
echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: gluwa/toolchain@dev
with:
toolchain: ${{ env.RUSTC_VERSION }}
target: wasm32-unknown-unknown
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Run tests
uses: gluwa/cargo@dev
with:
command: test
args: --features runtime-benchmarks --lib
rm-gh-runner-cargo-check:
runs-on: ubuntu-latest
needs:
- cargo-check
if: ${{ always() }}
# WARNING: same matrix as integration-test-cli job
strategy:
fail-fast: false
matrix:
include:
- proxy_type: check
name: remove-github-runner / type=${{ matrix.proxy_type }}
steps:
- uses: actions/checkout@v4
# See https://github.com/actions/runner/issues/1879#issuecomment-1123196869
- name: Create matrix.txt
run: |
echo "proxy=${{ matrix.proxy }} / ${{ matrix.secret }} / type=${{ matrix.proxy_type }}" > matrix.txt
- name: Evaluate env vars
id: get-env
run: |
HASH_VALUE=$(echo "${{ hashFiles('matrix.txt') }}" | cut -c1-7)
rm matrix.txt
echo "runner_vm_name=${{ env.RUNNER_VM_NAME }}-$HASH_VALUE" >> "$GITHUB_OUTPUT"
- name: Remove VM
continue-on-error: true
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ steps.get-env.outputs.runner_vm_name }}
rm-gh-runner-cargo-test:
runs-on: ubuntu-latest
needs:
- cargo-test
if: ${{ always() }}
# WARNING: same matrix as integration-test-cli job
strategy:
fail-fast: false
matrix:
include:
- proxy_type: test
name: remove-github-runner / type=${{ matrix.proxy_type }}
steps:
- uses: actions/checkout@v4
# See https://github.com/actions/runner/issues/1879#issuecomment-1123196869
- name: Create matrix.txt
run: |
echo "proxy=${{ matrix.proxy }} / ${{ matrix.secret }} / type=${{ matrix.proxy_type }}" > matrix.txt
- name: Evaluate env vars
id: get-env
run: |
HASH_VALUE=$(echo "${{ hashFiles('matrix.txt') }}" | cut -c1-7)
rm matrix.txt
echo "runner_vm_name=${{ env.RUNNER_VM_NAME }}-$HASH_VALUE" >> "$GITHUB_OUTPUT"
- name: Remove VM
continue-on-error: true
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ steps.get-env.outputs.runner_vm_name }}