2021-07-30 18:12:32 +00:00
|
|
|
name: Cypress
|
2021-01-12 17:04:52 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-11-02 08:04:19 +00:00
|
|
|
branches: [main]
|
2021-01-12 17:04:52 +00:00
|
|
|
pull_request:
|
2021-11-02 08:04:19 +00:00
|
|
|
branches: [main]
|
2021-01-12 17:04:52 +00:00
|
|
|
jobs:
|
|
|
|
cypress-run:
|
|
|
|
runs-on: ubuntu-latest
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: ${{ env.ADMIN_UI_PATH }}
|
|
|
|
|
|
|
|
- name: Check out Keycloak Server
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: keycloak/keycloak
|
|
|
|
path: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
|
|
|
|
- name: Set up Java
|
|
|
|
uses: actions/setup-java@v2
|
|
|
|
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-02-24 10:31:06 +00:00
|
|
|
run: mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipAccount2 -Pdistribution,admin-preview
|
2021-09-24 12:41:34 +00:00
|
|
|
|
|
|
|
- name: Configure distribution path
|
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
run: |
|
|
|
|
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
2022-03-06 15:25:37 +00:00
|
|
|
tar -xvf quarkus/dist/target/keycloak-$VERSION.tar.gz -C quarkus/dist/target/
|
|
|
|
echo "KEYCLOAK_SERVER_BIN=keycloak-server/quarkus/dist/target/keycloak-$VERSION/bin" >> $GITHUB_ENV
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 12:41:34 +00:00
|
|
|
- name: Start Keycloak Server
|
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_BIN }}
|
2022-03-22 11:01:32 +00:00
|
|
|
run: ./kc.sh start-dev -Dkeycloak.profile.feature.admin2=enabled -Dkeycloak.profile.feature.declarative_user_profile=enabled &
|
|
|
|
env:
|
|
|
|
KEYCLOAK_ADMIN: admin
|
|
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 13:47:36 +00:00
|
|
|
- name: Set up Node
|
2021-07-30 18:12:32 +00:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-11-20 12:55:00 +00:00
|
|
|
node-version: 16
|
2021-07-30 18:12:32 +00:00
|
|
|
check-latest: true
|
2021-08-25 14:00:44 +00:00
|
|
|
cache: npm
|
2021-09-24 12:41:34 +00:00
|
|
|
cache-dependency-path: ${{ env.ADMIN_UI_PATH }}/package-lock.json
|
2021-07-30 18:12:32 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2021-09-24 12:41:34 +00:00
|
|
|
working-directory: ${{ env.ADMIN_UI_PATH }}
|
2021-07-30 18:12:32 +00:00
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run Cypress
|
2021-09-24 12:41:34 +00:00
|
|
|
working-directory: ${{ env.ADMIN_UI_PATH }}
|
2022-03-06 15:25:37 +00:00
|
|
|
run: CYPRESS_BASE_URL=http://localhost:8080/admin/ CYPRESS_KEYCLOAK_SERVER=http://localhost:8080 npm run start:cypress-tests
|
2021-07-30 18:12:32 +00:00
|
|
|
|
|
|
|
- name: Add Cypress videos artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: cypress-videos
|
2021-09-24 12:41:34 +00:00
|
|
|
path: ${{ env.ADMIN_UI_PATH }}/assets/videos
|
2021-07-30 18:12:32 +00:00
|
|
|
|
|
|
|
- name: Add Cypress screenshots artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: cypress-screenshots
|
2021-09-24 12:41:34 +00:00
|
|
|
path: ${{ env.ADMIN_UI_PATH }}/assets/screenshots
|