Keycloak

Форк
0
358 строк · 9.3 Кб
1
name: Keycloak JavaScript CI
2

3
on:
4
  push:
5
    branches-ignore:
6
      - main
7
      - dependabot/**
8
      - quarkus-next
9
  pull_request:
10
  workflow_dispatch:
11

12
env:
13
  MAVEN_ARGS: "-B -nsu -Daether.connector.http.connectionMaxTtl=25"
14

15
concurrency:
16
  # Only cancel jobs for PR updates
17
  group: js-ci-${{ github.ref }}
18
  cancel-in-progress: true
19

20
defaults:
21
  run:
22
    shell: bash
23

24
jobs:
25
  conditional:
26
    name: Check conditional workflows and jobs
27
    runs-on: ubuntu-latest
28
    outputs:
29
      js-ci: ${{ steps.conditional.outputs.js }}
30
    steps:
31
      - uses: actions/checkout@v4
32

33
      - id: conditional
34
        uses: ./.github/actions/conditional
35
        with:
36
          token: ${{ secrets.GITHUB_TOKEN }}
37

38
  build-keycloak:
39
    name: Build Keycloak
40
    needs: conditional
41
    if: needs.conditional.outputs.js-ci == 'true'
42
    runs-on: ubuntu-latest
43
    steps:
44
      - uses: actions/checkout@v4
45

46
      - name: Setup Java
47
        uses: actions/setup-java@v4
48
        with:
49
          distribution: temurin
50
          java-version: 17
51
          check-latest: true
52
          cache: maven
53

54
      - name: Build Keycloak
55
        run: |
56
          ./mvnw clean install --errors -DskipTests -DskipTestsuite -DskipExamples -Pdistribution
57
          mv ./quarkus/dist/target/keycloak-999.0.0-SNAPSHOT.tar.gz ./keycloak-999.0.0-SNAPSHOT.tar.gz
58

59
      - name: Upload Keycloak dist
60
        uses: actions/upload-artifact@v3
61
        with:
62
          name: keycloak
63
          path: keycloak-999.0.0-SNAPSHOT.tar.gz
64

65
  admin-client:
66
    name: Admin Client
67
    needs: conditional
68
    if: needs.conditional.outputs.js-ci == 'true'
69
    runs-on: ubuntu-latest
70
    env:
71
      WORKSPACE: "@keycloak/keycloak-admin-client"
72
    steps:
73
      - uses: actions/checkout@v4
74

75
      - uses: ./.github/actions/pnpm-setup
76
        with:
77
          working-directory: js
78

79
      - run: pnpm --filter ${{ env.WORKSPACE }} run lint
80
        working-directory: js
81

82
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
83
        working-directory: js
84

85
  keycloak-js:
86
    name: Keycloak JS
87
    needs: conditional
88
    if: needs.conditional.outputs.js-ci == 'true'
89
    runs-on: ubuntu-latest
90
    env:
91
      WORKSPACE: keycloak-js
92
    steps:
93
      - uses: actions/checkout@v4
94

95
      - uses: ./.github/actions/pnpm-setup
96
        with:
97
          working-directory: js
98

99
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
100
        working-directory: js
101

102
  keycloak-masthead:
103
    name: Keycloak Masthead
104
    needs: conditional
105
    if: needs.conditional.outputs.js-ci == 'true'
106
    runs-on: ubuntu-latest
107
    env:
108
      WORKSPACE: keycloak-masthead
109
    steps:
110
      - uses: actions/checkout@v4
111

112
      - uses: ./.github/actions/pnpm-setup
113
        with:
114
          working-directory: js
115

116
      - run: pnpm --filter ${{ env.WORKSPACE }} run lint
117
        working-directory: js
118

119
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
120
        working-directory: js
121

122
  ui-shared:
123
    name: UI Shared
124
    needs: conditional
125
    if: needs.conditional.outputs.js-ci == 'true'
126
    runs-on: ubuntu-latest
127
    env:
128
      WORKSPACE: ui-shared
129
    steps:
130
      - uses: actions/checkout@v4
131

132
      - uses: ./.github/actions/pnpm-setup
133
        with:
134
          working-directory: js
135

136
      - run: pnpm --filter ${{ env.WORKSPACE }} run lint
137
        working-directory: js
138

139
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
140
        working-directory: js
141

142
  account-ui:
143
    name: Account UI
144
    needs: conditional
145
    if: needs.conditional.outputs.js-ci == 'true'
146
    runs-on: ubuntu-latest
147
    env:
148
      WORKSPACE: account-ui
149
    steps:
150
      - uses: actions/checkout@v4
151

152
      - uses: ./.github/actions/pnpm-setup
153
        with:
154
          working-directory: js
155

156
      - run: pnpm --filter ${{ env.WORKSPACE }} run lint
157
        working-directory: js
158

159
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
160
        working-directory: js
161

162
  admin-ui:
163
    name: Admin UI
164
    needs: conditional
165
    if: needs.conditional.outputs.js-ci == 'true'
166
    runs-on: ubuntu-latest
167
    env:
168
      WORKSPACE: admin-ui
169
    steps:
170
      - uses: actions/checkout@v4
171

172
      - uses: ./.github/actions/pnpm-setup
173
        with:
174
          working-directory: js
175

176
      - run: pnpm --filter ${{ env.WORKSPACE }} run lint
177
        working-directory: js
178

179
      - run: pnpm --filter ${{ env.WORKSPACE }} run test
180
        working-directory: js
181

182
      - run: pnpm --filter ${{ env.WORKSPACE }} run build
183
        working-directory: js
184

185
      - run: pnpm --filter ${{ env.WORKSPACE }} run cy:check-types
186
        working-directory: js
187

188
  account-ui-e2e:
189
    name: Account UI E2E
190
    needs:
191
      - conditional
192
      - build-keycloak
193
    if: needs.conditional.outputs.js-ci == 'true'
194
    runs-on: ubuntu-latest
195
    env:
196
      WORKSPACE: account-ui
197
    steps:
198
      - uses: actions/checkout@v4
199

200
      - uses: ./.github/actions/pnpm-setup
201
        with:
202
          working-directory: js
203

204
      - name: Download Keycloak server
205
        uses: actions/download-artifact@v3
206
        with:
207
          name: keycloak
208

209
      - name: Setup Java
210
        uses: actions/setup-java@v4
211
        with:
212
          distribution: temurin
213
          java-version: 17
214

215
      - name: Start Keycloak server
216
        run: |
217
          tar xfvz keycloak-999.0.0-SNAPSHOT.tar.gz
218
          keycloak-999.0.0-SNAPSHOT/bin/kc.sh start-dev --features=transient-users &> ~/server.log &
219
        env:
220
          KEYCLOAK_ADMIN: admin
221
          KEYCLOAK_ADMIN_PASSWORD: admin
222

223
      - name: Install Playwright browsers
224
        run: pnpm --filter ${{ env.WORKSPACE }} exec playwright install --with-deps
225
        working-directory: js
226

227
      - name: Run Playwright tests
228
        run: pnpm --filter ${{ env.WORKSPACE }} run test
229
        working-directory: js
230
        env:
231
          KEYCLOAK_SERVER: http://localhost:8080
232

233
      - uses: actions/upload-artifact@v3
234
        if: always()
235
        with:
236
          name: account-ui-playwright-report
237
          path: js/apps/${{ env.WORKSPACE }}/playwright-report
238
          retention-days: 30
239

240
      - name: Upload server logs
241
        if: always()
242
        uses: actions/upload-artifact@v3
243
        with:
244
          name: account-ui-server-log
245
          path: ~/server.log
246

247

248
  admin-ui-e2e:
249
    name: Admin UI E2E
250
    needs:
251
      - conditional
252
      - build-keycloak
253
    if: needs.conditional.outputs.js-ci == 'true' && github.repository == 'keycloak/keycloak'
254
    runs-on: ubuntu-latest
255
    env:
256
      WORKSPACE: admin-ui
257
    strategy:
258
      matrix:
259
        container: [1, 2, 3, 4, 5]
260
        browser: [chrome, firefox]
261
        exclude:
262
          # Only test with Firefox on scheduled runs
263
          - browser: ${{ github.event_name != 'workflow_dispatch' && 'firefox' || '' }}
264
    steps:
265
      - uses: actions/checkout@v4
266

267
      - name: Install Google Chrome
268
        if: matrix.browser == 'chrome'
269
        uses: browser-actions/setup-chrome@v1
270
        with:
271
          chrome-version: stable
272

273
      - name: Install Firefox
274
        if: matrix.browser == 'firefox'
275
        uses: browser-actions/setup-firefox@v1
276
        with:
277
          firefox-version: latest
278

279
      - uses: ./.github/actions/pnpm-setup
280
        with:
281
          working-directory: js
282

283
      - name: Compile Admin Client
284
        run: pnpm --filter @keycloak/keycloak-admin-client run build
285
        working-directory: js
286

287
      - name: Download Keycloak server
288
        uses: actions/download-artifact@v3
289
        with:
290
          name: keycloak
291

292
      - name: Setup Java
293
        uses: actions/setup-java@v4
294
        with:
295
          distribution: temurin
296
          java-version: 17
297

298
      - name: Start Keycloak server
299
        run: |
300
          tar xfvz keycloak-999.0.0-SNAPSHOT.tar.gz
301
          keycloak-999.0.0-SNAPSHOT/bin/kc.sh start-dev --features=admin-fine-grained-authz,transient-users &> ~/server.log &
302
        env:
303
          KEYCLOAK_ADMIN: admin
304
          KEYCLOAK_ADMIN_PASSWORD: admin
305

306
      - name: Start LDAP server
307
        run: pnpm --filter ${{ env.WORKSPACE }} run cy:ldap-server &
308
        working-directory: js
309

310
      - name: Run Cypress
311
        uses: cypress-io/github-action@v6
312
        with:
313
          install: false
314
          browser: ${{ matrix.browser }} 
315
          wait-on: http://localhost:8080
316
          working-directory: js/apps/admin-ui
317
        env:
318
          CYPRESS_BASE_URL: http://localhost:8080/admin/
319
          CYPRESS_KEYCLOAK_SERVER: http://localhost:8080
320
          SPLIT: ${{ strategy.job-total }}
321
          SPLIT_INDEX: ${{ strategy.job-index }}
322

323
      - name: Upload server logs
324
        if: always()
325
        uses: actions/upload-artifact@v3
326
        with:
327
          name: admin-ui-server-log-${{ matrix.container }}-${{ matrix.browser }}
328
          path: ~/server.log
329

330
      - name: Upload Cypress videos
331
        uses: actions/upload-artifact@v3
332
        if: always() && github.repository != 'keycloak/keycloak-private'
333
        with:
334
          name: cypress-videos-${{ matrix.container }}-${{ matrix.browser }}
335
          path: js/apps/admin-ui/cypress/videos
336
          if-no-files-found: ignore
337
          retention-days: 10
338

339
  check:
340
    name: Status Check - Keycloak JavaScript CI
341
    if: always()
342
    needs:
343
      - conditional
344
      - build-keycloak
345
      - admin-client
346
      - keycloak-js
347
      - keycloak-masthead
348
      - ui-shared
349
      - account-ui
350
      - account-ui-e2e
351
      - admin-ui
352
      - admin-ui-e2e
353
    runs-on: ubuntu-latest
354
    steps:
355
      - uses: actions/checkout@v4
356
      - uses: ./.github/actions/status-check
357
        with:
358
          jobs: ${{ toJSON(needs) }}
359

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.