Skip to content

Commit

Permalink
test(examples): new runner and CI nightly configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mgordel committed Sep 26, 2023
1 parent 7be0f32 commit 5205fa7
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 39 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/cypress-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/examples-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/goth-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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) }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
<h1>WebRequestor - Meme Example</h1>
<div class="container">
<div class="col-6">
<h3>Options</h3>
<div class="column">
<div>
<label for="YAGNA_API_BASEPATH">YAGNA_API_BASEURL: </label>
<input id="YAGNA_API_BASEPATH" type="text" value="http://127.0.0.1:7465" />
</div>
<div>
<label for="SUBNET_TAG">Subnet Tag: </label>
<input id="SUBNET_TAG" type="text" value="public" />
</div>
</div>
<h3>Input data</h3>
<div class="column">
<div>
Expand Down Expand Up @@ -98,8 +109,9 @@ <h3>Logs</h3>
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,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -53,6 +54,17 @@
<h1>JSON upload and download</h1>
<div class="container">
<div class="col-6">
<h3>Options</h3>
<div class="column">
<div>
<label for="YAGNA_API_BASEPATH">YAGNA_API_BASEURL: </label>
<input id="YAGNA_API_BASEPATH" type="text" value="http://127.0.0.1:7465" />
</div>
<div>
<label for="SUBNET_TAG">Subnet Tag: </label>
<input id="SUBNET_TAG" type="text" value="public" />
</div>
</div>
<h3>Actions</h3>
<div class="row vertical">
<div>
Expand Down
11 changes: 11 additions & 0 deletions examples/docs-examples/quickstarts/web-quickstart/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
<h1>WebRequestor - QuickStart</h1>
<div class="container">
<div class="col-6">
<h3>Options</h3>
<div class="column">
<div>
<label for="YAGNA_API_BASEPATH">YAGNA_API_BASEURL: </label>
<input id="YAGNA_API_BASEPATH" type="text" value="http://127.0.0.1:7465" />
</div>
<div>
<label for="SUBNET_TAG">Subnet Tag: </label>
<input id="SUBNET_TAG" type="text" value="public" />
</div>
</div>
<h3>Actions</h3>
<div class="row vertical">
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
14 changes: 13 additions & 1 deletion examples/docs-examples/tutorials/running-from-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
<h1>WebRequestor - Hello World</h1>
<div class="container">
<div class="col-6">
<h3>Options</h3>
<div class="column">
<div>
<label for="YAGNA_API_BASEPATH">YAGNA_API_BASEURL: </label>
<input id="YAGNA_API_BASEPATH" type="text" value="http://127.0.0.1:7465" />
</div>
<div>
<label for="SUBNET_TAG">Subnet Tag: </label>
<input id="SUBNET_TAG" type="text" value="public" />
</div>
</div>
<h3>Actions</h3>
<div class="row vertical">
<div>
Expand Down Expand Up @@ -53,8 +64,9 @@ <h3>Logs</h3>
};
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
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/ui/docs-example-transfer-data.cy.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/ui/docs-example-transfer-json.cy.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/ui/docs-quickstart.cy.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/ui/docs-tutorial.cy.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
1 change: 0 additions & 1 deletion tests/cypress/ui/hello-world.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 0 additions & 1 deletion tests/cypress/ui/image.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5205fa7

Please sign in to comment.