keycloak-scim/.github/workflows/cypress.yml
2022-03-18 17:19:24 +01:00

86 lines
2.9 KiB
YAML

name: Cypress
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
cypress-run:
runs-on: ubuntu-latest
env:
ADMIN_UI_PATH: admin-ui
KEYCLOAK_SERVER_PATH: keycloak-server
steps:
- 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
- name: Build Keycloak Server
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
run: mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipAccount2 -Pdistribution,admin-preview
- name: Configure distribution path
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
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
- name: Start Keycloak Server
working-directory: ${{ env.KEYCLOAK_SERVER_BIN }}
run: |
KEYCLOAK_ADMIN=admin KEYCLOAK_ADMIN_PASSWORD=admin ./kc.sh start-dev --proxy=none -Dkeycloak.profile.feature.admin2=enabled -Dkeycloak.profile.feature.declarative_user_profile=enabled &
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 16
check-latest: true
cache: npm
cache-dependency-path: ${{ env.ADMIN_UI_PATH }}/package-lock.json
- name: Install dependencies
working-directory: ${{ env.ADMIN_UI_PATH }}
run: npm ci
- name: Run Cypress
working-directory: ${{ env.ADMIN_UI_PATH }}
run: CYPRESS_BASE_URL=http://localhost:8080/admin/ CYPRESS_KEYCLOAK_SERVER=http://localhost:8080 npm run start:cypress-tests
- name: Add Cypress videos artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-videos
path: ${{ env.ADMIN_UI_PATH }}/assets/videos
- name: Add Cypress screenshots artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-screenshots
path: ${{ env.ADMIN_UI_PATH }}/assets/screenshots