Skip to content

feat: adds playwright e2e testing to web app #450

feat: adds playwright e2e testing to web app

feat: adds playwright e2e testing to web app #450

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: true
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
NX_BRANCH: ${{ github.event.number || github.ref_name }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
main:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout [Pull Request]
if: ${{ github.event_name == 'pull_request' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/checkout@v3
name: Checkout [Default Branch]
if: ${{ github.event_name != 'pull_request' }}
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'main'
- uses: pnpm/[email protected]
with:
version: 8.6.1
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps
- name: Initialize the Nx Cloud distributed CI run
run: pnpm nx-cloud start-ci-run
- name: Run commands in parallel
run: |
pids=()
# list of commands to be run on main has env flag NX_CLOUD_DISTRIBUTED_EXECUTION set to false
NX_CLOUD_DISTRIBUTED_EXECUTION=false pnpm nx-cloud record -- pnpm nx format:check & pids+=($!)
pnpm nx affected -t lint --parallel=3 & pids+=($!)
pnpm nx affected -t typecheck --parallel=3 & pids+=($!)
# We need run-many here to output the files so that codecov can pick them up
pnpm nx run-many -t test:coverage --parallel=3 & pids+=($!)
pnpm nx affected -t e2e --parallel=3 & pids+=($!)
pnpm nx affected -t build-storybook --parallel=3 & pids+=($!)
pnpm nx affected -t build --parallel=3 & pids+=($!)
# run all commands in parallel and bail if one of them fails
for pid in "${pids[@]}"; do
if ! wait $pid; then
echo "Process $pid failed"
exit 1
fi
done
exit 0
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Stop all running agents for this CI run
if: ${{ always() }}
run: pnpm nx-cloud stop-all-agents
agents:
name: Agent ${{ matrix.agent }}
runs-on: ubuntu-latest
strategy:
matrix:
agent: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 8.6.1
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps
- name: Start Nx Agent ${{ matrix.agent }}
run: pnpm nx-cloud start-agent
env:
NX_AGENT_NAME: ${{matrix.agent}}