name: Cypress on: push: branches: [main] pull_request: branches: [main] 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: group: ${{ github.ref }} cancel-in-progress: true jobs: build-keycloak: if: ${{ github.event_name != 'schedule' }} runs-on: ubuntu-latest steps: - name: Check out Admin UI uses: actions/checkout@v3 with: path: admin-ui-repo - name: Check out Keycloak Server uses: actions/checkout@v3 with: repository: ${{ inputs.keycloakRepo || '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: 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: 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/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 & 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 }}