Merge pull request #2069 from oasisprotocol/lw/detect-eth-key #4897
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | |
name: ci-test | |
# Trigger the workflow when: | |
on: | |
# A push occurs to one of the matched branches. | |
push: | |
branches: | |
- master | |
- stable/* | |
# Or when a pull request event occurs for a pull request against one of the | |
# matched branches. | |
pull_request: | |
branches: | |
- master | |
- stable/* | |
# Explicitly disable secrets.GITHUB_TOKEN permissions. | |
permissions: {} | |
jobs: | |
yarn_cache: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
id: yarn-cache | |
with: | |
node-version: 18 | |
cache: yarn | |
- if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
jest: | |
# NOTE: This name appears in GitHub's Checks API. | |
name: jest | |
needs: [yarn_cache] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- run: yarn test --coverage | |
- name: 'Upload coverage report' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jest-coverage | |
path: coverage | |
retention-days: 5 | |
playwright: | |
# NOTE: This name appears in GitHub's Checks API. | |
name: playwright | |
needs: [yarn_cache] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- run: REACT_APP_E2E_TEST=1 yarn build:ext | |
- run: REACT_APP_E2E_TEST=1 yarn start:prod & | |
- name: Install playwright's npm dependencies | |
working-directory: ./playwright/ | |
run: yarn install --frozen-lockfile | |
- name: Install playwright's system dependencies | |
working-directory: ./playwright/ | |
run: npx playwright install --with-deps | |
- run: npx wait-on http://localhost:5000/ --timeout 60000 | |
- name: Run playwright tests (with xvfb-run to support headed extension test) | |
working-directory: ./playwright/ | |
run: xvfb-run yarn test:prod | |
- name: 'Upload playwright test-results' | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-test-results | |
path: playwright/test-results | |
retention-days: 5 | |
cypress: | |
# NOTE: This name appears in GitHub's Checks API. | |
name: cypress | |
needs: [yarn_cache] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- run: docker compose pull | |
- uses: satackey/[email protected] | |
# Ignore the failure of a step and avoid terminating the job. | |
continue-on-error: true | |
- run: NODE_ENV=test REACT_APP_LOCALNET=1 REACT_APP_BACKEND=oasismonitor yarn start & | |
- run: docker compose up --build -d | |
- run: npx wait-on http://localhost:3000/ --timeout 60000 | |
- run: yarn cypress:run | |
- name: 'Upload coverage report' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-coverage | |
path: cypress-coverage | |
retention-days: 5 | |
upload-coverage: | |
# NOTE: This name appears in GitHub's Checks API. | |
name: coverage | |
needs: [cypress, jest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download coverage reports | |
uses: actions/download-artifact@v4 | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./jest-coverage/coverage-final.json | |
flags: jest | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./cypress-coverage/coverage-final.json | |
flags: cypress |