-
Notifications
You must be signed in to change notification settings - Fork 145
148 lines (131 loc) · 4.58 KB
/
cypress.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Cypress
on:
push:
branches: [main, release/**]
pull_request:
branches: [main, release/**]
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
inputs:
keycloakRepo:
description: The location of the Keycloak repo (e.g. keycloak/keycloak).
required: false
keycloakBranch:
description: The branch to check out for the Keycloak repo (e.g. main).
required: false
concurrency:
# Only cancel jobs for new commits on PRs, and always do a complete run on other branches (e.g. `main`).
# See: https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
group: cypress-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-keycloak:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
path: admin-ui-repo
- name: Check out Keycloak Server
uses: actions/checkout@v4
with:
repository: ${{ inputs.keycloakRepo || 'keycloak/keycloak' }}
ref: ${{ inputs.keycloakBranch || (contains(github.ref, 'release/') && github.ref || 'main') }}
path: keycloak-repo
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
check-latest: true
cache: maven
- name: Build Admin UI
working-directory: admin-ui-repo
run: mvn clean install --batch-mode --file keycloak-theme/pom.xml
- name: Build Keycloak Server
working-directory: keycloak-repo
run: |
mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipCommon -DskipAccount2 -Pdistribution
mv quarkus/dist/target/keycloak-999.0.0-SNAPSHOT.tar.gz ../keycloak-999.0.0-SNAPSHOT.tar.gz
- name: Upload Keycloak server
uses: actions/upload-artifact@v3
with:
name: keycloak
path: keycloak-999.0.0-SNAPSHOT.tar.gz
install-nightly:
if: ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download Keycloak
id: extract-server
run: |
gh release -R keycloak/keycloak download nightly -p keycloak-999.0.0-SNAPSHOT.tar.gz
- name: Upload Keycloak server
uses: actions/upload-artifact@v3
with:
name: keycloak
path: keycloak-999.0.0-SNAPSHOT.tar.gz
test:
needs: [build-keycloak, install-nightly]
if: always() && ( needs.build-keycloak.result == 'success' || needs.install-nightly.result == 'success' )
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [1, 2, 3, 4, 5]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: npm
- name: Install dependencies
run: npm ci
- name: Compile Admin Client
run: npm run build --workspace=@keycloak/keycloak-admin-client
- name: Restore Keycloak server
uses: actions/download-artifact@v3
with:
name: keycloak
- name: Start LDAP server
run: npm run cy:ldap-server &
working-directory: apps/admin-ui
- name: Start Keycloak Server
run: |
tar xfvz keycloak-999.0.0-SNAPSHOT.tar.gz
keycloak-999.0.0-SNAPSHOT/bin/kc.sh start-dev --features=admin2,admin-fine-grained-authz,declarative-user-profile &> ~/server.log &
env:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
- name: Install Google Chrome
uses: abhi1693/[email protected]
with:
browser: chrome
version: latest
- name: Run Cypress
uses: cypress-io/github-action@v6
continue-on-error: true
with:
install: false
record: true
parallel: true
browser: chrome
wait-on: http://localhost:8080
working-directory: apps/admin-ui
env:
CYPRESS_BASE_URL: http://localhost:8080/admin/
CYPRESS_KEYCLOAK_SERVER: http://localhost:8080
CYPRESS_RECORD_KEY: b8f1d15e-eab8-4ee7-8e44-c6d7cd8fc0eb
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload server logs
uses: actions/upload-artifact@v3
with:
name: server-log-${{ matrix.container }}
path: ~/server.log