Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to specify provider / requestor yagna versions to run in actions pipeline #677

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 44 additions & 17 deletions .github/workflows/cypress-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
50 changes: 34 additions & 16 deletions .github/workflows/examples-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
55 changes: 43 additions & 12 deletions .github/workflows/goth-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -33,28 +47,45 @@ 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"

- 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
46 changes: 40 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down
28 changes: 14 additions & 14 deletions tests/docker/Provider.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
Loading
Loading