-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve CI pipeline INTER-180 (#109)
* chore: refactor and speed up resetting scenarios * chore: use default attribute data-testid * feat: turn pro signals into links * feat: turn enterprise signals into links * chore: fix tests * chore: remove more waitForSelectors * chore: update selectors in Loan Risk * chore: update selectors in Payment fraud * chore: update selectors in Coupon fraud * chore: update selectors in Paywall * chore: remove artificial timeouts * chore: put playground timeout back * chore: put scraping timeout back * ci: add unit tests * add eslint to ci, fix eslint errors * chore: try using yarn cache * chore: try using cache action * chore: enable node modules cache for playwright tests * chore: try using container * chore: put runs on back * chore: try caching playwright manually * chore: fix playwright version * chore: fix dependencies install * chore: fix dependencies install 2nd attempt * chore: fix eslint error * chore: try instal deps just for chrome * install webkit dependencies * try caching next build * narrow down hash files * tech next cache miss * try using container * fix home env? * try starting web server using playwright * use yarn start * Don't use a container * chore: improve eslintrc.js * chore: clean up * cleanup ci.yaml * chore: review fixes
- Loading branch information
Showing
14 changed files
with
1,223 additions
and
527 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'next/core-web-vitals', | ||
'prettier', | ||
], | ||
plugins: ['react-hooks', 'prettier'], | ||
rules: { | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'prettier/prettier': 'error', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'react/no-unescaped-entities': 'off', | ||
}, | ||
env: { | ||
es6: true, | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
env: | ||
# Playwright headless browsers running in CI get low confidence scores, causing flaky tests. Lower the confidence score threshold for CI testing. | ||
MIN_CONFIDENCE_SCORE: 0 | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# This takes 20s but does not seem necessary for our current setup, | ||
# as ubuntu-latest already has a reasonable version of Node | ||
# Add this to all jobs if you encounter problems with Node installation | ||
# This also makes use of global yarn cache | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: 18 | ||
# cache: 'yarn' | ||
|
||
- name: 'Cache' | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: nodemodules-${{ hashFiles('yarn.lock') }} | ||
restore-keys: nodemodules- | ||
|
||
- name: Install packages | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
|
||
- name: Lint | ||
run: yarn lint | ||
unit-tests: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: 'Cache' | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: nodemodules-${{ hashFiles('yarn.lock') }} | ||
restore-keys: nodemodules- | ||
|
||
- name: Install packages | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
|
||
- name: Run unit tests | ||
run: yarn test | ||
e2e: | ||
name: Playwright e2e tests | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shardIndex: [1, 2, 3] | ||
shardTotal: [3] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: nodemodules-${{ hashFiles('yarn.lock') }} | ||
restore-keys: nodemodules- | ||
|
||
- name: Install node modules | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
|
||
- name: Get installed Playwright version (used in cache key) | ||
id: playwright-version | ||
run: echo "PLAYWRIGHT_VERSION=$(node -e "process.stdout.write(require('@playwright/test/package.json').version)")" >> $GITHUB_ENV | ||
|
||
- name: Cache Playwright browser binaries | ||
uses: actions/cache@v3 | ||
id: playwright-cache | ||
with: | ||
path: | | ||
~/.cache/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | ||
|
||
- name: Install Playwright browsers binaries if cache missed | ||
run: yarn playwright install --with-deps | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
|
||
# Ubuntu needs extra stuff to run webkit tests, alternative is using a Playwright docker container but | ||
# that is slower in CI. | ||
- name: If browser binaries cache hit, install just webkit dependencies | ||
run: yarn playwright install-deps webkit | ||
if: steps.playwright-cache.outputs.cache-hit == 'true' | ||
|
||
- name: Cache Next build | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/.next/cache | ||
# Generate a new cache whenever packages or source files change. | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-${{ hashFiles('src/*') }} | ||
# If source files changed but packages didn't, rebuild from a prior cache. | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}- | ||
- name: Build website | ||
run: yarn build | ||
|
||
- name: Run Playwright tests | ||
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | ||
|
||
- name: Upload Playwright report | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,6 @@ tsconfig.tsbuildinfo | |
|
||
# VS code workspace settings | ||
.vscode | ||
|
||
# MacOS Finder | ||
.DS_Store |
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
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
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
Oops, something went wrong.