From f2c08e9b8fd97e237f07edf575044bfb954a8e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Muzik=C3=A1=C5=99?= Date: Tue, 13 Apr 2021 17:28:34 +0200 Subject: [PATCH] KEYCLOAK-17743 Run QS tests with each PR in the Keycloak repo --- .github/scripts/quickstarts/prepare-server.sh | 11 ++++ .github/workflows/ci.yml | 55 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 .github/scripts/quickstarts/prepare-server.sh diff --git a/.github/scripts/quickstarts/prepare-server.sh b/.github/scripts/quickstarts/prepare-server.sh new file mode 100755 index 00000000000..a036908bd04 --- /dev/null +++ b/.github/scripts/quickstarts/prepare-server.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec -f keycloak) + +unzip ~/.m2/repository/org/keycloak/keycloak-server-dist/${VERSION}/keycloak-server-dist-${VERSION}.zip +mv keycloak-${VERSION} keycloak-dist + +keycloak-dist/bin/add-user-keycloak.sh -u admin -p admin + +# update QS version to match KC version +mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DgroupId=org.keycloak* -DartifactId=* -Pbump-version -B \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7620701068f..51141288865 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -341,3 +341,58 @@ jobs: retention-days: 14 path: reports-quarkus-cluster-tests.zip if-no-files-found: ignore + + quickstarts-tests: + name: Quickstarts Tests + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + repository: keycloak/keycloak-quickstarts + ref: master # default is "latest" + + - uses: actions/checkout@v2 + with: + path: keycloak + + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: cache-1-${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: cache-1-${{ runner.os }}-m2 + - name: Cleanup org.keycloak artifacts + run: rm -rf ~/.m2/repository/org/keycloak >/dev/null || true + - name: Download built keycloak + id: download-keycloak + uses: actions/download-artifact@v2 + with: + path: ~/.m2/repository/org/keycloak/ + name: keycloak-artifacts.zip + + - name: Prepare Keycloak + run: keycloak/.github/scripts/quickstarts/prepare-server.sh + + - name: Build Quickstarts + run: .github/scripts/build-quickstarts.sh + + - name: Start Keycloak + run: .github/scripts/start-local-server.sh + + - name: Run tests + run: .github/scripts/run-tests.sh + + - name: Archive logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: quickstarts-test-logs + retention-days: 2 + path: | + test-logs + keycloak.log \ No newline at end of file