2021-07-30 18:12:32 +00:00
|
|
|
name: Cypress
|
2022-07-15 19:14:32 +00:00
|
|
|
on:
|
|
|
|
push:
|
2022-12-01 12:07:17 +00:00
|
|
|
branches: [main, release/**]
|
2022-07-15 19:14:32 +00:00
|
|
|
pull_request:
|
2022-12-01 12:07:17 +00:00
|
|
|
branches: [main, release/**]
|
2022-09-13 08:58:27 +00:00
|
|
|
schedule:
|
|
|
|
- cron: '0 4 * * *'
|
2022-09-08 13:07:10 +00:00
|
|
|
workflow_dispatch:
|
2022-09-08 13:18:35 +00:00
|
|
|
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
|
2022-10-10 12:04:50 +00:00
|
|
|
concurrency:
|
2022-11-29 10:57:10 +00:00
|
|
|
# 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
|
2022-11-30 13:26:03 +00:00
|
|
|
group: cypress-${{ github.head_ref || github.run_id }}
|
2022-10-10 12:04:50 +00:00
|
|
|
cancel-in-progress: true
|
2021-01-12 17:04:52 +00:00
|
|
|
jobs:
|
2022-09-13 08:58:27 +00:00
|
|
|
build-keycloak:
|
|
|
|
if: ${{ github.event_name != 'schedule' }}
|
2021-01-12 17:04:52 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-12-01 11:16:10 +00:00
|
|
|
- name: Check out repository
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
2022-09-13 08:58:27 +00:00
|
|
|
path: admin-ui-repo
|
2021-09-24 12:41:34 +00:00
|
|
|
|
|
|
|
- name: Check out Keycloak Server
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
2023-02-23 09:07:53 +00:00
|
|
|
repository: ${{ inputs.keycloakRepo || 'keycloak/keycloak' }}
|
|
|
|
ref: ${{ inputs.keycloakBranch || (contains(github.ref, 'release/') && github.ref || 'main') }}
|
2022-09-13 08:58:27 +00:00
|
|
|
path: keycloak-repo
|
2021-09-24 12:41:34 +00:00
|
|
|
|
|
|
|
- name: Set up Java
|
2022-04-11 04:23:56 +00:00
|
|
|
uses: actions/setup-java@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
|
|
|
distribution: temurin
|
|
|
|
java-version: 11
|
|
|
|
check-latest: true
|
|
|
|
cache: maven
|
|
|
|
|
|
|
|
- name: Build Admin UI
|
2022-09-13 08:58:27 +00:00
|
|
|
working-directory: admin-ui-repo
|
2021-09-24 12:41:34 +00:00
|
|
|
run: mvn clean install --batch-mode --file keycloak-theme/pom.xml
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 12:41:34 +00:00
|
|
|
- name: Build Keycloak Server
|
2022-09-13 08:58:27 +00:00
|
|
|
working-directory: keycloak-repo
|
2021-09-24 12:41:34 +00:00
|
|
|
run: |
|
2022-09-13 08:58:27 +00:00
|
|
|
mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipCommon -DskipAccount2 -Pdistribution
|
|
|
|
mv quarkus/dist/target/keycloak-999-SNAPSHOT.tar.gz ../keycloak-999-SNAPSHOT.tar.gz
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2022-09-13 08:58:27 +00:00
|
|
|
- name: Upload Keycloak server
|
|
|
|
uses: actions/upload-artifact@v3
|
2022-04-11 14:18:24 +00:00
|
|
|
with:
|
2022-09-13 08:58:27 +00:00
|
|
|
name: keycloak
|
|
|
|
path: keycloak-999-SNAPSHOT.tar.gz
|
|
|
|
|
|
|
|
install-nightly:
|
|
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2022-09-14 05:45:53 +00:00
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-09-13 08:58:27 +00:00
|
|
|
steps:
|
|
|
|
- name: Download Keycloak
|
|
|
|
id: extract-server
|
|
|
|
run: |
|
|
|
|
gh release -R keycloak/keycloak download nightly -p keycloak-999-SNAPSHOT.tar.gz
|
|
|
|
|
|
|
|
- name: Upload Keycloak server
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: keycloak
|
|
|
|
path: keycloak-999-SNAPSHOT.tar.gz
|
2022-04-11 14:18:24 +00:00
|
|
|
|
|
|
|
test:
|
2022-09-13 08:58:27 +00:00
|
|
|
needs: [build-keycloak, install-nightly]
|
|
|
|
if: always() && ( needs.build-keycloak.result == 'success' || needs.install-nightly.result == 'success' )
|
2022-04-11 14:18:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-10-10 12:04:50 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-11-18 17:41:08 +00:00
|
|
|
container: [1, 2, 3, 4, 5]
|
2022-04-11 14:18:24 +00:00
|
|
|
steps:
|
2022-12-01 11:16:10 +00:00
|
|
|
- name: Check out repository
|
2022-04-11 14:18:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 13:47:36 +00:00
|
|
|
- name: Set up Node
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-30 18:12:32 +00:00
|
|
|
with:
|
2022-04-21 14:52:49 +00:00
|
|
|
node-version: 18
|
2021-07-30 18:12:32 +00:00
|
|
|
check-latest: true
|
2021-08-25 14:00:44 +00:00
|
|
|
cache: npm
|
2022-04-11 14:18:24 +00:00
|
|
|
|
2021-07-30 18:12:32 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
2022-11-08 14:01:11 +00:00
|
|
|
- name: Compile Admin Client
|
|
|
|
run: npm run build --workspace=@keycloak/keycloak-admin-client
|
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- name: Restore Keycloak server
|
2022-09-13 08:58:27 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2022-04-11 14:18:24 +00:00
|
|
|
with:
|
2022-09-13 08:58:27 +00:00
|
|
|
name: keycloak
|
2022-04-11 14:18:24 +00:00
|
|
|
|
2022-10-27 13:49:10 +00:00
|
|
|
- name: Start LDAP server
|
|
|
|
run: npm run cy:ldap-server &
|
|
|
|
working-directory: apps/admin-ui
|
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- name: Start Keycloak Server
|
2022-09-13 08:58:27 +00:00
|
|
|
run: |
|
|
|
|
tar xfvz keycloak-999-SNAPSHOT.tar.gz
|
2022-11-18 17:41:08 +00:00
|
|
|
keycloak-999-SNAPSHOT/bin/kc.sh start-dev --features=admin2,admin-fine-grained-authz,declarative-user-profile &> ~/server.log &
|
2022-04-11 14:18:24 +00:00
|
|
|
env:
|
|
|
|
KEYCLOAK_ADMIN: admin
|
|
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
|
|
|
|
2022-12-07 16:49:59 +00:00
|
|
|
- name: Install Google Chrome
|
2022-12-12 09:32:45 +00:00
|
|
|
uses: abhi1693/setup-browser@v0.3.5
|
2022-12-07 16:49:59 +00:00
|
|
|
with:
|
|
|
|
browser: chrome
|
|
|
|
version: latest
|
|
|
|
|
2021-07-30 18:12:32 +00:00
|
|
|
- name: Run Cypress
|
2022-12-06 13:58:19 +00:00
|
|
|
uses: cypress-io/github-action@v5
|
2022-11-24 13:37:14 +00:00
|
|
|
continue-on-error: true
|
2022-04-11 14:18:24 +00:00
|
|
|
with:
|
|
|
|
install: false
|
|
|
|
record: true
|
2022-10-10 12:04:50 +00:00
|
|
|
parallel: true
|
2022-04-11 14:18:24 +00:00
|
|
|
browser: chrome
|
|
|
|
wait-on: http://localhost:8080
|
2022-08-25 09:03:07 +00:00
|
|
|
working-directory: apps/admin-ui
|
2022-04-11 14:18:24 +00:00
|
|
|
env:
|
|
|
|
CYPRESS_BASE_URL: http://localhost:8080/admin/
|
|
|
|
CYPRESS_KEYCLOAK_SERVER: http://localhost:8080
|
2022-07-25 17:33:49 +00:00
|
|
|
CYPRESS_RECORD_KEY: b8f1d15e-eab8-4ee7-8e44-c6d7cd8fc0eb
|
2022-04-11 14:18:24 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-11-18 17:41:08 +00:00
|
|
|
|
|
|
|
- name: Upload server logs
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: server-log-${{ matrix.container }}
|
|
|
|
path: ~/server.log
|