2021-07-30 18:12:32 +00:00
|
|
|
name: Cypress
|
2022-04-13 11:07:28 +00:00
|
|
|
on: push
|
2021-01-12 17:04:52 +00:00
|
|
|
jobs:
|
2022-04-11 14:18:24 +00:00
|
|
|
setup:
|
2021-01-12 17:04:52 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-04-11 14:18:24 +00:00
|
|
|
outputs:
|
|
|
|
server-path: ${{ steps.extract-server.outputs.path }}
|
2021-09-24 12:41:34 +00:00
|
|
|
env:
|
|
|
|
ADMIN_UI_PATH: admin-ui
|
|
|
|
KEYCLOAK_SERVER_PATH: keycloak-server
|
2021-01-12 17:04:52 +00:00
|
|
|
steps:
|
2021-09-24 12:41:34 +00:00
|
|
|
- name: Check out Admin UI
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
|
|
|
path: ${{ env.ADMIN_UI_PATH }}
|
|
|
|
|
|
|
|
- name: Check out Keycloak Server
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
with:
|
|
|
|
repository: keycloak/keycloak
|
|
|
|
path: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
|
|
|
|
- name: Set up Java
|
2022-04-11 04:23:56 +00:00
|
|
|
uses: actions/setup-java@v3
|
2021-09-24 12:41:34 +00:00
|
|
|
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
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 12:41:34 +00:00
|
|
|
- name: Build Keycloak Server
|
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
2022-04-11 14:18:24 +00:00
|
|
|
run: mvn clean install --no-snapshot-updates --batch-mode --errors -DskipTests -DskipCommon -DskipAccount2 -Pdistribution,admin-preview
|
2021-09-24 12:41:34 +00:00
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- name: Extract Keycloak server
|
|
|
|
id: extract-server
|
2021-09-24 12:41:34 +00:00
|
|
|
working-directory: ${{ env.KEYCLOAK_SERVER_PATH }}
|
|
|
|
run: |
|
|
|
|
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
2022-04-11 14:18:24 +00:00
|
|
|
mkdir ../server
|
|
|
|
tar -xvf quarkus/dist/target/keycloak-$VERSION.tar.gz -C ../server
|
|
|
|
echo "::set-output name=path::server/keycloak-$VERSION"
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- 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
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2021-09-24 13:47:36 +00:00
|
|
|
- name: Set up Node
|
2022-04-11 11:25:24 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-30 18:12:32 +00:00
|
|
|
with:
|
2022-04-21 14:52:49 +00:00
|
|
|
node-version: 18
|
2021-07-30 18:12:32 +00:00
|
|
|
check-latest: true
|
2021-08-25 14:00:44 +00:00
|
|
|
cache: npm
|
2022-04-11 14:18:24 +00:00
|
|
|
|
|
|
|
- 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') }}
|
2021-07-30 18:12:32 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-04-11 14:18:24 +00:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2021-07-30 18:12:32 +00:00
|
|
|
run: npm ci
|
|
|
|
|
2022-04-11 14:18:24 +00:00
|
|
|
- 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
|
|
|
|
|
2021-07-30 18:12:32 +00:00
|
|
|
- name: Run Cypress
|
2022-04-11 14:18:24 +00:00
|
|
|
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
|
2022-04-11 17:22:48 +00:00
|
|
|
CYPRESS_RECORD_KEY: b8f1d15e-eab8-4ee7-8e44-c6d7cd8fc0eb
|
2022-04-11 14:18:24 +00:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-07-30 18:12:32 +00:00
|
|
|
|
2022-04-21 11:49:42 +00:00
|
|
|
- name: Add Cypress videos artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: cypress-videos
|
|
|
|
path: assets/videos
|
|
|
|
|
|
|
|
- name: Add Cypress screenshots artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: cypress-screenshots
|
|
|
|
path: assets/screenshots
|
|
|
|
|
2022-04-05 07:20:00 +00:00
|
|
|
- name: Upload server logs
|
2022-04-11 04:24:00 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-04-05 07:20:00 +00:00
|
|
|
with:
|
|
|
|
name: server-log
|
|
|
|
path: ~/server.log
|