From 5205fa7981925db43e4afd93aca61d968a54b504 Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Tue, 26 Sep 2023 13:36:52 +0200 Subject: [PATCH] test(examples): new runner and CI nightly configs --- .github/workflows/cypress-nightly.yml | 28 ++++++++----------- .github/workflows/examples-nightly.yml | 2 +- .github/workflows/goth-nightly.yml | 28 ++++++++----------- .../transferDatainBrowser.html | 14 +++++++++- .../uploadHSONinBrowser.html | 14 +++++++++- .../quickstarts/web-quickstart/index.html | 11 ++++++++ .../quickstarts/web-quickstart/requestor.mjs | 3 +- .../tutorials/running-from-browser/index.html | 14 +++++++++- .../ui/docs-example-transfer-data.cy.ts | 2 ++ .../ui/docs-example-transfer-json.cy.ts | 2 ++ tests/cypress/ui/docs-quickstart.cy.ts | 2 ++ tests/cypress/ui/docs-tutorial.cy.ts | 2 ++ tests/cypress/ui/hello-world.cy.ts | 1 - tests/cypress/ui/image.cy.ts | 1 - 14 files changed, 85 insertions(+), 39 deletions(-) diff --git a/.github/workflows/cypress-nightly.yml b/.github/workflows/cypress-nightly.yml index abee0a225..cc651eef5 100644 --- a/.github/workflows/cypress-nightly.yml +++ b/.github/workflows/cypress-nightly.yml @@ -3,14 +3,14 @@ name: Nightly Cypress Tests on: schedule: # run this workflow every day at 3:00 AM UTC - - cron: "0 3 * * *" + - cron: "20 1 * * *" # Allows triggering the workflow manually workflow_dispatch: jobs: cypress-tests: - runs-on: goth + runs-on: goth2 steps: - name: Checkout uses: actions/checkout@v3 @@ -47,21 +47,11 @@ jobs: sed -Ezi 's/(use\-prerelease:\s)(false)/\1true\n release-tag: "0.13.0-rc10"/mg' ../goth/assets/goth-config.yml sed -i '/^ENTRYPOINT/i ENV YAGNA_AUTOCONF_APPKEY=try_golem' ../goth/assets/docker/yagna-goth-deb.Dockerfile - - name: Disconnect Docker containers from default network - continue-on-error: true - # related to this issue: https://github.com/moby/moby/issues/23302 + - name: Cleanup Docker + if: always() run: | - docker network inspect docker_default - sudo apt-get install -y jq - docker network inspect docker_default | jq ".[0].Containers | map(.Name)[]" | tee /dev/stderr | xargs --max-args 1 -- docker network disconnect -f docker_default - - - name: Remove Docker containers - continue-on-error: true - run: docker rm -f $(docker ps -a -q) - - - name: Restart Docker daemon - # related to this issue: https://github.com/moby/moby/issues/23302 - run: sudo systemctl restart docker + c=$(docker ps -q) && [[ $c ]] && docker kill $c + docker system prune -af - name: Log in to GitHub Docker repository run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin @@ -88,3 +78,9 @@ jobs: - name: Remove test logs if: always() run: rm -rf .cypress + + - name: Cleanup Docker + if: always() + run: | + 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 c058ca8b1..7bff7a3fd 100644 --- a/.github/workflows/examples-nightly.yml +++ b/.github/workflows/examples-nightly.yml @@ -3,7 +3,7 @@ name: Nightly Examples Tests on: schedule: # run this workflow every day at 2:00 AM UTC - - cron: "0 1 * * *" + - cron: "30 1 * * *" # Allows triggering the workflow manually workflow_dispatch: diff --git a/.github/workflows/goth-nightly.yml b/.github/workflows/goth-nightly.yml index 2e4c6dd9a..32c9c735f 100644 --- a/.github/workflows/goth-nightly.yml +++ b/.github/workflows/goth-nightly.yml @@ -3,7 +3,7 @@ name: Nightly E2E Tests on: schedule: # run this workflow every day at 2:00 AM UTC - - cron: "0 2 * * *" + - cron: "0 1 * * *" # Allows triggering the workflow manually workflow_dispatch: @@ -21,7 +21,7 @@ jobs: run: echo "::set-output name=matrix::{\"include\":[{\"branch\":\"master\"}]}" goth-tests: - runs-on: goth + runs-on: goth2 needs: prepare-matrix-master-only strategy: matrix: ${{ fromJson(needs.prepare-matrix-master-only.outputs.matrix-json) }} @@ -62,21 +62,11 @@ jobs: sudo chmod +x /usr/local/bin/websocat sudo apt-get install sshpass - - name: Disconnect Docker containers from default network - continue-on-error: true - # related to this issue: https://github.com/moby/moby/issues/23302 + - name: Cleanup Docker + if: always() run: | - docker network inspect docker_default - sudo apt-get install -y jq - docker network inspect docker_default | jq ".[0].Containers | map(.Name)[]" | tee /dev/stderr | xargs --max-args 1 -- docker network disconnect -f docker_default - - - name: Remove Docker containers - continue-on-error: true - run: docker rm -f $(docker ps -a -q) - - - name: Restart Docker daemon - # related to this issue: https://github.com/moby/moby/issues/23302 - run: sudo systemctl restart docker + c=$(docker ps -q) && [[ $c ]] && docker kill $c + docker system prune -af - name: Log in to GitHub Docker repository run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin @@ -98,3 +88,9 @@ jobs: - name: Remove test logs if: always() run: rm -rf /tmp/goth-tests + + - name: Cleanup Docker + if: always() + run: | + c=$(docker ps -q) && [[ $c ]] && docker kill $c + docker system prune -af diff --git a/examples/docs-examples/examples/transferring-data/transferDatainBrowser.html b/examples/docs-examples/examples/transferring-data/transferDatainBrowser.html index 8962ef6c9..e3b69eb10 100644 --- a/examples/docs-examples/examples/transferring-data/transferDatainBrowser.html +++ b/examples/docs-examples/examples/transferring-data/transferDatainBrowser.html @@ -8,6 +8,17 @@

