From 06b6e7ed7bcf8a1a21afbe8f73311edcb4607e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Barto=C5=A1?= Date: Thu, 20 Jan 2022 15:08:36 +0100 Subject: [PATCH] Include WebAuthn tests to GH Actions Closes #9502 --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bd790f342..d9da6438fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -474,3 +474,62 @@ jobs: path: | test-logs keycloak.log + + webauthn-test: + name: WebAuthn Tests + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Check whether this phase should run + run: echo "GIT_DIFF=$[ $( git diff --name-only HEAD^ | egrep -ic 'webauthn|passwordless' ) ]" >> $GITHUB_ENV + + - uses: actions/setup-java@v1 + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + with: + java-version: ${{ env.DEFAULT_JDK_VERSION }} + + - name: Update maven settings + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/ + + - name: Cache Maven packages + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + 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 + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + run: rm -rf ~/.m2/repository/org/keycloak >/dev/null || true + + - name: Download built keycloak + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + id: download-keycloak + uses: actions/download-artifact@v2 + with: + path: ~/.m2/repository/org/keycloak/ + name: keycloak-artifacts.zip + + - name: Run WebAuthn tests + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + run: | + mvn clean install -nsu -B -Dbrowser=chrome -Pwebauthn -f testsuite/integration-arquillian/tests/other/pom.xml -Dtest=org.keycloak.testsuite.webauthn.**.*Test | misc/log/trimmer.sh + + TEST_RESULT=${PIPESTATUS[0]} + find . -path '*/target/surefire-reports/*.xml' | zip -q reports-webauthn-tests.zip -@ + exit $TEST_RESULT + + - name: WebAuthn test reports + uses: actions/upload-artifact@v2 + if: failure() + with: + name: reports-webauthn-tests + retention-days: 14 + path: reports-webauthn-tests.zip + if-no-files-found: ignore \ No newline at end of file