Nightly E2E Tests #977
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly E2E Tests | |
on: | |
schedule: | |
# run this workflow every day at 1:00 AM UTC | |
- cron: "0 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 integration 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: Start the e2e test | |
run: docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run test:e2e -- --reporters github-actions --reporters summary" | |
- name: Cleanup Docker | |
if: always() | |
run: | | |
c=$(docker ps -q) && [[ $c ]] && docker kill $c | |
docker system prune -af |