KEYCLOAK-16323 Speedup GHA

This commit is contained in:
Hynek Mlnarik 2020-11-13 15:15:01 +01:00 committed by Stian Thorgersen
parent 84df008bc2
commit c8d2d1bb1f

View file

@ -21,7 +21,11 @@ jobs:
restore-keys: cache-1-${{ runner.os }}-m2 restore-keys: cache-1-${{ runner.os }}-m2
- name: Build Keycloak - 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 - name: Store Keycloak artifacts
id: store-keycloak id: store-keycloak
@ -37,7 +41,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf ~/.m2/repository/org/keycloak run: rm -rf ~/.m2/repository/org/keycloak
## Tests: Regular distribution # Tests: Regular distribution
unit-tests: unit-tests:
name: Unit Tests name: Unit Tests
@ -64,10 +68,10 @@ jobs:
name: keycloak-artifacts.zip name: keycloak-artifacts.zip
- name: Run unit tests - name: Run unit tests
run: | run: |
mvn install -nsu -B -DskipTestsuite -DskipExamples -f pom.xml if ! mvn install -nsu -B -DskipTestsuite -DskipExamples -f pom.xml; then
TEST_RESULT=$?
find . -path '*/target/surefire-reports/*.xml' | zip -q reports-unit-tests.zip -@ find . -path '*/target/surefire-reports/*.xml' | zip -q reports-unit-tests.zip -@
exit $TEST_RESULT exit 1
fi
- name: Unit test reports - name: Unit test reports
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -79,9 +83,14 @@ jobs:
if-no-files-found: ignore if-no-files-found: ignore
test: test:
name: Test name: Base testsuite
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
server: ['quarkus', 'undertow-map', 'wildfly']
tests: ['group1','group2','group3']
fail-fast: false
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -110,21 +119,27 @@ jobs:
- name: Run base tests - name: Run base tests
run: | run: |
echo '::group::Compiling testsuite' declare -A PARAMS TESTGROUP
mvn clean install -nsu -B -Pauth-server-wildfly -DskipTests -f testsuite/pom.xml PARAMS["quarkus"]="-Pauth-server-quarkus"
echo '::endgroup::' PARAMS["undertow-map"]="-Pauth-server-undertow -Dkeycloak.client.provider=map -Dkeycloak.group.provider=map -Dkeycloak.role.provider=map"
mvn clean install -nsu -B -Pauth-server-wildfly -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh 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]} 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 exit $TEST_RESULT
- name: Base test reports - name: Base test reports
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: failure() if: failure()
with: with:
name: reports-base-tests name: reports-${{ matrix.server }}-base-tests-${{ matrix.tests }}
retention-days: 14 retention-days: 14
path: reports-base-tests.zip path: reports-${{ matrix.server }}-base-tests-${{ matrix.tests }}.zip
if-no-files-found: ignore if-no-files-found: ignore
test-cluster: test-cluster:
@ -239,148 +254,8 @@ jobs:
path: reports-cross-dc-tests.zip path: reports-cross-dc-tests.zip
if-no-files-found: ignore 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 ### 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: quarkus-test-cluster:
name: Quarkus Test Clustering name: Quarkus Test Clustering
needs: build needs: build