From da9d6d75781edb1930a4ab4ef92012e22f223a7f Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Tue, 28 Nov 2023 18:00:48 +0100 Subject: [PATCH] build: revert "test: create configurable pipeline" This reverts commit 8ebbcfc50a49815d4dd8af52f02192daaebafd4d. --- .github/workflows/cypress-nightly.yml | 61 +++++++------------------- .github/workflows/examples-nightly.yml | 50 +++++++-------------- .github/workflows/goth-nightly.yml | 57 ++++++------------------ .github/workflows/release.yml | 46 +++---------------- tests/docker/Provider.Dockerfile | 28 ++++++------ tests/docker/Requestor.Dockerfile | 10 ++--- 6 files changed, 71 insertions(+), 181 deletions(-) diff --git a/.github/workflows/cypress-nightly.yml b/.github/workflows/cypress-nightly.yml index a3af5252c..b71d1dd07 100644 --- a/.github/workflows/cypress-nightly.yml +++ b/.github/workflows/cypress-nightly.yml @@ -2,25 +2,11 @@ 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: - inputs: - provider_version: - description: "Provider version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - requestor_version: - description: "Requestor version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - provider_wasi_version: - description: "Provider WASI version (e.g., v0.2.2)" - required: false - default: "v0.2.2" - provider_vm_version: - description: "Provider VM version (e.g., v0.3.0)" - required: false - default: "v0.3.0" jobs: cypress-tests: @@ -35,43 +21,31 @@ jobs: 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: Set up Versions - run: | - echo "PROVIDER_VERSION=${PROVIDER_VERSION}" >> $GITHUB_ENV - echo "REQUESTOR_VERSION=${REQUESTOR_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_WASI_VERSION=${PROVIDER_WASI_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_VM_VERSION=${PROVIDER_VM_VERSION}" >> $GITHUB_ENV - - name: Build the docker containers - run: | - docker compose -f tests/docker/docker-compose.yml build \ - --build-arg UBUNTU_VERSION=22.04 \ - --build-arg YA_CORE_PROVIDER_VERSION=${PROVIDER_VERSION} \ - --build-arg YA_CORE_REQUESTOR_VERSION=${REQUESTOR_VERSION} \ - --build-arg YA_WASI_VERSION=${PROVIDER_WASI_VERSION} \ - --build-arg YA_VM_VERSION=${PROVIDER_VM_VERSION} + run: docker compose -f tests/docker/docker-compose.yml build - name: Start the docker containers - run: | - sudo service docker restart - docker compose -f tests/docker/docker-compose.yml down - docker compose -f tests/docker/docker-compose.yml up -d + # 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 - run: | - sleep 4 - docker exec -t docker-requestor-1 /bin/sh -c "/golem-js/tests/docker/fundRequestor.sh" + # 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 - run: docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run build && ./node_modules/.bin/cypress install" + - 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" + 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" + 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 @@ -83,6 +57,5 @@ jobs: - name: Cleanup Docker if: always() run: | - c=$(docker ps -q) - [[ $c ]] && docker kill $c + c=$(docker ps -q) && [[ $c ]] && docker kill $c docker system prune -af diff --git a/.github/workflows/examples-nightly.yml b/.github/workflows/examples-nightly.yml index 3f40dc800..798238895 100644 --- a/.github/workflows/examples-nightly.yml +++ b/.github/workflows/examples-nightly.yml @@ -2,25 +2,11 @@ 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: - inputs: - provider_version: - description: "Provider version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - requestor_version: - description: "Requestor version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - provider_wasi_version: - description: "Provider WASI version (e.g., v0.2.2)" - required: false - default: "v0.2.2" - provider_vm_version: - description: "Provider VM version (e.g., v0.3.0)" - required: false - default: "v0.3.0" jobs: prepare-matrix-master-only: @@ -33,6 +19,7 @@ jobs: - 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 @@ -44,41 +31,36 @@ jobs: 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: Set up Versions - run: | - echo "PROVIDER_VERSION=${PROVIDER_VERSION}" >> $GITHUB_ENV - echo "REQUESTOR_VERSION=${REQUESTOR_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_WASI_VERSION=${PROVIDER_WASI_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_VM_VERSION=${PROVIDER_VM_VERSION}" >> $GITHUB_ENV - - name: Build the docker containers - run: | - docker compose -f tests/docker/docker-compose.yml build \ - --build-arg UBUNTU_VERSION=22.04 \ - --build-arg YA_CORE_PROVIDER_VERSION=${PROVIDER_VERSION} \ - --build-arg YA_CORE_REQUESTOR_VERSION=${REQUESTOR_VERSION} \ - --build-arg YA_WASI_VERSION=${PROVIDER_WASI_VERSION} \ - --build-arg YA_VM_VERSION=${PROVIDER_VM_VERSION} + 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" + 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" + 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: docker ps -q | xargs -r docker kill && docker system prune -af + run: | + c=$(docker ps -q) && [[ $c ]] && docker kill $c + docker system prune -af diff --git a/.github/workflows/goth-nightly.yml b/.github/workflows/goth-nightly.yml index 509e067e7..9a670e099 100644 --- a/.github/workflows/goth-nightly.yml +++ b/.github/workflows/goth-nightly.yml @@ -2,25 +2,11 @@ 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: - inputs: - provider_version: - description: "Provider version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - requestor_version: - description: "Requestor version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - provider_wasi_version: - description: "Provider WASI version (e.g., v0.2.2)" - required: false - default: "v0.2.2" - provider_vm_version: - description: "Provider VM version (e.g., v0.3.0)" - required: false - default: "v0.3.0" jobs: prepare-matrix-master-only: @@ -52,45 +38,28 @@ jobs: - 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: Set up Versions - run: | - echo "PROVIDER_VERSION=${PROVIDER_VERSION}" >> $GITHUB_ENV - echo "REQUESTOR_VERSION=${REQUESTOR_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_WASI_VERSION=${PROVIDER_WASI_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_VM_VERSION=${PROVIDER_VM_VERSION}" >> $GITHUB_ENV - - name: Build the docker containers - run: | - docker compose -f tests/docker/docker-compose.yml build \ - --build-arg UBUNTU_VERSION=22.04 \ - --build-arg YA_CORE_PROVIDER_VERSION=${PROVIDER_VERSION} \ - --build-arg YA_CORE_REQUESTOR_VERSION=${REQUESTOR_VERSION} \ - --build-arg YA_WASI_VERSION=${PROVIDER_WASI_VERSION} \ - --build-arg YA_VM_VERSION=${PROVIDER_VM_VERSION} + run: docker compose -f tests/docker/docker-compose.yml build - name: Start the docker containers - run: | - sudo service docker restart - docker compose -f tests/docker/docker-compose.yml down - docker compose -f tests/docker/docker-compose.yml up -d + # 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 - run: | - sleep 10 - docker exec -t docker-requestor-1 /bin/sh -c "/golem-js/tests/docker/fundRequestor.sh" + # 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 - run: docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run build" + - 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" + 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 + c=$(docker ps -q) && [[ $c ]] && docker kill $c docker system prune -af diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e307459f..b0da70225 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,23 +13,6 @@ on: # Allows triggering the workflow manually workflow_dispatch: - inputs: - provider_version: - description: "Provider version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - requestor_version: - description: "Requestor version (e.g., v0.12.3 or pre-rel-v0.13.1)" - required: false - default: "v0.12.3" - provider_wasi_version: - description: "Provider WASI version (e.g., v0.2.2)" - required: false - default: "v0.2.2" - provider_vm_version: - description: "Provider VM version (e.g., v0.3.0)" - required: false - default: "v0.3.0" # We're going to interact with GH from the pipelines, so we need to get some permissions permissions: @@ -80,32 +63,16 @@ jobs: # 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: Set up Versions - run: | - echo "PROVIDER_VERSION=${PROVIDER_VERSION}" >> $GITHUB_ENV - echo "REQUESTOR_VERSION=${REQUESTOR_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_WASI_VERSION=${PROVIDER_WASI_VERSION}" >> $GITHUB_ENV - echo "PROVIDER_VM_VERSION=${PROVIDER_VM_VERSION}" >> $GITHUB_ENV - - name: Build the docker containers - run: | - docker compose -f tests/docker/docker-compose.yml build \ - --build-arg UBUNTU_VERSION=22.04 \ - --build-arg YA_CORE_PROVIDER_VERSION=${PROVIDER_VERSION} \ - --build-arg YA_CORE_REQUESTOR_VERSION=${REQUESTOR_VERSION} \ - --build-arg YA_WASI_VERSION=${PROVIDER_WASI_VERSION} \ - --build-arg YA_VM_VERSION=${PROVIDER_VM_VERSION} + run: docker compose -f tests/docker/docker-compose.yml build - name: Start the docker containers - run: | - sudo service docker restart - docker compose -f tests/docker/docker-compose.yml down - docker compose -f tests/docker/docker-compose.yml up -d + # 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 - run: | - sleep 10 - docker exec -t docker-requestor-1 /bin/sh -c "/golem-js/tests/docker/fundRequestor.sh" + # 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: | @@ -137,8 +104,7 @@ jobs: - name: Cleanup Docker if: always() run: | - c=$(docker ps -q) - [[ $c ]] && docker kill $c + c=$(docker ps -q) && [[ $c ]] && docker kill $c docker system prune -af release: diff --git a/tests/docker/Provider.Dockerfile b/tests/docker/Provider.Dockerfile index 792eca241..81ee1c94d 100644 --- a/tests/docker/Provider.Dockerfile +++ b/tests/docker/Provider.Dockerfile @@ -1,10 +1,10 @@ ARG UBUNTU_VERSION=22.04 -ARG YA_CORE_PROVIDER_VERSION=v0.12.3 -ARG YA_WASI_VERSION=v0.2.2 -ARG YA_VM_VERSION=v0.3.0 +ARG YA_CORE_VERSION=0.12.3 +ARG YA_WASI_VERSION=0.2.2 +ARG YA_VM_VERSION=0.3.0 FROM ubuntu:${UBUNTU_VERSION} -ARG YA_CORE_PROVIDER_VERSION +ARG YA_CORE_VERSION ARG YA_WASI_VERSION ARG YA_VM_VERSION ARG YA_DIR_INSTALLER=/ya-installer @@ -25,16 +25,16 @@ RUN apt-get update -q \ && mkdir -p ${YA_DIR_PLUGINS} \ && mkdir ${YA_DIR_INSTALLER} \ && cd ${YA_DIR_INSTALLER} \ - && wget -q "https://github.com/golemfactory/yagna/releases/download/${YA_CORE_PROVIDER_VERSION}/golem-provider-linux-${YA_CORE_PROVIDER_VERSION}.tar.gz" \ - && wget -q "https://github.com/golemfactory/ya-runtime-wasi/releases/download/${YA_WASI_VERSION}/ya-runtime-wasi-linux-${YA_WASI_VERSION}.tar.gz" \ - && wget -q "https://github.com/golemfactory/ya-runtime-vm/releases/download/${YA_VM_VERSION}/ya-runtime-vm-linux-${YA_VM_VERSION}.tar.gz" \ - && tar -zxvf golem-provider-linux-${YA_CORE_PROVIDER_VERSION}.tar.gz \ - && tar -zxvf ya-runtime-wasi-linux-${YA_WASI_VERSION}.tar.gz \ - && tar -zxvf ya-runtime-vm-linux-${YA_VM_VERSION}.tar.gz \ - && find golem-provider-linux-${YA_CORE_PROVIDER_VERSION} -executable -type f -exec cp {} ${YA_DIR_BIN} \; \ - && cp -R golem-provider-linux-${YA_CORE_PROVIDER_VERSION}/plugins/* ${YA_DIR_PLUGINS} \ - && cp -R ya-runtime-wasi-linux-${YA_WASI_VERSION}/* ${YA_DIR_PLUGINS} \ - && cp -R ya-runtime-vm-linux-${YA_VM_VERSION}/* ${YA_DIR_PLUGINS} \ + && wget -q "https://github.com/golemfactory/yagna/releases/download/v${YA_CORE_VERSION}/golem-provider-linux-v${YA_CORE_VERSION}.tar.gz" \ + && wget -q "https://github.com/golemfactory/ya-runtime-wasi/releases/download/v${YA_WASI_VERSION}/ya-runtime-wasi-linux-v${YA_WASI_VERSION}.tar.gz" \ + && wget -q "https://github.com/golemfactory/ya-runtime-vm/releases/download/v${YA_VM_VERSION}/ya-runtime-vm-linux-v${YA_VM_VERSION}.tar.gz" \ + && tar -zxvf golem-provider-linux-v${YA_CORE_VERSION}.tar.gz \ + && tar -zxvf ya-runtime-wasi-linux-v${YA_WASI_VERSION}.tar.gz \ + && tar -zxvf ya-runtime-vm-linux-v${YA_VM_VERSION}.tar.gz \ + && find golem-provider-linux-v${YA_CORE_VERSION} -executable -type f -exec cp {} ${YA_DIR_BIN} \; \ + && cp -R golem-provider-linux-v${YA_CORE_VERSION}/plugins/* ${YA_DIR_PLUGINS} \ + && cp -R ya-runtime-wasi-linux-v${YA_WASI_VERSION}/* ${YA_DIR_PLUGINS} \ + && cp -R ya-runtime-vm-linux-v${YA_VM_VERSION}/* ${YA_DIR_PLUGINS} \ && rm -Rf ${YA_DIR_INSTALLER} COPY ./configureProvider.py /configureProvider.py diff --git a/tests/docker/Requestor.Dockerfile b/tests/docker/Requestor.Dockerfile index c542cd6a4..b64167fdd 100644 --- a/tests/docker/Requestor.Dockerfile +++ b/tests/docker/Requestor.Dockerfile @@ -1,8 +1,8 @@ ARG UBUNTU_VERSION=22.04 -ARG YA_CORE_REQUESTOR_VERSION=v0.12.3 +ARG YA_CORE_VERSION=0.13.0-rc10 FROM node:18 -ARG YA_CORE_REQUESTOR_VERSION +ARG YA_CORE_VERSION ARG YA_DIR_INSTALLER=/ya-installer ARG YA_DIR_BIN=/usr/bin RUN apt-get update -q \ @@ -31,9 +31,9 @@ RUN apt-get update -q \ && rm -rf /var/lib/apt/lists/* \ && mkdir ${YA_DIR_INSTALLER} \ && cd ${YA_DIR_INSTALLER} \ - && wget -q "https://github.com/golemfactory/yagna/releases/download/${YA_CORE_REQUESTOR_VERSION}/golem-requestor-linux-${YA_CORE_REQUESTOR_VERSION}.tar.gz" \ - && tar -zxvf golem-requestor-linux-${YA_CORE_REQUESTOR_VERSION}.tar.gz \ - && find golem-requestor-linux-${YA_CORE_REQUESTOR_VERSION} -executable -type f -exec cp {} ${YA_DIR_BIN} \; \ + && wget -q "https://github.com/golemfactory/yagna/releases/download/pre-rel-v${YA_CORE_VERSION}/golem-requestor-linux-pre-rel-v${YA_CORE_VERSION}.tar.gz" \ + && tar -zxvf golem-requestor-linux-pre-rel-v${YA_CORE_VERSION}.tar.gz \ + && find golem-requestor-linux-pre-rel-v${YA_CORE_VERSION} -executable -type f -exec cp {} ${YA_DIR_BIN} \; \ && rm -Rf ${YA_DIR_INSTALLER} \ && wget -O ${YA_DIR_BIN}/websocat "https://github.com/vi/websocat/releases/download/v1.12.0/websocat_max.x86_64-unknown-linux-musl" \ && chmod +x ${YA_DIR_BIN}/websocat