Improve CI pipeline INTER-180 #2
Workflow file for this run
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
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: | |
eslint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Run eslint | |
run: yarn lint | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Run unit tests | |
run: yarn test | |
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: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Install Playwright Browsers | |
run: yarn playwright install --with-deps | |
- name: Build website | |
run: yarn build | |
- name: Start website | |
run: yarn start & | |
- name: Wait for website | |
timeout-minutes: 1 | |
run: | | |
while ! curl -s http://localhost:3000 > /dev/null; do | |
echo "Waiting for website..." | |
sleep 1 | |
done | |
- name: Run Playwright tests | |
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |