From 01fab142d4986cdc828fe773bb6b6c8e9ad2eb55 Mon Sep 17 00:00:00 2001 From: Kai Peacock Date: Fri, 21 Jun 2024 15:44:24 -0700 Subject: [PATCH] ci: npm cache and cypress action (#897) * npm cache and cypress action * chore: changelog --- .github/workflows/e2e-tests.yml | 35 +++++++++++++++++++++++++++++---- docs/CHANGELOG.md | 4 ++++ e2e/node/basic/mainnet.test.ts | 2 +- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index fbd73a4d..0068c994 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -28,9 +28,25 @@ jobs: with: node-version: ${{ matrix.node }} - - run: npm install -g npm - - - run: npm install + - name: Cache node modules + id: cache-npm + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - run: npm ci + - run: npm run build -ws # build monorepo incl. each subpackage - run: npm run build --workspaces --if-present @@ -46,11 +62,22 @@ jobs: id: setup run: npm run setup --workspaces --if-present - - run: npm run e2e --workspaces --if-present + - name: Node.js e2e tests + run: npm run e2e --workspace e2e/node env: CI: true REPLICA_PORT: 4943 + - name: Cypress e2e tests + uses: cypress-io/github-action@v6 + with: + install: false + project: ./e2e/browser + start: | + npm run e2e --workspace e2e/node + wait-on: 'http://localhost:1234' + wait-on-timeout: 120 + aggregate: name: e2e:required if: ${{ always() }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7b3ada9..1a95dc57 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Changed + +- ci: using cypress github action for e2e tests + ## [1.4.0] - 2024-06-17 ### Added diff --git a/e2e/node/basic/mainnet.test.ts b/e2e/node/basic/mainnet.test.ts index 3fea750e..05e8ccd4 100644 --- a/e2e/node/basic/mainnet.test.ts +++ b/e2e/node/basic/mainnet.test.ts @@ -110,7 +110,7 @@ describe('certified query', () => { }, ] `); - }); + }, 30_000); }); describe('controllers', () => {