110 lines
3.3 KiB
YAML
110 lines
3.3 KiB
YAML
name: Cypress
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
server-path: ${{ steps.extract-server.outputs.path }}
|
|
env:
|
|
ADMIN_UI_PATH: admin-ui
|
|
KEYCLOAK_SERVER_PATH: keycloak-server
|
|
steps:
|
|
- name: Check out Admin UI
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ${{ env.ADMIN_UI_PATH }}
|
|
|
|
- name: Check out Keycloak Server
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: keycloak/keycloak
|
|
path: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v3
|
|
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 -DskipCommon -DskipAccount2 -Pdistribution
|
|
|
|
- name: Extract Keycloak server
|
|
id: extract-server
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
run: |
|
|
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
|
mkdir ../server
|
|
tar -xvf quarkus/dist/target/keycloak-$VERSION.tar.gz -C ../server
|
|
echo "::set-output name=path::server/keycloak-$VERSION"
|
|
|
|
- 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
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
check-latest: true
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- 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
|
|
run: ./kc.sh start-dev --features=admin2,admin-fine-grained-authz,declarative-user-profile &
|
|
env:
|
|
KEYCLOAK_ADMIN: admin
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
|
|
|
- name: Run Cypress
|
|
uses: cypress-io/github-action@v4
|
|
with:
|
|
install: false
|
|
record: true
|
|
parallel: true
|
|
browser: chrome
|
|
wait-on: http://localhost:8080
|
|
working-directory: apps/admin-ui
|
|
env:
|
|
CYPRESS_BASE_URL: http://localhost:8080/admin/
|
|
CYPRESS_KEYCLOAK_SERVER: http://localhost:8080
|
|
CYPRESS_RECORD_KEY: b8f1d15e-eab8-4ee7-8e44-c6d7cd8fc0eb
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|