2021-07-30 18:12:32 +00:00
|
|
|
name: Cypress
|
2022-07-15 19:14:32 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
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
|
2021-01-12 17:04:52 +00:00
|
|
|
jobs:
|
2022-04-11 14:18:24 +00:00
|
|
|
setup:
|
2021-01-12 17:04:52 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-04-11 14:18:24 +00:00
|
|
|
outputs:
|
|
|
|
server-path: ${{ steps.extract-server.outputs.path }}
|
2021-09-24 12:41:34 +00:00
|
|
|
env:
|
|
|
|
ADMIN_UI_PATH: admin-ui
|
|
|
|
KEYCLOAK_SERVER_PATH: keycloak-server
|
2021-01-12 17:04:52 +00:00
|
|
|
steps:
|
2021-09-24 12:41:34 +00:00
|
|
|
- name: Check out Admin UI
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
|
|
|
path: ${{ env.ADMIN_UI_PATH }}
|
|
|
|
|
|
|
|
- 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:
|
2022-09-08 13:18:35 +00:00
|
|
|
repository: ${{ inputs.keycloakRepo || 'keycloak/keycloak' }}
|
|
|
|
ref: ${{ inputs.keycloakBranch || 'main' }}
|
2021-09-24 12:41:34 +00:00
|
|
|
path: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
# See https://issues.redhat.com/browse/KEYCLOAK-17812
|
|
|
|
- name: Update Maven settings
|
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
run: cp .github/settings.xml ~/.m2
|
|
|
|
|
|
|
|
- name: Build Admin UI
|
|
|
|
working-directory: ${{ env.ADMIN_UI_PATH }}
|
|
|
|
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
|
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
2022-08-22 13:29:39 +00:00
|
|
|
run: mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipCommon -DskipAccount2 -Pdistribution
|
2021-09-24 12:41:34 +00:00
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- name: Extract Keycloak server
|
|
|
|
id: extract-server
|
2021-09-24 12:41:34 +00:00
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
run: |
|
|
|
|
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
2022-04-11 14:18:24 +00:00
|
|
|
mkdir ../server
|
|
|
|
tar -xvf quarkus/dist/target/keycloak-$VERSION.tar.gz -C ../server
|
|
|
|
echo "::set-output name=path::server/keycloak-$VERSION"
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- name: Cache Keycloak server
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ${{ steps.extract-server.outputs.path }}
|
|
|
|
key: ${{ github.sha }}
|
|
|
|
|
|
|
|
test:
|
|
|
|
needs: setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
containers: [1, 2, 3, 4, 5]
|
|
|
|
steps:
|
|
|
|
- name: Check out Admin UI
|
|
|
|
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-04-11 14:18:24 +00:00
|
|
|
- name: Restore Keycloak server
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ${{ needs.setup.outputs.server-path }}
|
|
|
|
key: ${{ github.sha }}
|
|
|
|
|
|
|
|
- name: Start Keycloak Server
|
|
|
|
working-directory: ${{ needs.setup.outputs.server-path }}/bin
|
2022-08-25 09:03:07 +00:00
|
|
|
run: ./kc.sh start-dev --features=admin2,admin-fine-grained-authz,declarative-user-profile &
|
2022-04-11 14:18:24 +00:00
|
|
|
env:
|
|
|
|
KEYCLOAK_ADMIN: admin
|
|
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
|
|
|
|
2021-07-30 18:12:32 +00:00
|
|
|
- name: Run Cypress
|
2022-06-13 10:08:13 +00:00
|
|
|
uses: cypress-io/github-action@v4
|
2022-04-11 14:18:24 +00:00
|
|
|
with:
|
|
|
|
install: false
|
|
|
|
record: true
|
|
|
|
parallel: true
|
|
|
|
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 }}
|