-
Notifications
You must be signed in to change notification settings - Fork 115
185 lines (169 loc) · 6.01 KB
/
run-network-tests.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
name: run-network-tests
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
push:
jobs:
tests_build_ubuntu:
name: Ubuntu Checks
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: checks
run: |
yarn build
tests_build_osx:
name: MacOS Checks
runs-on: macos-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: python setuptools
run: brew install python-setuptools
- name: checks
run: |
yarn build
build_images:
name: Build joystream/node
needs: tests_build_ubuntu
runs-on: ubuntu-latest
outputs:
use_artifact: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
runtime: ${{ steps.compute_shasum.outputs.shasum }}
steps:
- name: Make some space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- id: compute_shasum
name: Compute runtime code shasum
env:
RUNTIME_PROFILE: 'TESTING'
run: |
export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
- name: Setup cache directory
run: mkdir ~/docker-images
- name: Cache docker images
uses: actions/cache@v3
env:
cache-name: joystream-node-docker-1
with:
path: ~/docker-images
key: ${{ env.cache-name }}-${{ steps.compute_shasum.outputs.shasum }}
- name: Check if we have cached image
continue-on-error: true
run: |
if [ -f ~/docker-images/joystream-node-docker-image.tar.gz ]; then
docker load --input ~/docker-images/joystream-node-docker-image.tar.gz
cp ~/docker-images/joystream-node-docker-image.tar.gz .
fi
- name: Check if we have pre-built image on Dockerhub
continue-on-error: true
run: |
if ! [ -f joystream-node-docker-image.tar.gz ]; then
docker pull joystream/node:${{ steps.compute_shasum.outputs.shasum }}
docker save --output joystream-node-docker-image.tar joystream/node:${{ steps.compute_shasum.outputs.shasum }}
gzip joystream-node-docker-image.tar
cp joystream-node-docker-image.tar.gz ~/docker-images/
fi
- name: Check we now have an image
id: check_files
uses: andstor/file-existence-action@v1
with:
files: 'joystream-node-docker-image.tar.gz'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v1.7
id: builder1
if: steps.check_files.outputs.files_exists == 'false'
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-tests
if: steps.check_files.outputs.files_exists == 'false'
- name: Build
uses: docker/build-push-action@v3
with:
context: .
file: joystream-node.Dockerfile
platforms: linux/amd64
build-args: |
CARGO_FEATURES=testing-runtime
CODE_SHASUM=${{ steps.compute_shasum.outputs.shasum }}
push: false
tags: joystream/node:${{ steps.compute_shasum.outputs.shasum }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
builder: ${{ steps.builder1.outputs.name }}
load: true
if: steps.check_files.outputs.files_exists == 'false'
- name: Save joystream/node image to cache
run: |
docker save --output joystream-node-docker-image.tar joystream/node:${{ steps.compute_shasum.outputs.shasum }}
gzip joystream-node-docker-image.tar
cp joystream-node-docker-image.tar.gz ~/docker-images/
if: steps.check_files.outputs.files_exists == 'false'
- name: Save joystream/node image to Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
path: joystream-node-docker-image.tar.gz
run_test_scenarios:
name: Tests
needs: build_images
runs-on: ubuntu-latest
strategy:
matrix:
scenario: ['full', 'setupNewChain', 'setupNewChainMultiStorage', 'bonding', 'storageSync']
include:
- scenario: 'full'
no_storage: 'false'
- scenario: 'setupNewChain'
no_storage: 'true'
- scenario: 'setupNewChainMultiStorage'
no_storage: 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Get artifacts
uses: actions/download-artifact@v3
with:
name: ${{ needs.build_images.outputs.use_artifact }}
- name: Install artifacts
run: |
docker load --input joystream-node-docker-image.tar.gz
docker images
- name: Install packages and dependencies
run: |
yarn build
- name: Ensure tests are runnable
run: yarn workspace network-tests build
- name: Execute network tests
run: |
export RUNTIME=${{ needs.build_images.outputs.runtime }}
export NO_STORAGE=${{ matrix.no_storage }}
tests/network-tests/run-tests.sh ${{ matrix.scenario }}