Skip to content

Nightly Cypress Tests #102

Nightly Cypress Tests

Nightly Cypress Tests #102

name: Nightly Cypress Tests
on:
schedule:
# run this workflow every day at 1:20 AM UTC
- cron: "20 1 * * *"
# Allows triggering the workflow manually
workflow_dispatch:
jobs:
cypress-tests:
runs-on: goth2
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 4 && 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 && ./node_modules/.bin/cypress install"
- name: Run web server
run: |
docker exec -t -d docker-requestor-1 /bin/sh -c "cd /golem-js/examples/web && node app.mjs"
- name: Run test suite
run: |
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm run test:cypress -- --browser chromium"
- name: Upload test logs
uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-logs
path: .cypress
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af