-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (97 loc) · 3.48 KB
/
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: 'Show Variables'
on:
workflow_dispatch:
push:
jobs:
display-variables:
name: Show GitHub Variables
runs-on: ubuntu-22.04
steps:
- name: Try to show GitHub Variables
run: |
echo "repository variable : ${{ vars.REPOSITORY_VAR }}"
echo "organization variable : ${{ vars.ORGANIZATION_VAR }}"
echo "overridden variable : ${{ vars.OVERRIDE_VAR }}"
echo "variable from shell environment : $env_var"
echo "IMAGE_TAG : $vars.ENV_CONTEXT_VAR"
echo "IMAGE_TAG : $IMAGE_TAG"
echo "QUAY_URL : $QUAY_URL"
update-version:
runs-on: ubuntu-24.04
outputs:
okr-docker-image: ${{ vars.NEW_VALUE_URL }}:${{ steps.store-version.outputs.version}}-STAGING
steps:
- uses: actions/checkout@v4
with:
token: ${{secrets.VERSION_TOKEN}}
- name: Extract Maven project version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
id: store-version
- name: Set New Snapshot Version
run: mvn build-helper:parse-version versions:set -DnewVersion=${{ steps.store-version.outputs.version}}-SNAPSHOT -DgenerateBackupPoms=false
build-run-docker-image:
needs: update-version
runs-on: ubuntu-24.04
services:
cypress:
image: cypress/browsers:latest
options: --user 1001
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: ${{vars.NODE_VERSION}}
- name: Install Dependencies
run: cd ./frontend && npm ci
- name: Build frontend with Angular
run: cd ./frontend && npm run build
- name: Build backend with Maven
run: mvn -B clean package --file pom.xml -P build-for-docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
tags: ${{ needs.update-version.outputs.okr-docker-image}}
load: true
push: false
- name: print imagetags
run: echo ${{ needs.update-version.outputs.okr-docker-image}}
- name: show images
run: docker image ls -a
- name: Run docker image
run: |
docker run --network=host \
-e SPRING_PROFILES_ACTIVE=integration-test \
${{ needs.update-version.outputs.okr-docker-image}} &
- name: run keycloak docker
run: |
docker run \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=keycloak \
-v ./docker/config/realm-export.json:/opt/keycloak/data/import/realm.json \
-p 8544:8080 \
quay.io/keycloak/keycloak:23.0.1 \
start-dev --import-realm &
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
with:
wait-on: 'http://pitc.okr.localhost:8080/config, http://localhost:8544'
wait-on-timeout: 120
browser: chrome
headed: true
working-directory: frontend
config: baseUrl=http://pitc.okr.localhost:8080
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: frontend/cypress/screenshots