-
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (90 loc) · 3.86 KB
/
frschool-e2e-local.yml
File metadata and controls
96 lines (90 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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