-
Notifications
You must be signed in to change notification settings - Fork 137
123 lines (103 loc) · 3.35 KB
/
maven.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
121
122
123
name: Build
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: temurin
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: maven
- name: Build and test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# mvn install instead of verify for sonar-fork-analysis to work
run: mvn -B install -P code-coverage
- name: Prepare Sonar analysis
uses: ./.github/actions/sonar-fork-analysis
- name: Upload plugin jar
uses: actions/upload-artifact@v4
with:
name: plugin-jar-file
path: target/*.jar
e2e:
needs: build
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download plugin jar
uses: actions/download-artifact@v4
with:
name: plugin-jar-file
path: target
- name: Cache node_modules
id: cache-nodemodules
uses: actions/cache@v4
with:
path: |
~/.cache/Cypress
docker/e2e/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Start containers
working-directory: docker
run: |
docker compose up -d --build \
&& ./wait-until "curl -sLf -o /dev/null http://localhost:8024/realms/master" 300
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install dependencies
working-directory: docker/e2e
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm install
- name: Run e2e tests
working-directory: docker/e2e
# Video recording turned off due to free GitHub CI runners seemingly not being powerful enough for it.
# Headed Chrome used to minimize issues with tests failing for no reason.
run: npx cypress run --headed --browser electron --config video=false
- name: Archive videos
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: docker/e2e/cypress/videos
- name: Archive screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: docker/e2e/cypress/screenshots
- name: Display 'docker ps'
if: always()
run: docker ps
- name: Display legacy system logs
if: always()
run: docker logs keycloak_migration_demo-legacy-system-example-1
- name: Display Keycloak logs
if: always()
run: docker logs keycloak_migration_demo-keycloak-1
- name: Stop containers
if: always()
working-directory: docker
run: docker compose down