diff --git a/.github/workflows/cypress-nightly.yml b/.github/workflows/cypress-nightly.yml index 65f60f231..b6af0d2ce 100644 --- a/.github/workflows/cypress-nightly.yml +++ b/.github/workflows/cypress-nightly.yml @@ -2,11 +2,25 @@ 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: @@ -16,31 +30,43 @@ 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=${{ github.event.inputs.provider_version }}" >> $GITHUB_ENV + echo "REQUESTOR_VERSION=${{ github.event.inputs.requestor_version }}" >> $GITHUB_ENV + echo "PROVIDER_WASI_VERSION=${{ github.event.inputs.provider_wasi_version }}" >> $GITHUB_ENV + echo "PROVIDER_VM_VERSION=${{ github.event.inputs.provider_vm_version }}" >> $GITHUB_ENV + - name: Build the docker containers - run: docker compose -f tests/docker/docker-compose.yml build + 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} - 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 + 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" + 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: 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 @@ -52,5 +78,6 @@ 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 9ddb33568..b61783141 100644 --- a/.github/workflows/examples-nightly.yml +++ b/.github/workflows/examples-nightly.yml @@ -2,11 +2,25 @@ 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: @@ -19,43 +33,47 @@ 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 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=${{ github.event.inputs.provider_version }}" >> $GITHUB_ENV + echo "REQUESTOR_VERSION=${{ github.event.inputs.requestor_version }}" >> $GITHUB_ENV + echo "PROVIDER_WASI_VERSION=${{ github.event.inputs.provider_wasi_version }}" >> $GITHUB_ENV + echo "PROVIDER_VM_VERSION=${{ github.event.inputs.provider_vm_version }}" >> $GITHUB_ENV + - name: Build the docker containers - run: docker compose -f tests/docker/docker-compose.yml build + 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} - 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: | - c=$(docker ps -q) && [[ $c ]] && docker kill $c - docker system prune -af + run: docker ps -q | xargs -r docker kill && docker system prune -af diff --git a/.github/workflows/goth-nightly.yml b/.github/workflows/goth-nightly.yml index 34d0e750d..c1b728a0b 100644 --- a/.github/workflows/goth-nightly.yml +++ b/.github/workflows/goth-nightly.yml @@ -2,11 +2,25 @@ 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: @@ -33,22 +47,38 @@ 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=${{ github.event.inputs.provider_version }}" >> $GITHUB_ENV + echo "REQUESTOR_VERSION=${{ github.event.inputs.requestor_version }}" >> $GITHUB_ENV + echo "PROVIDER_WASI_VERSION=${{ github.event.inputs.provider_wasi_version }}" >> $GITHUB_ENV + echo "PROVIDER_VM_VERSION=${{ github.event.inputs.provider_vm_version }}" >> $GITHUB_ENV + - name: Build the docker containers - run: docker compose -f tests/docker/docker-compose.yml build + 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} - 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 + 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" + 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: Start the e2e test run: docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run test:e2e" @@ -56,5 +86,6 @@ 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/release.yml b/.github/workflows/release.yml index 3c2d26a74..c6f69eada 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,23 @@ 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: @@ -58,16 +75,32 @@ 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=${{ github.event.inputs.provider_version }}" >> $GITHUB_ENV + echo "REQUESTOR_VERSION=${{ github.event.inputs.requestor_version }}" >> $GITHUB_ENV + echo "PROVIDER_WASI_VERSION=${{ github.event.inputs.provider_wasi_version }}" >> $GITHUB_ENV + echo "PROVIDER_VM_VERSION=${{ github.event.inputs.provider_vm_version }}" >> $GITHUB_ENV + - name: Build the docker containers - run: docker compose -f tests/docker/docker-compose.yml build + 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} - 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 + 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" + 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: | @@ -99,7 +132,8 @@ 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 81ee1c94d..792eca241 100644 --- a/tests/docker/Provider.Dockerfile +++ b/tests/docker/Provider.Dockerfile @@ -1,10 +1,10 @@ ARG UBUNTU_VERSION=22.04 -ARG YA_CORE_VERSION=0.12.3 -ARG YA_WASI_VERSION=0.2.2 -ARG YA_VM_VERSION=0.3.0 +ARG YA_CORE_PROVIDER_VERSION=v0.12.3 +ARG YA_WASI_VERSION=v0.2.2 +ARG YA_VM_VERSION=v0.3.0 FROM ubuntu:${UBUNTU_VERSION} -ARG YA_CORE_VERSION +ARG YA_CORE_PROVIDER_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/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} \ + && 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} \ && rm -Rf ${YA_DIR_INSTALLER} COPY ./configureProvider.py /configureProvider.py diff --git a/tests/docker/Requestor.Dockerfile b/tests/docker/Requestor.Dockerfile index b64167fdd..c542cd6a4 100644 --- a/tests/docker/Requestor.Dockerfile +++ b/tests/docker/Requestor.Dockerfile @@ -1,8 +1,8 @@ ARG UBUNTU_VERSION=22.04 -ARG YA_CORE_VERSION=0.13.0-rc10 +ARG YA_CORE_REQUESTOR_VERSION=v0.12.3 FROM node:18 -ARG YA_CORE_VERSION +ARG YA_CORE_REQUESTOR_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/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} \; \ + && 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} \; \ && 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