From 20d9f2b1e5c5deb67db5d03e27a9213ab974eef6 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:33:38 +0000 Subject: [PATCH 01/52] try with test jobs --- .github/actions/setup-and-login/action.yml | 45 +++++++++++++++ .github/workflows/test.yml | 64 ++++++++++++++++------ 2 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 .github/actions/setup-and-login/action.yml diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/setup-and-login/action.yml new file mode 100644 index 00000000..07d78f81 --- /dev/null +++ b/.github/actions/setup-and-login/action.yml @@ -0,0 +1,45 @@ +name: Setup Node, Env and login to GHCR + +inputs: + ghcr-username: + required: false + default: '' + ghcr-password: + required: false + default: '' + +outputs: + CI_SHA: + description: "Short SHA of current commit" + value: ${{ steps.ci-env.outputs.CI_SHA }} + CI_BRANCH: + description: "Current branch" + value: ${{ steps.ci-env.outputs.CI_BRANCH }} + +runs: + using: "composite" + steps: + - name: Login to GHCR (GitHub Packages) + if: inputs.ghcr-username != '' && inputs.ghcr-password != '' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ inputs.ghcr-username }} + password: ${{ inputs.ghcr-password }} + - id: ci-env + name: Setup Environment + shell: bash + run: | + if [ "${{github.event_name}}" = "pull_request" ]; + then + long_sha=${{ github.event.pull_request.head.sha }} + echo "CI_BRANCH=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + long_sha=${GITHUB_SHA} + echo "CI_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + echo "CI_SHA=${long_sha:0:7}" >> $GITHUB_OUTPUT + + - uses: actions/setup-node@v4 + with: + node-version: 20 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 419240a5..c1203cfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,35 +1,65 @@ name: test on: [push] jobs: - test: + unit-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup-and-login + + - name: Test back end + run: npm test --prefix=app/server + - name: Test front end + run: npm run coverage --prefix=app/static + - name: Check versions + run: npm run genversion --prefix=app/server -- --check-only + - uses: codecov/codecov-action@v4 with: - node-version: 20.x - - name: Install dependencies - run: npm install -g typescript + fail_ci_if_error: true # optional (default = false) + files: ./app/server/coverage/coverage-final.json,./app/static/coverage/coverage-final.json + token: ${{ secrets.CODECOV_TOKEN }} # required + + integration-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup-and-login + - name: Build run: ./scripts/build.sh - name: Run dependencies run: ./scripts/run-dependencies.sh - name: Run server run: npm run serve --prefix=app/server & - - name: Test back end - run: npm test --prefix=app/server - name: Test back end integration run: npm run integration-test --prefix=app/server - - name: Test front end - run: npm run coverage --prefix=app/static + + playwright-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup-and-login + + - name: Build + run: ./scripts/build.sh + - name: Run dependencies + run: ./scripts/run-dependencies.sh + - name: Run server + run: npm run serve --prefix=app/server & + - name: Test e2e + run: npm run test:e2e --prefix=app/static + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup-and-login + - name: Lint back end run: npm run lint --prefix=app/server - name: Lint front end run: npm run lint --prefix=app/static - - name: Check versions - run: npm run genversion --prefix=app/server -- --check-only - - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true # optional (default = false) - files: ./app/server/coverage/coverage-final.json,./app/static/coverage/coverage-final.json - token: ${{ secrets.CODECOV_TOKEN }} # required From 13ab6504c718d193446ef5896fd0b3a9bea7f2ae Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:41:32 +0000 Subject: [PATCH 02/52] adding more into the action --- .github/actions/setup-and-login/action.yml | 21 +++++++++++++++++++++ .github/workflows/test.yml | 20 ++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/setup-and-login/action.yml index 07d78f81..6ce9698b 100644 --- a/.github/actions/setup-and-login/action.yml +++ b/.github/actions/setup-and-login/action.yml @@ -1,6 +1,12 @@ name: Setup Node, Env and login to GHCR inputs: + install-packages: + required: false + default: false + build-and-run-server: + required: false + default: false ghcr-username: required: false default: '' @@ -43,3 +49,18 @@ runs: - uses: actions/setup-node@v4 with: node-version: 20 + + - name: Install packages + if: inputs.install-packages == true + shell: bash + run: | + npm i --prefix=app/server + npm i --prefix=app/static + + - name: Build and run server + if: inputs.build-and-run-server == true + shell: bash + run: | + ./scripts/build.sh + ./scripts/run-dependencies.sh + npm run serve --prefix=app/server & diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1203cfb..66ec473d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + install-packages: true - name: Test back end run: npm test --prefix=app/server @@ -26,13 +28,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + build-and-run-server: true - - name: Build - run: ./scripts/build.sh - - name: Run dependencies - run: ./scripts/run-dependencies.sh - - name: Run server - run: npm run serve --prefix=app/server & - name: Test back end integration run: npm run integration-test --prefix=app/server @@ -42,13 +40,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + build-and-run-server: true - - name: Build - run: ./scripts/build.sh - - name: Run dependencies - run: ./scripts/run-dependencies.sh - - name: Run server - run: npm run serve --prefix=app/server & - name: Test e2e run: npm run test:e2e --prefix=app/static @@ -58,6 +52,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + install-packages: true - name: Lint back end run: npm run lint --prefix=app/server From 12a9d3f862de60c35a31f89933ca440f8cb12695 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:44:38 +0000 Subject: [PATCH 03/52] composite actions can only take strings? --- .github/actions/setup-and-login/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/setup-and-login/action.yml index 6ce9698b..9cda1e4e 100644 --- a/.github/actions/setup-and-login/action.yml +++ b/.github/actions/setup-and-login/action.yml @@ -3,10 +3,10 @@ name: Setup Node, Env and login to GHCR inputs: install-packages: required: false - default: false + default: 'false' build-and-run-server: required: false - default: false + default: 'false' ghcr-username: required: false default: '' @@ -51,14 +51,14 @@ runs: node-version: 20 - name: Install packages - if: inputs.install-packages == true + if: inputs.install-packages == 'true' shell: bash run: | npm i --prefix=app/server npm i --prefix=app/static - name: Build and run server - if: inputs.build-and-run-server == true + if: inputs.build-and-run-server == 'true' shell: bash run: | ./scripts/build.sh From db301225c87427f8f06056a5b3320aa1dbb9f00b Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:45:34 +0000 Subject: [PATCH 04/52] better logic --- .github/actions/setup-and-login/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/setup-and-login/action.yml index 9cda1e4e..cce5b64f 100644 --- a/.github/actions/setup-and-login/action.yml +++ b/.github/actions/setup-and-login/action.yml @@ -51,7 +51,8 @@ runs: node-version: 20 - name: Install packages - if: inputs.install-packages == 'true' + # we install in the build script anyway so skip if build-and-run-server + if: inputs.install-packages == 'true' && inputs.build-and-run-server != 'true' shell: bash run: | npm i --prefix=app/server From 33e67c9a2510112d2af6f21f565102afeea62a9d Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:48:16 +0000 Subject: [PATCH 05/52] disable playwright web server in config --- app/static/playwright.config.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/static/playwright.config.ts b/app/static/playwright.config.ts index d7297985..ad5e216f 100644 --- a/app/static/playwright.config.ts +++ b/app/static/playwright.config.ts @@ -55,15 +55,15 @@ export default defineConfig({ /* Folder for test artifacts such as screenshots, videos, traces, etc. */ // outputDir: 'test-results/', - /* Run your local dev server before starting the tests */ - webServer: { - /** - * Use the dev server by default for faster feedback loop. - * Use the preview server on CI for more realistic testing. - * Playwright will re-use the local server if there is already a dev-server running. - */ - command: process.env.CI ? 'npm run build' : 'npm run dev', - port: 5173, - reuseExistingServer: !process.env.CI - } + // /* Run your local dev server before starting the tests */ + // webServer: { + // /** + // * Use the dev server by default for faster feedback loop. + // * Use the preview server on CI for more realistic testing. + // * Playwright will re-use the local server if there is already a dev-server running. + // */ + // command: process.env.CI ? 'npm run build' : 'npm run dev', + // port: 5173, + // reuseExistingServer: !process.env.CI + // } }) From f1256dd168c84b61cda2db095a055c4a078090cd Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:52:12 +0000 Subject: [PATCH 06/52] split up backend and frontend tests --- .github/workflows/test.yml | 25 +++++++++++++++++++++---- app/static/playwright.config.ts | 12 ------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 66ec473d..a69dc049 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: test on: [push] jobs: - unit-tests: + fe-unit-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -10,16 +10,33 @@ jobs: with: install-packages: true - - name: Test back end - run: npm test --prefix=app/server - name: Test front end run: npm run coverage --prefix=app/static + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true # optional (default = false) + files: ./app/static/coverage/coverage-final.json + token: ${{ secrets.CODECOV_TOKEN }} # required + + be-unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: ./.github/actions/setup-and-login + with: + install-packages: true + + - name: Run deps + run: ./scripts/run-dependencies.sh + - name: Test back end + run: npm test --prefix=app/server - name: Check versions run: npm run genversion --prefix=app/server -- --check-only - uses: codecov/codecov-action@v4 with: fail_ci_if_error: true # optional (default = false) - files: ./app/server/coverage/coverage-final.json,./app/static/coverage/coverage-final.json + files: ./app/server/coverage/coverage-final.json token: ${{ secrets.CODECOV_TOKEN }} # required integration-tests: diff --git a/app/static/playwright.config.ts b/app/static/playwright.config.ts index ad5e216f..c12df636 100644 --- a/app/static/playwright.config.ts +++ b/app/static/playwright.config.ts @@ -54,16 +54,4 @@ export default defineConfig({ /* Folder for test artifacts such as screenshots, videos, traces, etc. */ // outputDir: 'test-results/', - - // /* Run your local dev server before starting the tests */ - // webServer: { - // /** - // * Use the dev server by default for faster feedback loop. - // * Use the preview server on CI for more realistic testing. - // * Playwright will re-use the local server if there is already a dev-server running. - // */ - // command: process.env.CI ? 'npm run build' : 'npm run dev', - // port: 5173, - // reuseExistingServer: !process.env.CI - // } }) From 662c2d18cc012757ad973a0b346b52244c1ef3f9 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 12:58:26 +0000 Subject: [PATCH 07/52] fix workflow tests and install playwright browsers --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a69dc049..4383b2cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,8 @@ jobs: - name: Setup Node uses: ./.github/actions/setup-and-login with: - install-packages: true + build-and-run-server: true - - name: Run deps - run: ./scripts/run-dependencies.sh - name: Test back end run: npm test --prefix=app/server - name: Check versions @@ -59,7 +57,9 @@ jobs: uses: ./.github/actions/setup-and-login with: build-and-run-server: true - + + - name: Install Playwright Browsers + run: npx playwright install --with-deps - name: Test e2e run: npm run test:e2e --prefix=app/static From fa4afe17cb78cb8573f5d54c0f33f4b189274e93 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:09:53 +0000 Subject: [PATCH 08/52] try fully parallel tests --- app/static/playwright.config.ts | 3 ++- app/static/tests/e2e/index.etest.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/static/playwright.config.ts b/app/static/playwright.config.ts index c12df636..c0f367f3 100644 --- a/app/static/playwright.config.ts +++ b/app/static/playwright.config.ts @@ -27,7 +27,8 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 1, /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : undefined, + // workers: process.env.CI ? 1 : undefined, + fullyParallel: true, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ // reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ diff --git a/app/static/tests/e2e/index.etest.ts b/app/static/tests/e2e/index.etest.ts index 034f495a..6da8f724 100644 --- a/app/static/tests/e2e/index.etest.ts +++ b/app/static/tests/e2e/index.etest.ts @@ -3,17 +3,18 @@ import * as fs from "fs"; import { realisticFitData } from "./utils"; test.describe("Index tests", () => { - const tmpPath = "tmp"; + let tmpPath: string; - test.beforeAll(() => { + test.beforeEach(() => { + tmpPath = `${Math.random()}`; if (fs.existsSync(tmpPath)) { - fs.rmdirSync(tmpPath, { recursive: true }); + fs.rmSync(tmpPath, { recursive: true }); } fs.mkdirSync(tmpPath); }); - test.afterAll(() => { - fs.rmdirSync(tmpPath, { recursive: true }); + test.afterEach(() => { + fs.rmSync(tmpPath, { recursive: true }); }); test("renders heading", async ({ page }) => { From f8ebc091c1ccbb9880dfdfb1b378930234c3bd28 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:17:36 +0000 Subject: [PATCH 09/52] cache playwright binaries and shard tests --- .github/workflows/test.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4383b2cf..09ea7940 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,6 +51,9 @@ jobs: playwright-tests: runs-on: ubuntu-latest + strategy: + matrix: + shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 - name: Setup Node @@ -58,10 +61,21 @@ jobs: with: build-and-run-server: true + - name: Get installed Playwright version + run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV + - name: Cache playwright binaries + uses: actions/cache@v4 + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} - name: Install Playwright Browsers + if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - name: Test e2e - run: npm run test:e2e --prefix=app/static + run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 lint: runs-on: ubuntu-latest From 8aad0a7ddfd939281f7850aa62d5e68a2bb0fbbe Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:21:20 +0000 Subject: [PATCH 10/52] testing playwright cache From 5e7e0ad6241eb1befc6668c8c28985ce848c29ba Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:29:00 +0000 Subject: [PATCH 11/52] try to make stochastic less flaky --- app/static/tests/e2e/stochastic.etest.ts | 32 ++++++++---------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/app/static/tests/e2e/stochastic.etest.ts b/app/static/tests/e2e/stochastic.etest.ts index 3e6013f6..85b9edc2 100644 --- a/app/static/tests/e2e/stochastic.etest.ts +++ b/app/static/tests/e2e/stochastic.etest.ts @@ -1,10 +1,7 @@ import { expect, test } from "@playwright/test"; -import PlaywrightConfig from "../../playwright.config"; import { expectSummaryValues } from "./utils"; test.describe("stochastic app", () => { - const { timeout } = PlaywrightConfig; - test.beforeEach(async ({ page }) => { await page.goto("/apps/day3"); await page.click(":nth-match(.wodin-left .nav-tabs a, 2)"); // Options @@ -24,16 +21,13 @@ test.describe("stochastic app", () => { test("can change number of replicates and re-run model", async ({ page }) => { await page.fill(":nth-match(#run-options input, 2)", "6"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update.", - { - timeout - } + await expect(await page.locator(".action-required-msg")).toHaveText( + "Plot is out of date: number of replicates has changed. Run model to update." ); // Re-run model await page.click("#run-btn"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText(""); + await expect(await page.locator(".action-required-msg")).toHaveText(""); // number of series should have increased by 2 const summary = ".wodin-plot-data-summary-series"; @@ -49,29 +43,23 @@ test.describe("stochastic app", () => { test("traces are hidden if replicates are above maxReplicatesDisplay", async ({ page }) => { await page.fill(":nth-match(#run-options input, 2)", "50"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update.", - { - timeout - } + await expect(await page.locator(".action-required-msg")).toHaveText( + "Plot is out of date: number of replicates has changed. Run model to update." ); await page.click("#run-btn"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText(""); + await expect(await page.locator(".action-required-msg")).toHaveText(""); const summary = ".wodin-plot-data-summary-series"; expect(await page.locator(summary).count()).toBe(104); await page.fill(":nth-match(#run-options input, 2)", "51"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update.", - { - timeout - } + await expect(await page.locator(".action-required-msg")).toHaveText( + "Plot is out of date: number of replicates has changed. Run model to update." ); await page.click("#run-btn"); - await expect(await page.locator(".run-tab .action-required-msg")).toHaveText(""); + await expect(await page.locator(".action-required-msg")).toHaveText(""); expect(await page.locator(summary).count()).toBe(4); @@ -93,7 +81,7 @@ test.describe("stochastic app", () => { // Can see summary traces const summary = ".wodin-plot-data-summary-series"; - await expect(await page.locator(summary)).toHaveCount(44, { timeout }); + await expect(await page.locator(summary)).toHaveCount(44); await expectSummaryValues(page, 1, "I_det (beta=0.450)", 1001, "#2e5cb8"); await expectSummaryValues(page, 2, "I (beta=0.450)", 1001, "#6ab74d"); From 3f9f2a246ed85a4af196728c566624f91bc011c2 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:36:57 +0000 Subject: [PATCH 12/52] try and make tests less flaky --- app/static/tests/e2e/stochastic.etest.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/static/tests/e2e/stochastic.etest.ts b/app/static/tests/e2e/stochastic.etest.ts index 85b9edc2..c4728d84 100644 --- a/app/static/tests/e2e/stochastic.etest.ts +++ b/app/static/tests/e2e/stochastic.etest.ts @@ -19,6 +19,7 @@ test.describe("stochastic app", () => { }); test("can change number of replicates and re-run model", async ({ page }) => { + await expect(await page.locator(".action-required-msg")).toHaveText(""); await page.fill(":nth-match(#run-options input, 2)", "6"); await expect(await page.locator(".action-required-msg")).toHaveText( @@ -42,6 +43,7 @@ test.describe("stochastic app", () => { }); test("traces are hidden if replicates are above maxReplicatesDisplay", async ({ page }) => { + await expect(await page.locator(".action-required-msg")).toHaveText(""); await page.fill(":nth-match(#run-options input, 2)", "50"); await expect(await page.locator(".action-required-msg")).toHaveText( "Plot is out of date: number of replicates has changed. Run model to update." From 01e8f086626ddead622ba365673e73c626d900b1 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 14:19:05 +0000 Subject: [PATCH 13/52] add build action --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 2 ++ docker/Dockerfile | 8 ++------ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..58c0e779 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: [push] + +env: + TAG_GHCR: mrc-ide/wodin + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup env and login to GHCR + id: ci-env + uses: ./.github/actions/setup-and-login + with: + ghcr-username: ${{ github.actor }} + ghcr-password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push docker + uses: docker/build-push-action@v5 + with: + context: app + file: ./docker/Dockerfile + push: true + tags: | + ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} + ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09ea7940..8037b250 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: test + on: [push] + jobs: fe-unit-tests: runs-on: ubuntu-latest diff --git a/docker/Dockerfile b/docker/Dockerfile index 82b034d1..b9c7c451 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,11 +1,7 @@ -FROM ubuntu:jammy - -RUN apt-get update \ - && apt-get install -y --no-install-recommends ca-certificates curl \ - && curl -sL https://deb.nodesource.com/setup_20.x | bash \ - && apt-get install -y git nodejs +FROM node:20 COPY . /wodin RUN /wodin/scripts/build.sh && \ cp ./wodin/docker/update-site ./wodin/docker/update-sites /usr/local/bin + ENTRYPOINT ["/wodin/docker/wodin"] From daceefa3a29dc11d90ed25c877197ac0b2f065c7 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 14:20:32 +0000 Subject: [PATCH 14/52] full context --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58c0e779..ae7fc752 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,6 @@ jobs: - name: Build and push docker uses: docker/build-push-action@v5 with: - context: app file: ./docker/Dockerfile push: true tags: | From 5718e8b06b63448975c9ac88b90ab61311ff821b Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 14:28:04 +0000 Subject: [PATCH 15/52] try original dockerfile --- docker/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b9c7c451..82b034d1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,11 @@ -FROM node:20 +FROM ubuntu:jammy + +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates curl \ + && curl -sL https://deb.nodesource.com/setup_20.x | bash \ + && apt-get install -y git nodejs COPY . /wodin RUN /wodin/scripts/build.sh && \ cp ./wodin/docker/update-site ./wodin/docker/update-sites /usr/local/bin - ENTRYPOINT ["/wodin/docker/wodin"] From 5fee2ed3715ae7667973209f46310b116f1a0b78 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 14:45:48 +0000 Subject: [PATCH 16/52] clean up buildkite stuff --- buildkite/pipeline.yml | 13 ------------- docker/browser_tests | 32 -------------------------------- docker/build | 13 ------------- docker/common | 23 ----------------------- docker/push | 17 ----------------- docker/run_browser_tests | 12 ------------ scripts/run-version.sh | 2 +- 7 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 buildkite/pipeline.yml delete mode 100755 docker/browser_tests delete mode 100755 docker/build delete mode 100644 docker/common delete mode 100755 docker/push delete mode 100755 docker/run_browser_tests diff --git a/buildkite/pipeline.yml b/buildkite/pipeline.yml deleted file mode 100644 index 9826f85b..00000000 --- a/buildkite/pipeline.yml +++ /dev/null @@ -1,13 +0,0 @@ -steps: - - label: ":whale::node: Build" - command: docker/build - - - wait - - - label: ":playwright::chrome: Browser tests" - command: docker/browser_tests - - - wait - - - label: ":shipit: Push images" - command: docker/push diff --git a/docker/browser_tests b/docker/browser_tests deleted file mode 100755 index 68944a6f..00000000 --- a/docker/browser_tests +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -eux - -function remove_containers() { - docker kill odin.api wodin wodin-redis wodin-playwright 2>/dev/null || /bin/true -} - -function cleanup() { - set +x - remove_containers -} -trap cleanup EXIT - -ROOT=$(dirname $(dirname $0)) - -ROOT=$PWD -. $ROOT/docker/common - -remove_containers - -## all deps -./scripts/run-dependencies.sh - -## main app -docker pull $TAG_SHA -docker run --rm -d --name wodin --network=host $TAG_SHA /wodin/config - -## run the tests -docker run --rm --name wodin-playwright --network=host \ - -w /wodin/app/static \ - --entrypoint /wodin/docker/run_browser_tests \ - $TAG_SHA diff --git a/docker/build b/docker/build deleted file mode 100755 index 18bbdb94..00000000 --- a/docker/build +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -ex -HERE=$(dirname $0) -. $HERE/common - -docker build --pull \ - --tag $TAG_SHA \ - -f docker/Dockerfile \ - . - -# We always push the SHA tagged versions, for debugging if the tests -# after this step fail -docker push $TAG_SHA diff --git a/docker/common b/docker/common deleted file mode 100644 index c6eb206f..00000000 --- a/docker/common +++ /dev/null @@ -1,23 +0,0 @@ -# -*-sh-*- -PACKAGE_NAME=wodin -PACKAGE_ORG=mrcide - -# Buildkite doesn't check out a full history from the remote (just the -# single commit) so you end up with a detached head and git rev-parse -# doesn't work -if [ "$BUILDKITE" = "true" ]; then - GIT_SHA=${BUILDKITE_COMMIT:0:7} -else - GIT_SHA=$(git -C "$PACKAGE_ROOT" rev-parse --short=7 HEAD) -fi - - -if [ "$BUILDKITE" = "true" ]; then - GIT_BRANCH=$BUILDKITE_BRANCH -else - GIT_BRANCH=$(git -C "$PACKAGE_ROOT" symbolic-ref --short HEAD) -fi - -TAG_SHA="${PACKAGE_ORG}/${PACKAGE_NAME}:${GIT_SHA}" -TAG_BRANCH="${PACKAGE_ORG}/${PACKAGE_NAME}:${GIT_BRANCH}" -TAG_LATEST="${PACKAGE_ORG}/${PACKAGE_NAME}:latest" diff --git a/docker/push b/docker/push deleted file mode 100755 index 11a17be1..00000000 --- a/docker/push +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -e -HERE=$(dirname $0) -. $HERE/common - -# In case we switch agents between steps -[ ! -z $(docker images -q $TAG_SHA) ] || docker pull $TAG_SHA - -docker tag $TAG_SHA $TAG_BRANCH -docker push $TAG_BRANCH - -if [ $GIT_BRANCH == "master" ]; then - docker tag $TAG_SHA $TAG_LATEST - docker tag $TAG_SHA $TAG_VERSION - docker push $TAG_LATEST - docker push $TAG_VERSION -fi diff --git a/docker/run_browser_tests b/docker/run_browser_tests deleted file mode 100755 index 33a30260..00000000 --- a/docker/run_browser_tests +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -eux - -if [ ! -d tests/e2e ]; then - echo "Expected this script to be run from app/static" - exit 1 -fi - -npm install @playwright/test -npx playwright install -npx playwright install-deps -npm run test:e2e diff --git a/scripts/run-version.sh b/scripts/run-version.sh index 7290cd53..eb9367f0 100755 --- a/scripts/run-version.sh +++ b/scripts/run-version.sh @@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do done API_IMAGE=mrcide/odin.api:$API_BRANCH -APP_IMAGE=mrcide/wodin:$APP_BRANCH +APP_IMAGE=ghcr.io/mrc-ide/wodin:$APP_BRANCH REDIS_IMAGE=redis:6 API_NAME=odin.api From a1412a3c6b527f3a801056893f321827f4b19ece Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 14:56:57 +0000 Subject: [PATCH 17/52] add codecov config to silence dumb failures --- .github/workflows/test.yml | 1 + codecov.yml | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8037b250..24c74cc9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,7 @@ jobs: fail_ci_if_error: true # optional (default = false) files: ./app/static/coverage/coverage-final.json token: ${{ secrets.CODECOV_TOKEN }} # required + codecov_yml_path: ./codecov.yml be-unit-tests: runs-on: ubuntu-latest diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..2901e624 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +coverage: + precision: 2 + round: down + range: "95...100" From 5a88d816c5777e58150c5d51bae77ca682edb634 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 15:03:17 +0000 Subject: [PATCH 18/52] try 2% threshold --- codecov.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codecov.yml b/codecov.yml index 2901e624..a477e82a 100644 --- a/codecov.yml +++ b/codecov.yml @@ -2,3 +2,8 @@ coverage: precision: 2 round: down range: "95...100" + + status: + project: + default: + threshold: 2% From 785e6c058b2b3bbe333afba93b1137d3754001f1 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 15:28:13 +0000 Subject: [PATCH 19/52] smoke test after build --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae7fc752..af060e0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,3 +25,8 @@ jobs: tags: | ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} + + - name: Smoke test + run: | + ./scripts/run-version.sh --app ${{steps.ci-env.outputs.CI_BRANCH}} & + curl http://localhost:3000 | grep "Example WODIN configuration" From b1784013088067186a9afe7e7e956d383da0a7ff Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 15:38:34 +0000 Subject: [PATCH 20/52] proper smoke test --- .github/workflows/build.yml | 3 +-- scripts/smoke-test.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 scripts/smoke-test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af060e0d..d7bac2b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,7 @@ jobs: tags: | ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} - - name: Smoke test run: | ./scripts/run-version.sh --app ${{steps.ci-env.outputs.CI_BRANCH}} & - curl http://localhost:3000 | grep "Example WODIN configuration" + ./scripts/smoke-test.sh diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh new file mode 100755 index 00000000..f8be9a95 --- /dev/null +++ b/scripts/smoke-test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +retries=10 +sleep 5; + +while ((retries > 0)); do + curl http://localhost:3000 | grep "Example WODIN configuration" && break + + echo "retrying connection with server in 1 seconds" + sleep 1 + ((retries --)) +done + +if ((retries == 0 )); then + echo "Didn't get expected response from the server" + exit 1 +fi From f94c773ceed140afc171d84160966ee25eaf9bbd Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 15:41:26 +0000 Subject: [PATCH 21/52] wait for server for longer --- scripts/smoke-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index f8be9a95..fe3f086b 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash retries=10 -sleep 5; +sleep 15; while ((retries > 0)); do curl http://localhost:3000 | grep "Example WODIN configuration" && break From a814d204ad694fe2d7a208eca4eea9198648349e Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 15:44:22 +0000 Subject: [PATCH 22/52] slower timing --- scripts/smoke-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index fe3f086b..54792d51 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash retries=10 -sleep 15; +sleep 20; while ((retries > 0)); do curl http://localhost:3000 | grep "Example WODIN configuration" && break From b1fdd8a0d28909bc0bce6f870f64bd956f985fe8 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 16:17:54 +0000 Subject: [PATCH 23/52] get base image with node 20 from repo --- docker/Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 82b034d1..c47a16b9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,9 +1,4 @@ -FROM ubuntu:jammy - -RUN apt-get update \ - && apt-get install -y --no-install-recommends ca-certificates curl \ - && curl -sL https://deb.nodesource.com/setup_20.x | bash \ - && apt-get install -y git nodejs +FROM ghcr.io/mrc-ide/wodin-base-image COPY . /wodin RUN /wodin/scripts/build.sh && \ From 6fccbb0b544d8c6c9f89fad599c0b7c6289a2b40 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 16:20:23 +0000 Subject: [PATCH 24/52] specify tag --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c47a16b9..fc42c103 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/mrc-ide/wodin-base-image +FROM ghcr.io/mrc-ide/wodin-base-image:main COPY . /wodin RUN /wodin/scripts/build.sh && \ From ce8392e7108ed153a54c11b7f4f66241cfc21864 Mon Sep 17 00:00:00 2001 From: Mantra Date: Sat, 16 Nov 2024 10:43:18 +0000 Subject: [PATCH 25/52] split general action into multiple --- .../actions/build-and-run-wodin/action.yml | 16 +++++++ .../action.yml | 44 ++++--------------- .../actions/install-npm-packages/action.yml | 28 ++++++++++++ .github/workflows/build.yml | 5 +-- .github/workflows/test.yml | 30 +++++-------- 5 files changed, 64 insertions(+), 59 deletions(-) create mode 100644 .github/actions/build-and-run-wodin/action.yml rename .github/actions/{setup-and-login => ci-env-and-ghcr-login}/action.yml (51%) create mode 100644 .github/actions/install-npm-packages/action.yml diff --git a/.github/actions/build-and-run-wodin/action.yml b/.github/actions/build-and-run-wodin/action.yml new file mode 100644 index 00000000..c010e79e --- /dev/null +++ b/.github/actions/build-and-run-wodin/action.yml @@ -0,0 +1,16 @@ +name: Build and run WODIN (and deps) + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build and run server + if: inputs.build-and-run-server == 'true' + shell: bash + run: | + ./scripts/build.sh + ./scripts/run-dependencies.sh + npm run serve --prefix=app/server & diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/ci-env-and-ghcr-login/action.yml similarity index 51% rename from .github/actions/setup-and-login/action.yml rename to .github/actions/ci-env-and-ghcr-login/action.yml index cce5b64f..9e2f8a66 100644 --- a/.github/actions/setup-and-login/action.yml +++ b/.github/actions/ci-env-and-ghcr-login/action.yml @@ -1,18 +1,10 @@ -name: Setup Node, Env and login to GHCR +name: Setup CI Env and login to GHCR inputs: - install-packages: - required: false - default: 'false' - build-and-run-server: - required: false - default: 'false' ghcr-username: - required: false - default: '' + required: true ghcr-password: - required: false - default: '' + required: true outputs: CI_SHA: @@ -25,13 +17,6 @@ outputs: runs: using: "composite" steps: - - name: Login to GHCR (GitHub Packages) - if: inputs.ghcr-username != '' && inputs.ghcr-password != '' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ inputs.ghcr-username }} - password: ${{ inputs.ghcr-password }} - id: ci-env name: Setup Environment shell: bash @@ -46,22 +31,9 @@ runs: fi echo "CI_SHA=${long_sha:0:7}" >> $GITHUB_OUTPUT - - uses: actions/setup-node@v4 + - name: Login to GHCR (GitHub Packages) + uses: docker/login-action@v3 with: - node-version: 20 - - - name: Install packages - # we install in the build script anyway so skip if build-and-run-server - if: inputs.install-packages == 'true' && inputs.build-and-run-server != 'true' - shell: bash - run: | - npm i --prefix=app/server - npm i --prefix=app/static - - - name: Build and run server - if: inputs.build-and-run-server == 'true' - shell: bash - run: | - ./scripts/build.sh - ./scripts/run-dependencies.sh - npm run serve --prefix=app/server & + registry: ghcr.io + username: ${{ inputs.ghcr-username }} + password: ${{ inputs.ghcr-password }} diff --git a/.github/actions/install-npm-packages/action.yml b/.github/actions/install-npm-packages/action.yml new file mode 100644 index 00000000..b7e2fbf1 --- /dev/null +++ b/.github/actions/install-npm-packages/action.yml @@ -0,0 +1,28 @@ +name: Install NPM packages + +inputs: + server: + required: false + default: 'false' + static: + required: false + default: 'false' + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install server (backend) NPM packages + if: inputs.server == 'true' + shell: bash + run: | + npm i --prefix=app/server + + - name: Install static (frontend) NPM packages + if: inputs.server == 'true' + shell: bash + run: | + npm i --prefix=app/static diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7bac2b4..96758bac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,9 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup env and login to GHCR - id: ci-env - uses: ./.github/actions/setup-and-login + - id: ci-env + uses: ./.github/actions/ci-env-and-ghcr-login with: ghcr-username: ${{ github.actor }} ghcr-password: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24c74cc9..dccd9c45 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,28 +7,24 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: ./.github/actions/setup-and-login + - uses: ./.github/actions/install-npm-packages with: - install-packages: true + static: true - name: Test front end run: npm run coverage --prefix=app/static - uses: codecov/codecov-action@v4 with: - fail_ci_if_error: true # optional (default = false) + fail_ci_if_error: true files: ./app/static/coverage/coverage-final.json - token: ${{ secrets.CODECOV_TOKEN }} # required + token: ${{ secrets.CODECOV_TOKEN }} codecov_yml_path: ./codecov.yml be-unit-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: ./.github/actions/setup-and-login - with: - build-and-run-server: true + - uses: ./.github/actions/build-and-run-wodin - name: Test back end run: npm test --prefix=app/server @@ -44,10 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: ./.github/actions/setup-and-login - with: - build-and-run-server: true + - uses: ./.github/actions/build-and-run-wodin - name: Test back end integration run: npm run integration-test --prefix=app/server @@ -59,10 +52,7 @@ jobs: shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: ./.github/actions/setup-and-login - with: - build-and-run-server: true + - uses: ./.github/actions/build-and-run-wodin - name: Get installed Playwright version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV @@ -84,10 +74,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node - uses: ./.github/actions/setup-and-login + - uses: ./.github/actions/install-npm-packages with: - install-packages: true + static: true + server: true - name: Lint back end run: npm run lint --prefix=app/server From 8386fb910685142bdfd03ad3adc46dcf205bff37 Mon Sep 17 00:00:00 2001 From: Mantra Date: Sat, 16 Nov 2024 19:39:44 +0000 Subject: [PATCH 26/52] emma changed: clean up code and better working --- .github/workflows/test.yml | 2 +- app/static/playwright.config.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dccd9c45..c3d3054c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,7 +56,7 @@ jobs: - name: Get installed Playwright version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV - - name: Cache playwright binaries + - name: Cache binaries for playwright version uses: actions/cache@v4 id: playwright-cache with: diff --git a/app/static/playwright.config.ts b/app/static/playwright.config.ts index c0f367f3..51add361 100644 --- a/app/static/playwright.config.ts +++ b/app/static/playwright.config.ts @@ -26,8 +26,6 @@ export default defineConfig({ forbidOnly: !!process.env.CI, /* Retry on CI only */ retries: process.env.CI ? 2 : 1, - /* Opt out of parallel tests on CI. */ - // workers: process.env.CI ? 1 : undefined, fullyParallel: true, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ // reporter: 'html', From a581934be476fff82d95a751f3387a534150ba9c Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 14:38:18 +0000 Subject: [PATCH 27/52] try pull manifest on github action --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96758bac..20322d7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,10 @@ jobs: with: ghcr-username: ${{ github.actor }} ghcr-password: ${{ secrets.GITHUB_TOKEN }} + + - name: Checking + run: | + curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'authorisation:bearer ${{ secrets.GITHUB_TOKEN }}' - name: Build and push docker uses: docker/build-push-action@v5 From c89308f95f6502872c7e0eb1d4128725c9ed619c Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 14:40:52 +0000 Subject: [PATCH 28/52] try again --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20322d7d..bbbd8662 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: Checking run: | - curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'authorisation:bearer ${{ secrets.GITHUB_TOKEN }}' + curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization:Bearer ${{ secrets.GITHUB_TOKEN }}' - name: Build and push docker uses: docker/build-push-action@v5 From abb9581b85b53ab1e7e7b059358be96aee086afb Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 14:41:53 +0000 Subject: [PATCH 29/52] space --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbbd8662..e17083df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: Checking run: | - curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization:Bearer ${{ secrets.GITHUB_TOKEN }}' + curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' - name: Build and push docker uses: docker/build-push-action@v5 From 0234f16682d13783446361f827803272a0919284 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 14:47:31 +0000 Subject: [PATCH 30/52] try with new token --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e17083df..f3068ad4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: Checking run: | - curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' + curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer ${{ secrets.GHCR_TOKEN }}' - name: Build and push docker uses: docker/build-push-action@v5 From d616c9eb05e98562b8c1e93389d287ef1374926b Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:03:28 +0000 Subject: [PATCH 31/52] now with auth --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3068ad4..20d18f1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,8 @@ jobs: - name: Checking run: | - curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer ${{ secrets.GHCR_TOKEN }}' + GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) + curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer {GHCR_TOKEN}' - name: Build and push docker uses: docker/build-push-action@v5 From d531170ebd82c3f5b9e58ec9866669635cee389a Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:06:58 +0000 Subject: [PATCH 32/52] use double quotes instead of single quotyes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20d18f1f..32387998 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Checking run: | GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - curl 'https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976' -H 'accept: application/vnd.docker.distribution.manifest.v2+json' -H 'Authorization: Bearer {GHCR_TOKEN}' + curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" -H "accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer ${GHCR_TOKEN}" - name: Build and push docker uses: docker/build-push-action@v5 From e71abda28f2d6e53c3bcc6ea17010fe253023e25 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:20:45 +0000 Subject: [PATCH 33/52] add conditional step to make new docker image --- .github/workflows/build.yml | 5 ----- .github/workflows/test.yml | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32387998..b704ed16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,6 @@ jobs: ghcr-username: ${{ github.actor }} ghcr-password: ${{ secrets.GITHUB_TOKEN }} - - name: Checking - run: | - GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" -H "accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer ${GHCR_TOKEN}" - - name: Build and push docker uses: docker/build-push-action@v5 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3d3054c..f69daea8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,3 +83,20 @@ jobs: run: npm run lint --prefix=app/server - name: Lint front end run: npm run lint --prefix=app/static + + publish-latest-image: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/mrc-5976' + needs: [fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] + steps: + - name: Publish image manifest to latest + run: | + GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) + curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" \ + -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ + -H "Authorization: Bearer ${GHCR_TOKEN}" \ + > manifest.json + curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ + -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ + -H "Authorization: Bearer ${GHCR_TOKEN}" \ + -d '@d manifest.json' From 6b2b5b1a19ca55d1cb1fb36b36dc73ad0b9ad8e8 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:21:50 +0000 Subject: [PATCH 34/52] just checking lint for now --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f69daea8..657098c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,7 +87,7 @@ jobs: publish-latest-image: runs-on: ubuntu-latest if: github.ref == 'refs/heads/mrc-5976' - needs: [fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] + needs: [lint] steps: - name: Publish image manifest to latest run: | From bc92d1aa507fd568de15e04c16275ad30c8157b7 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:23:39 +0000 Subject: [PATCH 35/52] fix typo in curl --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 657098c0..986c6141 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,4 +99,4 @@ jobs: curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ - -d '@d manifest.json' + -d '@manifest.json' From 1ae4c4cfb5cf64454865a2ff7bfa5c289a90fbbd Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:28:36 +0000 Subject: [PATCH 36/52] put all in single workflow --- .github/workflows/build.yml | 30 ------------------------------ .github/workflows/test.yml | 28 +++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b704ed16..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: build - -on: [push] - -env: - TAG_GHCR: mrc-ide/wodin - -jobs: - build-and-push: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - id: ci-env - uses: ./.github/actions/ci-env-and-ghcr-login - with: - ghcr-username: ${{ github.actor }} - ghcr-password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push docker - uses: docker/build-push-action@v5 - with: - file: ./docker/Dockerfile - push: true - tags: | - ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} - ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} - - name: Smoke test - run: | - ./scripts/run-version.sh --app ${{steps.ci-env.outputs.CI_BRANCH}} & - ./scripts/smoke-test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 986c6141..2c1c5a2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,33 @@ name: test on: [push] +env: + TAG_GHCR: mrc-ide/wodin + jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: ci-env + uses: ./.github/actions/ci-env-and-ghcr-login + with: + ghcr-username: ${{ github.actor }} + ghcr-password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push docker + uses: docker/build-push-action@v5 + with: + file: ./docker/Dockerfile + push: true + tags: | + ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} + ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} + - name: Smoke test + run: | + ./scripts/run-version.sh --app ${{steps.ci-env.outputs.CI_BRANCH}} & + ./scripts/smoke-test.sh + fe-unit-tests: runs-on: ubuntu-latest steps: @@ -87,7 +113,7 @@ jobs: publish-latest-image: runs-on: ubuntu-latest if: github.ref == 'refs/heads/mrc-5976' - needs: [lint] + needs: [lint, build-and-push] steps: - name: Publish image manifest to latest run: | From ee072787f929591b67ec0c33543836f1bec5bd88 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:32:45 +0000 Subject: [PATCH 37/52] test conditional --- .github/workflows/{test.yml => build-test-publish.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{test.yml => build-test-publish.yml} (98%) diff --git a/.github/workflows/test.yml b/.github/workflows/build-test-publish.yml similarity index 98% rename from .github/workflows/test.yml rename to .github/workflows/build-test-publish.yml index 2c1c5a2f..0bd5eaaf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/build-test-publish.yml @@ -1,4 +1,4 @@ -name: test +name: Wodin CI on: [push] @@ -112,7 +112,7 @@ jobs: publish-latest-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/mrc-5976' + if: github.ref == 'refs/heads/mrc-59720' needs: [lint, build-and-push] steps: - name: Publish image manifest to latest From 13e16fd65093efaa0bd4299da1d3e780b1c24005 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:37:55 +0000 Subject: [PATCH 38/52] publish to latest tag if on main and testing is done --- .github/workflows/build-test-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 0bd5eaaf..64a250e6 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -112,8 +112,8 @@ jobs: publish-latest-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/mrc-59720' - needs: [lint, build-and-push] + if: github.ref == 'refs/heads/main' + needs: [build-and-push, fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] steps: - name: Publish image manifest to latest run: | @@ -122,7 +122,7 @@ jobs: -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ > manifest.json - curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ + curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/latest" \ -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ -d '@manifest.json' From 692968b61083e5905fc32e7b43aa8c58071ea13c Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:40:22 +0000 Subject: [PATCH 39/52] complete script --- .github/workflows/build-test-publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 64a250e6..ba5bcb6c 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -115,10 +115,16 @@ jobs: if: github.ref == 'refs/heads/main' needs: [build-and-push, fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] steps: + - id: ci-env + uses: ./.github/actions/ci-env-and-ghcr-login + with: + ghcr-username: ${{ github.actor }} + ghcr-password: ${{ secrets.GITHUB_TOKEN }} + - name: Publish image manifest to latest run: | GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" \ + curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/${{steps.ci-env.outputs.CI_BRANCH}}" \ -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ > manifest.json From a0f73d6437a550be30618aed8bc4374d280c8119 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:41:03 +0000 Subject: [PATCH 40/52] rename to CI --- .github/workflows/build-test-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index ba5bcb6c..a7ca762e 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -1,4 +1,4 @@ -name: Wodin CI +name: CI on: [push] From b879ab169927e81f6709155b63767a622e1752d3 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:42:14 +0000 Subject: [PATCH 41/52] consistent spacing --- .github/workflows/build-test-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index a7ca762e..3648412a 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -22,11 +22,11 @@ jobs: file: ./docker/Dockerfile push: true tags: | - ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_SHA}} - ghcr.io/${{env.TAG_GHCR}}:${{steps.ci-env.outputs.CI_BRANCH}} + ghcr.io/${{ env.TAG_GHCR }}:${{ steps.ci-env.outputs.CI_SHA }} + ghcr.io/${{ env.TAG_GHCR }}:${{ steps.ci-env.outputs.CI_BRANCH }} - name: Smoke test run: | - ./scripts/run-version.sh --app ${{steps.ci-env.outputs.CI_BRANCH}} & + ./scripts/run-version.sh --app ${{ steps.ci-env.outputs.CI_BRANCH }} & ./scripts/smoke-test.sh fe-unit-tests: @@ -124,7 +124,7 @@ jobs: - name: Publish image manifest to latest run: | GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/${{steps.ci-env.outputs.CI_BRANCH}}" \ + curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/${{ steps.ci-env.outputs.CI_BRANCH }}" \ -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ > manifest.json From 9611cb0624312a155019254b3f7541122ff43188 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:55:14 +0000 Subject: [PATCH 42/52] fix npm package install action + pull out stochastic logic into helper --- .../actions/install-npm-packages/action.yml | 2 +- app/static/tests/e2e/stochastic.etest.ts | 28 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/actions/install-npm-packages/action.yml b/.github/actions/install-npm-packages/action.yml index b7e2fbf1..38b021a0 100644 --- a/.github/actions/install-npm-packages/action.yml +++ b/.github/actions/install-npm-packages/action.yml @@ -22,7 +22,7 @@ runs: npm i --prefix=app/server - name: Install static (frontend) NPM packages - if: inputs.server == 'true' + if: inputs.static == 'true' shell: bash run: | npm i --prefix=app/static diff --git a/app/static/tests/e2e/stochastic.etest.ts b/app/static/tests/e2e/stochastic.etest.ts index c4728d84..6cde88ed 100644 --- a/app/static/tests/e2e/stochastic.etest.ts +++ b/app/static/tests/e2e/stochastic.etest.ts @@ -1,4 +1,4 @@ -import { expect, test } from "@playwright/test"; +import { expect, Page, test } from "@playwright/test"; import { expectSummaryValues } from "./utils"; test.describe("stochastic app", () => { @@ -8,6 +8,14 @@ test.describe("stochastic app", () => { await page.click(":nth-match(.wodin-right .nav-tabs a, 2)"); // Run }); + const expectChangedNumberOfReplicatesMessage = async (page: Page, newReplicates: string) => { + await expect(await page.locator(".action-required-msg")).toHaveText(""); + await page.fill(":nth-match(#run-options input, 2)", newReplicates); + await expect(await page.locator(".action-required-msg")).toHaveText( + "Plot is out of date: number of replicates has changed. Run model to update." + ); + }; + test("can display number of replicates", async ({ page }) => { await expect(await page.innerText(":nth-match(.collapse-title, 2)")).toContain("Run Options"); await expect(await page.getAttribute(":nth-match(.collapse-title i, 2)", "data-name")).toBe("chevron-up"); @@ -19,12 +27,7 @@ test.describe("stochastic app", () => { }); test("can change number of replicates and re-run model", async ({ page }) => { - await expect(await page.locator(".action-required-msg")).toHaveText(""); - await page.fill(":nth-match(#run-options input, 2)", "6"); - - await expect(await page.locator(".action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update." - ); + await expectChangedNumberOfReplicatesMessage(page, "6"); // Re-run model await page.click("#run-btn"); @@ -43,11 +46,7 @@ test.describe("stochastic app", () => { }); test("traces are hidden if replicates are above maxReplicatesDisplay", async ({ page }) => { - await expect(await page.locator(".action-required-msg")).toHaveText(""); - await page.fill(":nth-match(#run-options input, 2)", "50"); - await expect(await page.locator(".action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update." - ); + await expectChangedNumberOfReplicatesMessage(page, "50"); await page.click("#run-btn"); await expect(await page.locator(".action-required-msg")).toHaveText(""); @@ -55,10 +54,7 @@ test.describe("stochastic app", () => { const summary = ".wodin-plot-data-summary-series"; expect(await page.locator(summary).count()).toBe(104); - await page.fill(":nth-match(#run-options input, 2)", "51"); - await expect(await page.locator(".action-required-msg")).toHaveText( - "Plot is out of date: number of replicates has changed. Run model to update." - ); + await expectChangedNumberOfReplicatesMessage(page, "51"); await page.click("#run-btn"); await expect(await page.locator(".action-required-msg")).toHaveText(""); From 4f39338ce1e69bc7a342c3f9a50bce4ee4f8ebbe Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:57:39 +0000 Subject: [PATCH 43/52] fix actions --- .github/actions/build-and-run-wodin/action.yml | 1 - .github/actions/install-npm-packages/action.yml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-and-run-wodin/action.yml b/.github/actions/build-and-run-wodin/action.yml index c010e79e..991df343 100644 --- a/.github/actions/build-and-run-wodin/action.yml +++ b/.github/actions/build-and-run-wodin/action.yml @@ -8,7 +8,6 @@ runs: node-version: 20 - name: Build and run server - if: inputs.build-and-run-server == 'true' shell: bash run: | ./scripts/build.sh diff --git a/.github/actions/install-npm-packages/action.yml b/.github/actions/install-npm-packages/action.yml index 38b021a0..2eb81cba 100644 --- a/.github/actions/install-npm-packages/action.yml +++ b/.github/actions/install-npm-packages/action.yml @@ -19,10 +19,10 @@ runs: if: inputs.server == 'true' shell: bash run: | - npm i --prefix=app/server + npm ci --prefix=app/server - name: Install static (frontend) NPM packages if: inputs.static == 'true' shell: bash run: | - npm i --prefix=app/static + npm ci --prefix=app/static From 7cf5ebba059238e0cfd8c71d11775672988d422e Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:05:49 +0000 Subject: [PATCH 44/52] npm i instead of ci --- .github/actions/install-npm-packages/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-npm-packages/action.yml b/.github/actions/install-npm-packages/action.yml index 2eb81cba..38b021a0 100644 --- a/.github/actions/install-npm-packages/action.yml +++ b/.github/actions/install-npm-packages/action.yml @@ -19,10 +19,10 @@ runs: if: inputs.server == 'true' shell: bash run: | - npm ci --prefix=app/server + npm i --prefix=app/server - name: Install static (frontend) NPM packages if: inputs.static == 'true' shell: bash run: | - npm ci --prefix=app/static + npm i --prefix=app/static From b68a5a8dec56baa8c7aab8c492766ae7f6c2c0b7 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:13:03 +0000 Subject: [PATCH 45/52] install playwright first --- .github/workflows/build-test-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 3648412a..4876eb1b 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -78,7 +78,6 @@ jobs: shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/build-and-run-wodin - name: Get installed Playwright version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV @@ -93,8 +92,10 @@ jobs: if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - uses: ./.github/actions/build-and-run-wodin + - name: Test e2e - run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 + run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 lint: runs-on: ubuntu-latest From c6fc9fb8ef45d490b6b44127f1dc51644ae644d2 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:14:40 +0000 Subject: [PATCH 46/52] ci instead of i --- .github/actions/install-npm-packages/action.yml | 4 ++-- scripts/build-backend.sh | 2 +- scripts/build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/install-npm-packages/action.yml b/.github/actions/install-npm-packages/action.yml index 38b021a0..2eb81cba 100644 --- a/.github/actions/install-npm-packages/action.yml +++ b/.github/actions/install-npm-packages/action.yml @@ -19,10 +19,10 @@ runs: if: inputs.server == 'true' shell: bash run: | - npm i --prefix=app/server + npm ci --prefix=app/server - name: Install static (frontend) NPM packages if: inputs.static == 'true' shell: bash run: | - npm i --prefix=app/static + npm ci --prefix=app/static diff --git a/scripts/build-backend.sh b/scripts/build-backend.sh index c99991fb..80bedef6 100644 --- a/scripts/build-backend.sh +++ b/scripts/build-backend.sh @@ -1,5 +1,5 @@ set -ex ROOT=$(realpath $(dirname $0)/..) -npm install --prefix=$ROOT/app/server +npm ci --prefix=$ROOT/app/server npm run build --prefix=$ROOT/app/server diff --git a/scripts/build.sh b/scripts/build.sh index 26f98f27..e52e8c31 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,7 +1,7 @@ set -ex ROOT=$(realpath $(dirname $0)/..) -npm install --prefix=$ROOT/app/static +npm ci --prefix=$ROOT/app/static npm run build-with-check --prefix=$ROOT/app/static . $ROOT/scripts/build-backend.sh From 677e6d2d4c74d4c79cfd51a1c6f1c6ab98798e69 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:15:22 +0000 Subject: [PATCH 47/52] switch order again --- .github/workflows/build-test-publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 4876eb1b..30a4ce0f 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -78,6 +78,7 @@ jobs: shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/build-and-run-wodin - name: Get installed Playwright version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV @@ -91,9 +92,6 @@ jobs: - name: Install Playwright Browsers if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps - - - uses: ./.github/actions/build-and-run-wodin - - name: Test e2e run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 From 715d0af2c50819f465a6af27b5718350db73888a Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:16:35 +0000 Subject: [PATCH 48/52] pin playwright version --- .github/workflows/build-test-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 30a4ce0f..bc6900c6 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -91,7 +91,7 @@ jobs: key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} - name: Install Playwright Browsers if: steps.playwright-cache.outputs.cache-hit != 'true' - run: npx playwright install --with-deps + run: npx playwrigh@${{ env.PLAYWRIGHT_VERSION }} install --with-deps - name: Test e2e run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 From a55a6b9e4f6fc0cc4ec1ed1752aa5fc656a0550c Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:18:06 +0000 Subject: [PATCH 49/52] typo --- .github/workflows/build-test-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index bc6900c6..ccca3a11 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -91,7 +91,7 @@ jobs: key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} - name: Install Playwright Browsers if: steps.playwright-cache.outputs.cache-hit != 'true' - run: npx playwrigh@${{ env.PLAYWRIGHT_VERSION }} install --with-deps + run: npx playwright@${{ env.PLAYWRIGHT_VERSION }} install --with-deps - name: Test e2e run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 From 63ac83e90a49e422f2c51160139286e39783c865 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:21:38 +0000 Subject: [PATCH 50/52] testing current implementation --- .github/workflows/build-test-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index ccca3a11..6428fa1d 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -111,7 +111,7 @@ jobs: publish-latest-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/mrc-5976' needs: [build-and-push, fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] steps: - id: ci-env @@ -127,7 +127,7 @@ jobs: -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ > manifest.json - curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/latest" \ + curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ -d '@manifest.json' From 8b3c2abc09daa3a4478a146bad9e1c1978f6d72f Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:24:42 +0000 Subject: [PATCH 51/52] add checkout to publish job --- .github/workflows/build-test-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 6428fa1d..f12bd364 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -114,6 +114,7 @@ jobs: if: github.ref == 'refs/heads/mrc-5976' needs: [build-and-push, fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] steps: + - uses: actions/checkout@v4 - id: ci-env uses: ./.github/actions/ci-env-and-ghcr-login with: From 5018d1261619e9b58e41e871decab4291cbc401a Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 16:29:15 +0000 Subject: [PATCH 52/52] add comment and revert to main branch publishing --- .github/workflows/build-test-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index f12bd364..73caba95 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -111,7 +111,8 @@ jobs: publish-latest-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/mrc-5976' + # change this ref to publish to "latest" tag from another branch + if: github.ref == 'refs/heads/main' needs: [build-and-push, fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] steps: - uses: actions/checkout@v4 @@ -128,7 +129,7 @@ jobs: -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ > manifest.json - curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ + curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/latest" \ -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ -H "Authorization: Bearer ${GHCR_TOKEN}" \ -d '@manifest.json'