keycloak-scim/.github/workflows/cypress.yml

148 lines
4.6 KiB
YAML
Raw Normal View History

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/**]
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
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
concurrency:
# 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
group: cypress-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-keycloak:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
2022-12-01 11:16:10 +00:00
- name: Check out repository
uses: actions/checkout@v3
with:
path: admin-ui-repo
- name: Check out Keycloak Server
uses: actions/checkout@v3
with:
2022-12-01 12:07:17 +00:00
repository: ${{ inputs.keycloakRepo || (contains(github.ref, 'release/') && github.ref || 'keycloak/keycloak') }}
ref: ${{ inputs.keycloakBranch || 'main' }}
path: keycloak-repo
- 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: keycloak-repo
run: cp .github/settings.xml ~/.m2
- name: Build Admin UI
working-directory: admin-ui-repo
run: mvn clean install --batch-mode --file keycloak-theme/pom.xml
- name: Build Keycloak Server
working-directory: keycloak-repo
run: |
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
- name: Upload Keycloak server
uses: actions/upload-artifact@v3
with:
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 }}
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
test:
needs: [build-keycloak, install-nightly]
if: always() && ( needs.build-keycloak.result == 'success' || needs.install-nightly.result == 'success' )
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [1, 2, 3, 4, 5]
steps:
2022-12-01 11:16:10 +00:00
- name: Check out repository
uses: actions/checkout@v3
2021-09-24 13:47:36 +00:00
- 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: Compile Admin Client
run: npm run build --workspace=@keycloak/keycloak-admin-client
- name: Restore Keycloak server
uses: actions/download-artifact@v3
with:
name: keycloak
- name: Start LDAP server
run: npm run cy:ldap-server &
working-directory: apps/admin-ui
- name: Start Keycloak Server
run: |
tar xfvz keycloak-999-SNAPSHOT.tar.gz
keycloak-999-SNAPSHOT/bin/kc.sh start-dev --features=admin2,admin-fine-grained-authz,declarative-user-profile &> ~/server.log &
env:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
- name: Run Cypress
uses: cypress-io/github-action@v4
continue-on-error: true
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 }}
- name: Upload server logs
uses: actions/upload-artifact@v3
with:
name: server-log-${{ matrix.container }}
path: ~/server.log