From c8d2d1bb1fd9c93bbb3d5b5d3b0b387482aec79d Mon Sep 17 00:00:00 2001 From: Hynek Mlnarik Date: Fri, 13 Nov 2020 15:15:01 +0100 Subject: [PATCH] KEYCLOAK-16323 Speedup GHA --- .github/workflows/ci.yml | 183 +++++++-------------------------------- 1 file changed, 29 insertions(+), 154 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e208479b8b1..7121f0b601a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,11 @@ jobs: restore-keys: cache-1-${{ runner.os }}-m2 - name: Build Keycloak - run: mvn clean install -nsu -B -e -DskipTests -Pquarkus,distribution + run: | + mvn clean install -nsu -B -e -DskipTests -Pquarkus,distribution + mvn clean install -nsu -B -e -f testsuite/integration-arquillian/servers/auth-server -Pauth-server-quarkus + mvn clean install -nsu -B -e -f testsuite/integration-arquillian/servers/auth-server -Pauth-server-wildfly + mvn clean install -nsu -B -e -f testsuite/integration-arquillian/servers/auth-server -Pauth-server-undertow - name: Store Keycloak artifacts id: store-keycloak @@ -37,7 +41,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: rm -rf ~/.m2/repository/org/keycloak -## Tests: Regular distribution +# Tests: Regular distribution unit-tests: name: Unit Tests @@ -64,10 +68,10 @@ jobs: name: keycloak-artifacts.zip - name: Run unit tests run: | - mvn install -nsu -B -DskipTestsuite -DskipExamples -f pom.xml - TEST_RESULT=$? - find . -path '*/target/surefire-reports/*.xml' | zip -q reports-unit-tests.zip -@ - exit $TEST_RESULT + if ! mvn install -nsu -B -DskipTestsuite -DskipExamples -f pom.xml; then + find . -path '*/target/surefire-reports/*.xml' | zip -q reports-unit-tests.zip -@ + exit 1 + fi - name: Unit test reports uses: actions/upload-artifact@v2 @@ -79,9 +83,14 @@ jobs: if-no-files-found: ignore test: - name: Test + name: Base testsuite needs: build runs-on: ubuntu-latest + strategy: + matrix: + server: ['quarkus', 'undertow-map', 'wildfly'] + tests: ['group1','group2','group3'] + fail-fast: false steps: - uses: actions/checkout@v2 @@ -110,21 +119,27 @@ jobs: - name: Run base tests run: | - echo '::group::Compiling testsuite' - mvn clean install -nsu -B -Pauth-server-wildfly -DskipTests -f testsuite/pom.xml - echo '::endgroup::' - mvn clean install -nsu -B -Pauth-server-wildfly -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh + declare -A PARAMS TESTGROUP + PARAMS["quarkus"]="-Pauth-server-quarkus" + PARAMS["undertow-map"]="-Pauth-server-undertow -Dkeycloak.client.provider=map -Dkeycloak.group.provider=map -Dkeycloak.role.provider=map" + PARAMS["wildfly"]="-Pauth-server-wildfly" + TESTGROUP["group1"]="-Dtest=!**.crossdc.**,!**.cluster.**,%regex[org.keycloak.testsuite.(a[abc]|ad[a-l]|[^a-q]).*]" # Tests alphabetically before admin tests and those after "r" + TESTGROUP["group2"]="-Dtest=!**.crossdc.**,!**.cluster.**,%regex[org.keycloak.testsuite.(ad[^a-l]|a[^a-d]|b).*]" # Admin tests and those starting with "b" + TESTGROUP["group3"]="-Dtest=!**.crossdc.**,!**.cluster.**,%regex[org.keycloak.testsuite.([c-q]).*]" # All the rest + + mvn clean install -nsu -B ${PARAMS["${{ matrix.server }}"]} ${TESTGROUP["${{ matrix.tests }}"]} -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh + TEST_RESULT=${PIPESTATUS[0]} - find . -path '*/target/surefire-reports/*.xml' | zip -q reports-base-tests.zip -@ + find . -path '*/target/surefire-reports/*.xml' | zip -q reports-${{ matrix.server }}-base-tests-${{ matrix.tests }}.zip -@ exit $TEST_RESULT - name: Base test reports uses: actions/upload-artifact@v2 if: failure() with: - name: reports-base-tests + name: reports-${{ matrix.server }}-base-tests-${{ matrix.tests }} retention-days: 14 - path: reports-base-tests.zip + path: reports-${{ matrix.server }}-base-tests-${{ matrix.tests }}.zip if-no-files-found: ignore test-cluster: @@ -239,148 +254,8 @@ jobs: path: reports-cross-dc-tests.zip if-no-files-found: ignore - test-undertow-map: - name: Test undertow - map provider - needs: build - runs-on: ubuntu-latest - env: - MAVEN_OPTS: -Xmx2048m - steps: - - uses: actions/checkout@v2 - - - 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 - - - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - - name: Run base tests - undertow - run: | - echo '::group::Compiling testsuite' - mvn clean install -nsu -B -DskipTests -f testsuite/pom.xml - echo '::endgroup::' - mvn clean install -nsu -B -f testsuite/integration-arquillian/tests/base/pom.xml -Dkeycloak.client.provider=map -Dkeycloak.group.provider=map -Dkeycloak.role.provider=map | misc/log/trimmer.sh - TEST_RESULT=${PIPESTATUS[0]} - find . -path '*/target/surefire-reports/*.xml' | zip -q reports-base-undertow-tests.zip -@ - exit $TEST_RESULT - - - name: Base test - undertow reports - uses: actions/upload-artifact@v2 - if: failure() - with: - name: reports-base-undertow-tests - retention-days: 14 - path: reports-base-undertow-tests.zip - if-no-files-found: ignore - ### Tests: Quarkus distribution - quarkus-test: - name: Quarkus Test - needs: build - runs-on: ubuntu-latest - env: - MAVEN_OPTS: -Xmx2048m - steps: - - uses: actions/checkout@v2 - - - 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 - - - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - - name: Download built keycloak - id: download-keycloak - uses: actions/download-artifact@v2 - with: - path: ~/.m2/repository/org/keycloak/ - name: keycloak-artifacts.zip - - - name: Run Quarkus tests - run: | - echo '::group::Compiling testsuite' - mvn clean install -nsu -B -Pauth-server-quarkus -DskipTests -f testsuite/pom.xml - echo '::endgroup::' - mvn clean install -nsu -B -Pauth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest='!org.keycloak.testsuite.adapter.**,!**.crossdc.**,!**.cluster.**' | misc/log/trimmer.sh - TEST_RESULT=${PIPESTATUS[0]} - find . -path '*/target/surefire-reports/*.xml' | zip -q reports-quarkus-base-unit-tests.zip -@ - exit $TEST_RESULT - - - name: Quarkus base / unit test reports - uses: actions/upload-artifact@v2 - if: failure() - with: - name: reports-quarkus-base-unit-tests - retention-days: 14 - path: reports-quarkus-base-unit-tests.zip - if-no-files-found: ignore - - quarkus-test-adapter: - name: Quarkus Test Adapter - needs: build - runs-on: ubuntu-latest - env: - MAVEN_OPTS: -Xmx1024m - steps: - - uses: actions/checkout@v2 - - 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 - - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Run Quarkus adapter tests - run: | - echo '::group::Compiling testsuite' - mvn clean install -nsu -B -Pauth-server-quarkus -DskipTests -f testsuite/pom.xml - echo '::endgroup::' - mvn clean install -nsu -B -Pauth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest=org.keycloak.testsuite.adapter.** | misc/log/trimmer.sh - TEST_RESULT=${PIPESTATUS[0]} - find . -path '*/target/surefire-reports/*.xml' | zip -q reports-quarkus-adapter-tests.zip -@ - exit $TEST_RESULT - - - name: Quarkus adapter test reports - uses: actions/upload-artifact@v2 - if: failure() - with: - name: reports-quarkus-adapter-tests - retention-days: 14 - path: reports-quarkus-adapter-tests.zip - if-no-files-found: ignore - quarkus-test-cluster: name: Quarkus Test Clustering needs: build