keycloak-scim/.github/workflows/cypress.yml
2022-04-13 13:07:28 +02:00

121 lines
3.6 KiB
YAML

name: Cypress
on: push
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,admin-preview
- 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: 16
check-latest: true
cache: npm
- name: Cache Node modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: |
~/.cache/Cypress
node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
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 &> ~/server.log &
env:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
- name: Run Cypress
uses: cypress-io/github-action@v2
with:
install: false
record: true
parallel: true
browser: chrome
wait-on: http://localhost:8080
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
path: ~/server.log