frschool_e2e_local #290
This file contains hidden or 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
| on: | |
| repository_dispatch: | |
| types: [frschool_e2e_local] | |
| jobs: | |
| run_tests: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| # update postgres version together with version from dockerfile in frschool/db | |
| image: 'postgres:14' | |
| env: | |
| # needs to be kept in sync with frschool/e-learning/api/.env.example | |
| POSTGRES_USER: user | |
| POSTGRES_PASSWORD: testsomething | |
| POSTGRES_DB: elearning_api_postgres | |
| # Set health checks to wait until postgres has started | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: 'frs_testing' | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.client_payload.repository }} | |
| ref: ${{ github.event.client_payload.branch_name }} | |
| token: ${{ github.event.client_payload.github_token }} | |
| path: 'frschool_source_code' | |
| - name: Choose PNPM version | |
| id: pnpm_version | |
| run: | | |
| frs_testing_pnpm_version=$(cat frs_testing/package.json | jq -r ".packageManager" | cut -d "@" -f2); | |
| frschool_source_pnpm_version=$(cat frschool_source_code/package.json | jq -r ".packageManager" | cut -d "@" -f2); | |
| chosen_pnpm_version=$(printf '%s\n' "$frs_testing_pnpm_version" "$frschool_source_pnpm_version" | sort -V | tail -1); | |
| echo "version=$(echo $chosen_pnpm_version)" >> $GITHUB_OUTPUT | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: ${{ steps.pnpm_version.outputs.version }} | |
| - uses: actions/setup-node@v3 | |
| with: | |
| cache: 'pnpm' | |
| cache-dependency-path: | | |
| frs_testing/pnpm-lock.yaml | |
| frschool_source_code/pnpm-lock.yaml | |
| node-version-file: 'frschool_source_code/.nvmrc' | |
| - run: pnpm install | |
| working-directory: ./frs_testing | |
| - run: PUPPETEER_SKIP_DOWNLOAD=true pnpm install | |
| working-directory: ./frschool_source_code | |
| - name: Install Playwright Browsers | |
| run: pnpm --filter frschool-e2e exec playwright install --with-deps | |
| working-directory: ./frs_testing | |
| - uses: cardinalby/export-env-action@v2 | |
| with: | |
| expand: true | |
| envFile: 'frschool_source_code/e-learning/api/.env.example' | |
| - uses: cardinalby/export-env-action@v2 | |
| with: | |
| expand: true | |
| envFile: 'frschool_source_code/e-learning/web/.env.example' | |
| - run: pnpm nuxt prepare | |
| working-directory: ./frschool_source_code/e-learning/web | |
| - name: Run E2E tests | |
| env: | |
| SHELL: /bin/bash | |
| id: e2e_tests | |
| run: pnpm --filter frschool-e2e e2e:ci | |
| working-directory: ./frs_testing | |
| - name: Update repo commit status | |
| if: ${{ success() || failure() }} | |
| run: | | |
| curl -L -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: token ${{ github.event.client_payload.github_token }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/${{ github.event.client_payload.repository }}/statuses/${{ github.event.client_payload.sha }} \ | |
| -d '{"state": "${{ steps.e2e_tests.outcome == 'success' && 'success' || 'failure' }}","context":"E2E tests ${{ github.event.client_payload.deploy_type }}","description":"Running E2E tests in the frs-testing repo","target_url":"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' | |
| - name: upload artifacts from playwright tests | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ success() || failure() }} | |
| with: | |
| name: frschool-playwright-report | |
| path: frs_testing/tests/frschool-e2e/playwright-report/ | |
| retention-days: 14 |