-
Notifications
You must be signed in to change notification settings - Fork 20
61 lines (50 loc) · 2.5 KB
/
examples-nightly.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
name: Nightly Examples Tests
on:
schedule:
# run this workflow every day at 1:30 AM UTC
- cron: "30 1 * * *"
# Allows triggering the workflow manually
workflow_dispatch:
jobs:
prepare-matrix-master-only:
name: Prepare matrix JSON
runs-on: ubuntu-latest
outputs:
matrix-json: ${{ steps.get-matrix.outputs.matrix }}
steps:
# prepares JSON object representing strategy matrix with only the master branch
- name: Get matrix JSON
id: get-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"branch\":\"master\"}]}"
goth-tests:
runs-on: goth2
needs: prepare-matrix-master-only
strategy:
matrix: ${{ fromJson(needs.prepare-matrix-master-only.outputs.matrix-json) }}
fail-fast: false
name: Run example tests (nightly) on ${{ matrix.branch }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use random string for subnet
# Use a random string to avoid other providers on the same subnet which might cause tests to fail because it expects only providers named provider-1 and provider-2
run: echo "YAGNA_SUBNET=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 ; echo '')" >> $GITHUB_ENV
- name: Build the docker containers
run: docker compose -f tests/docker/docker-compose.yml build
- name: Start the docker containers
# Restart docker to avoid issues with the docker compose down due to improper cleanup of the previous run.
run: sudo service docker restart && docker compose -f tests/docker/docker-compose.yml down && docker compose -f tests/docker/docker-compose.yml up -d
- name: Fund the requestor
# Use a funding script which will retry funding the requestor 3 times, else it exits with error. The faucet is not reliable and sometimes fails to fund the requestor, thus the retry.
run: sleep 10 && docker exec -t docker-requestor-1 /bin/sh -c "/golem-js/tests/docker/fundRequestor.sh"
- name: Install and build the SDK in the docker container
run: |
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run build"
- name: Run the Examples tests
run: |
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm install --prefix examples && npm install ts-node && npm run test:examples -- --exitOnError"
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af