-
Notifications
You must be signed in to change notification settings - Fork 3
89 lines (76 loc) · 2.46 KB
/
frontend-test-action.yml
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
name: 'Frontend tests'
on: [push]
jobs:
unit-tests:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{vars.NODE_VERSION}}
- name: Npm install
run: npm ci
- name: Run unit tests
run: npm test
get-e2e-files:
runs-on: ubuntu-24.04
outputs:
file_list: ${{ steps.generate-file-list.outputs.file_list }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate file list
id: generate-file-list
run: |
FILES=$(ls frontend/cypress/e2e | jq -R . | jq -s . | jq -c)
echo $FILES
echo "file_list=$FILES" >> $GITHUB_OUTPUT
e2e:
needs: get-e2e-files
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
file: ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{vars.JAVA_VERSION}}
uses: actions/setup-java@v4
with:
java-version: ${{vars.JAVA_VERSION}}
distribution: 'temurin'
- name: run keycloak docker
run: |
docker run -d \
--name my_keycloak \
-e KC_BOOTSTRAP_ADMIN_USERNAME=admin26 \
-e KC_BOOTSTRAP_ADMIN_PASSWORD=keycloak26 \
-v ./docker/config/realm-export-pitc.json:/opt/keycloak/data/import/realm-pitc.json \
-p 8544:8080 \
quay.io/keycloak/keycloak:26.0.1 \
start-dev --import-realm
- name: start backend
run: cd ./backend && mvn spring-boot:run -Dspring-boot.run.profiles=integration-test &
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
with:
working-directory: frontend
start: npm start
wait-on: 'http://pitc.okr.localhost:8080/config, http://pitc.okr.localhost:4200, http://localhost:8544'
wait-on-timeout: 120
browser: chrome
headed: false
spec: cypress/e2e/${{ matrix.file }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots for ${{ matrix.file }}
path: frontend/cypress/screenshots
- name: remove docker containers
run: docker ps -aq | xargs -r docker rm -f