WebRequestor - Meme Example

+

Options

+
+
+ + +
+
+ + +
+

Input data

@@ -98,8 +109,9 @@

Logs

const text = textInput.value.replace(/'/g, `'\\''`); const executor = await TaskExecutor.create({ - yagnaOptions: { apiKey: "try_golem" }, package: "7faa6a327c0a568fb3ad18ed1adf91a7493a445fc0dc640ab3d2eab0", + yagnaOptions: { apiKey: "try_golem", basePath: document.getElementById("YAGNA_API_BASEPATH").value }, + subnetTag: document.getElementById("SUBNET_TAG").value, logger, }); diff --git a/examples/docs-examples/examples/transferring-data/uploadHSONinBrowser.html b/examples/docs-examples/examples/transferring-data/uploadHSONinBrowser.html index 3def7232f..fabc35865 100644 --- a/examples/docs-examples/examples/transferring-data/uploadHSONinBrowser.html +++ b/examples/docs-examples/examples/transferring-data/uploadHSONinBrowser.html @@ -29,7 +29,8 @@ async function run() { const executor = await TaskExecutor.create({ package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3", - yagnaOptions: { apiKey: "try_golem" }, + yagnaOptions: { apiKey: "try_golem", basePath: document.getElementById("YAGNA_API_BASEPATH").value }, + subnetTag: document.getElementById("SUBNET_TAG").value, logger, }).catch((e) => logger.error(e)); @@ -53,6 +54,17 @@

JSON upload and download

+

Options

+
+
+ + +
+
+ + +
+

Actions

diff --git a/examples/docs-examples/quickstarts/web-quickstart/index.html b/examples/docs-examples/quickstarts/web-quickstart/index.html index 2b899c237..2554b7053 100644 --- a/examples/docs-examples/quickstarts/web-quickstart/index.html +++ b/examples/docs-examples/quickstarts/web-quickstart/index.html @@ -8,6 +8,17 @@

WebRequestor - QuickStart

+

Options

+
+
+ + +
+
+ + +
+

Actions

diff --git a/examples/docs-examples/quickstarts/web-quickstart/requestor.mjs b/examples/docs-examples/quickstarts/web-quickstart/requestor.mjs index c9716d7c1..6ddeb382e 100644 --- a/examples/docs-examples/quickstarts/web-quickstart/requestor.mjs +++ b/examples/docs-examples/quickstarts/web-quickstart/requestor.mjs @@ -26,7 +26,8 @@ const logger = { async function run() { const executor = await golem.TaskExecutor.create({ package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3", - yagnaOptions: { apiKey: "try_golem" }, + yagnaOptions: { apiKey: "try_golem", basePath: document.getElementById("YAGNA_API_BASEPATH").value }, + subnetTag: document.getElementById("SUBNET_TAG").value, logger, }).catch((e) => logger.error(e)); diff --git a/examples/docs-examples/tutorials/running-from-browser/index.html b/examples/docs-examples/tutorials/running-from-browser/index.html index 55bfa0485..463bc03df 100644 --- a/examples/docs-examples/tutorials/running-from-browser/index.html +++ b/examples/docs-examples/tutorials/running-from-browser/index.html @@ -8,6 +8,17 @@

WebRequestor - Hello World

+

Options

+
+
+ + +
+
+ + +
+

Actions

@@ -53,8 +64,9 @@

Logs

}; async function run() { const executor = await TaskExecutor.create({ - yagnaOptions: { apiKey: "try_golem" }, package: "9a3b5d67b0b27746283cb5f287c13eab1beaa12d92a9f536b747c7ae", + yagnaOptions: { apiKey: "try_golem", basePath: document.getElementById("YAGNA_API_BASEPATH").value }, + subnetTag: document.getElementById("SUBNET_TAG").value, logger, }); await executor diff --git a/tests/cypress/ui/docs-example-transfer-data.cy.ts b/tests/cypress/ui/docs-example-transfer-data.cy.ts index 43c32fdb9..568121758 100644 --- a/tests/cypress/ui/docs-example-transfer-data.cy.ts +++ b/tests/cypress/ui/docs-example-transfer-data.cy.ts @@ -1,6 +1,8 @@ describe("Docs Examples Transfer Data", () => { it("should transfer image file to provider", () => { cy.visit("/docs-example-transfer-data"); + cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); + cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); cy.fixture("golem.png", { encoding: null }).as("imageFile"); cy.get("#MEME_IMG").selectFile("@imageFile"); cy.get("#RUN").click(); diff --git a/tests/cypress/ui/docs-example-transfer-json.cy.ts b/tests/cypress/ui/docs-example-transfer-json.cy.ts index 69b2ed9bc..71e40dcbe 100644 --- a/tests/cypress/ui/docs-example-transfer-json.cy.ts +++ b/tests/cypress/ui/docs-example-transfer-json.cy.ts @@ -1,6 +1,8 @@ describe("Docs Examples Transfer JSON", () => { it("should transfer json to provider", () => { cy.visit("/docs-example-transfer-json"); + cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); + cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); cy.get("#echo").click(); cy.get("#results").should("include.text", "TODO", { timeout: 60000 }); cy.get("#logs").contains("computed by provider"); diff --git a/tests/cypress/ui/docs-quickstart.cy.ts b/tests/cypress/ui/docs-quickstart.cy.ts index 439f5e5a5..7babb2320 100644 --- a/tests/cypress/ui/docs-quickstart.cy.ts +++ b/tests/cypress/ui/docs-quickstart.cy.ts @@ -1,6 +1,8 @@ describe("Docs Examples Quickstart", () => { it("should print hello world", () => { cy.visit("/docs-example-quickstart"); + cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); + cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); cy.get("#echo").click(); cy.get("#results").should("include.text", "Hello World", { timeout: 60000 }); cy.get("#logs").contains("Task Executor has shut down"); diff --git a/tests/cypress/ui/docs-tutorial.cy.ts b/tests/cypress/ui/docs-tutorial.cy.ts index bd2719420..6321a8b34 100644 --- a/tests/cypress/ui/docs-tutorial.cy.ts +++ b/tests/cypress/ui/docs-tutorial.cy.ts @@ -1,6 +1,8 @@ describe("Docs Examples Tutorial", () => { it("should print hello world", () => { cy.visit("/docs-example-tutorial"); + cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); + cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); cy.get("#echo").click(); cy.get("#results").should("include.text", "Hello World", { timeout: 60000 }); cy.get("#logs").contains("Task Executor has shut down"); diff --git a/tests/cypress/ui/hello-world.cy.ts b/tests/cypress/ui/hello-world.cy.ts index ee45a9d04..34199739e 100644 --- a/tests/cypress/ui/hello-world.cy.ts +++ b/tests/cypress/ui/hello-world.cy.ts @@ -4,7 +4,6 @@ describe("Test TaskExecutor API", () => { cy.get("#YAGNA_APPKEY").clear().type(Cypress.env("YAGNA_APPKEY")); cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); - cy.get("#PAYMENT_NETWORK").clear().type("rinkeby"); cy.get("#echo").click(); cy.get("#results").should("include.text", "Hello World", { timeout: 60000 }); cy.get("#logs").contains("Task Executor has shut down"); diff --git a/tests/cypress/ui/image.cy.ts b/tests/cypress/ui/image.cy.ts index aca136f72..46379c002 100644 --- a/tests/cypress/ui/image.cy.ts +++ b/tests/cypress/ui/image.cy.ts @@ -4,7 +4,6 @@ describe("Test TaskExecutor API", () => { cy.get("#YAGNA_APPKEY").clear().type(Cypress.env("YAGNA_APPKEY")); cy.get("#YAGNA_API_BASEPATH").clear().type(Cypress.env("YAGNA_API_BASEPATH")); cy.get("#SUBNET_TAG").clear().type(Cypress.env("YAGNA_SUBNET")); - cy.get("#PAYMENT_NETWORK").clear().type("rinkeby"); cy.fixture("golem.png", { encoding: null }).as("imageFile"); cy.get("#MEME_IMG").selectFile("@imageFile"); cy.get("#RUN").click();