Merge branch 'master' of https://github.com/AliasBretaud/KanjiBox-front #38
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: Playwright Tests | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
jobs: | |
playwright: | |
name: End-to-end tests with Playwright | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
COMPOSE_PROJECT_NAME: kanjibox-e2e | |
BACKEND_API_URL: http://localhost:8080/kanjibox | |
AUTH0_BASE_URL: http://localhost:3000 | |
AUTH0_ISSUER_BASE_URL: ${{ secrets.AUTH0_ISSUER_BASE_URL }} | |
AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }} | |
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} | |
AUTH0_SESSION_AUTO_SAVE: ${{ secrets.AUTH0_SESSION_AUTO_SAVE }} | |
AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }} | |
OKTA_OAUTH2_AUDIENCE: ${{ secrets.OKTA_OAUTH2_AUDIENCE }} | |
OKTA_OAUTH2_ISSUER: ${{ secrets.OKTA_OAUTH2_ISSUER }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Cache Next.js builds | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Install Playwright Browsers | |
run: yarn playwright install --with-deps chromium | |
- name: Start backend processes | |
run: docker-compose -f e2e/docker-compose.yml up -d | |
- name: Wait for API container to be up | |
run: timeout 300s sh -c 'until docker ps | grep kanjibox-api | grep -q healthy; do echo "API starting..."; sleep 2; done' | |
- name: Start frontend app | |
run: | | |
yarn build | |
yarn start & | |
- name: Run Playwright tests | |
run: yarn playwright test | |
- name: Cleanup | |
run: docker-compose -f e2e/docker-compose.yml down -v |