diff --git a/.github/workflows/ci-x.yml b/.github/workflows/ci-x.yml index 0608c58c86..52ef75578b 100644 --- a/.github/workflows/ci-x.yml +++ b/.github/workflows/ci-x.yml @@ -12,21 +12,18 @@ jobs: with: java-version: 1.8 - name: Cache Maven packages + id: cache uses: actions/cache@v2 with: - path: ~/.m2/repository + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Build - run: mvn clean install -B -e -DskipTests -Pquarkus,distribution - - name: Tar Maven Repo - shell: bash - run: tar -czvf maven-repo.tgz -C ~ .m2/repository - - name: Persist Maven Repo - uses: actions/upload-artifact@v1 - with: - name: maven-repo - path: maven-repo.tgz + - name: Build cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + mvn clean install -nsu -B -e -DskipTests -Pquarkus,distribution test: name: Test @@ -36,23 +33,27 @@ jobs: MAVEN_OPTS: -Xmx2048m steps: - uses: actions/checkout@v2 + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ + - name: Run Quarkus unit tests - run: mvn clean install -B -Pquarkus -f quarkus/pom.xml - - name: Build testsuite - run: mvn clean install -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml - - name: Run base tests - run: mvn clean install -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest='!org.keycloak.testsuite.adapter.**,!**.crossdc.**,!**.cluster.**' | misc/log/trimmer.sh; exit ${PIPESTATUS[0]} + run: | + mvn clean install -nsu -B -Pquarkus -f quarkus/pom.xml + mvn clean install -nsu -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml + mvn clean install -nsu -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest='!org.keycloak.testsuite.adapter.**,!**.crossdc.**,!**.cluster.**' | misc/log/trimmer.sh + exit ${PIPESTATUS[0]} + test-adapter: name: Test Adapter needs: build @@ -61,21 +62,22 @@ jobs: MAVEN_OPTS: -Xmx1024m steps: - uses: actions/checkout@v2 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - - name: Build testsuite - run: mvn clean install -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml - name: Run adapter tests - run: mvn clean install -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest=org.keycloak.testsuite.adapter.** | misc/log/trimmer.sh; exit ${PIPESTATUS[0]} + run: | + mvn clean install -nsu -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml + mvn clean install -nsu -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest=org.keycloak.testsuite.adapter.** | misc/log/trimmer.sh + exit ${PIPESTATUS[0]} test-cluster: name: Test Clustering needs: build @@ -84,18 +86,19 @@ jobs: MAVEN_OPTS: -Xmx2048m steps: - uses: actions/checkout@v2 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - - name: Build testsuite - run: mvn clean install -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml - name: Run cluster tests - run: mvn clean install -B -Pauth-server-cluster-quarkus -Dsession.cache.owners=2 -Dtest=**.cluster.** -f testsuite/integration-arquillian/pom.xml | misc/log/trimmer.sh; exit ${PIPESTATUS[0]} + run: | + mvn clean install -nsu -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml + mvn clean install -nsu -B -Pauth-server-cluster-quarkus -Dsession.cache.owners=2 -Dtest=**.cluster.** -f testsuite/integration-arquillian/pom.xml | misc/log/trimmer.sh + exit ${PIPESTATUS[0]} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5dba51fe0a..4c110d78ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,25 +12,23 @@ jobs: with: java-version: 1.8 - name: Cache Maven packages + id: cache uses: actions/cache@v2 with: - path: ~/.m2/repository + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Build - run: mvn install -B -DskipTests -Pdistribution - - name: Tar Maven Repo - shell: bash - run: tar -czvf maven-repo.tgz -C ~ .m2/repository - - name: Persist Maven Repo - uses: actions/upload-artifact@v1 - with: - name: maven-repo - path: maven-repo.tgz + - name: Build cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + mvn clean install -nsu -B -e -DskipTests -Pquarkus,distribution unit-tests: name: Unit Tests runs-on: ubuntu-latest + needs: build steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -43,7 +41,7 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Run unit tests - run: mvn install -B -DskipTestsuite -DskipExamples -f pom.xml + run: mvn install -nsu -B -DskipTestsuite -DskipExamples -f pom.xml test: name: Test @@ -51,21 +49,25 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - - name: Build testsuite - run: mvn clean install -B -Pauth-server-wildfly -DskipTests -f testsuite/pom.xml + - name: Run base tests - run: mvn install -B -Pauth-server-wildfly -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh; exit ${PIPESTATUS[0]} + run: | + mvn install -nsu -B -Pauth-server-wildfly -DskipTests -f testsuite/pom.xml + mvn install -nsu -B -Pauth-server-wildfly -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh + exit ${PIPESTATUS[0]} test-crossdc: name: CrossDC Tests @@ -77,24 +79,32 @@ jobs: - 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 'crossdc|infinispan' )" >> $GITHUB_ENV + - uses: actions/setup-java@v1 + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - - name: Build testsuite - run: mvn clean install -B -nsu -Pauth-servers-crossdc-jboss,auth-server-wildfly,cache-server-infinispan,app-server-wildfly -DskipTests - - name: Run git diff - run: echo "GIT_DIFF=$( git diff --name-only HEAD^ | egrep -ic 'crossdc|infinispan' )" >> $GITHUB_ENV; - - name: Run crossdc-server and crossdc-adapter tests + + - name: Cache Maven packages if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} - run: mvn clean install -B -nsu -f testsuite/integration-arquillian/tests/base/pom.xml -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly "-Dtest=org.keycloak.testsuite.crossdc.**.*,org.keycloak.testsuite.adapter.**.crossdc.**.*" | misc/log/trimmer.sh; exit ${PIPESTATUS[0]} + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Run tests + if: ${{ github.event_name != 'pull_request' || env.GIT_DIFF != 0 }} + shell: bash + run: | + mvn install -B -nsu -Pauth-servers-crossdc-jboss,auth-server-wildfly,cache-server-infinispan,app-server-wildfly -DskipTests + mvn install -B -nsu -f testsuite/integration-arquillian/tests/base/pom.xml -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly "-Dtest=org.keycloak.testsuite.crossdc.**.*,org.keycloak.testsuite.adapter.**.crossdc.**.*" | misc/log/trimmer.sh + exit ${PIPESTATUS[0]} test-undertow-map: name: Test undertow - map provider @@ -104,18 +114,22 @@ jobs: MAVEN_OPTS: -Xmx2048m steps: - uses: actions/checkout@v2 + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/keycloak + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Download Maven Repo - uses: actions/download-artifact@v1 - with: - name: maven-repo - path: . - - name: Extract Maven Repo - shell: bash - run: tar -xzvf maven-repo.tgz -C ~ - - name: Build testsuite - run: mvn clean install -B -DskipTests -f testsuite/pom.xml + - name: Run base tests - undertow - run: mvn install -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; exit ${PIPESTATUS[0]} \ No newline at end of file + run: | + mvn install -nsu -B -DskipTests -f testsuite/pom.xml + mvn 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 + exit ${PIPESTATUS[0]}