diff --git a/.github/scripts/check_leak.sh b/.github/scripts/check_leak.sh new file mode 100755 index 00000000000..4b84b7feb55 --- /dev/null +++ b/.github/scripts/check_leak.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Expected build log as argument" + exit 1 +fi + +if grep -q 'LEAK:' $1 ; then + echo "Leak detected, please inspect build log" + exit 1 +else + echo "No Leak detected" + exit 0 +fi + diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 687eeec8e58..da48156b9d1 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,8 +3,6 @@ name: Build project on: push: branches: [ "4.1"] - pull_request: - branches: [ "4.1"] schedule: - cron: '30 1 * * 1' # At 01:30 on Monday, every Monday. @@ -13,38 +11,22 @@ on: workflow_dispatch: jobs: - verify: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v1 - with: - java-version: 8 - # Cache .m2/repository - - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: verify-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - verify-${{ runner.os }}-maven- - - - name: Verify with Maven - run: mvn verify -B --file pom.xml -DskipTests=true - + build-linux-x86_64-java8: runs-on: ubuntu-latest - needs: verify steps: - uses: actions/checkout@v2 # Cache .m2/repository - - uses: actions/cache@v1 + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java8-cache-m2-repository with: path: ~/.m2/repository - key: build-linux-x86_64-java8-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - build-linux-x86_64-java8-${{ runner.os }}-maven- + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- # Enable caching of Docker layers - uses: satackey/action-docker-layer-caching@v0.0.8 @@ -58,23 +40,8 @@ jobs: run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build - name: Build project without leak detection - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/4.1' }} run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build - - name: Build project with leak detection - if: ${{ github.event_name == 'pull_request' }} - run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak | tee build-leak.output - - - name: Checking for detected leak - if: ${{ github.event_name == 'pull_request' }} - run: | - if grep -q 'LEAK:' build-leak.output ; then - echo "Leak detected, please inspect build log" - exit 1 - else - echo "No Leak detected" - fi - - uses: actions/upload-artifact@v2 if: ${{ failure() }} with: @@ -83,17 +50,19 @@ jobs: build-linux-x86_64-java11: runs-on: ubuntu-latest - needs: verify steps: - uses: actions/checkout@v2 # Cache .m2/repository - - uses: actions/cache@v1 + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java11-cache-m2-repository with: path: ~/.m2/repository - key: build-linux-x86_64-java11-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - build-linux-x86_64-java11-${{ runner.os }}-maven- + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- # Enable caching of Docker layers - uses: satackey/action-docker-layer-caching@v0.0.8 @@ -107,23 +76,8 @@ jobs: run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build - name: Build project without leak detection - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/4.1' }} run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build - - name: Build project with leak detection - if: ${{ github.event_name == 'pull_request' }} - run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak | tee build-leak.output - - - name: Checking for detected leak - if: ${{ github.event_name == 'pull_request' }} - run: | - if grep -q 'LEAK:' build-leak.output ; then - echo "Leak detected, please inspect build log" - exit 1 - else - echo "No Leak detected" - fi - - uses: actions/upload-artifact@v2 if: ${{ failure() }} with: @@ -132,17 +86,19 @@ jobs: build-linux-x86_64-java15: runs-on: ubuntu-latest - needs: verify steps: - uses: actions/checkout@v2 # Cache .m2/repository - - uses: actions/cache@v1 + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java15-cache-m2-repository with: path: ~/.m2/repository - key: build-linux-x86_64-java15-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - build-linux-x86_64-java15-${{ runner.os }}-maven- + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- # Enable caching of Docker layers - uses: satackey/action-docker-layer-caching@v0.0.8 @@ -156,23 +112,8 @@ jobs: run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml build - name: Build project without leak detection - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/4.1' }} run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build - - name: Build project with leak detection - if: ${{ github.event_name == 'pull_request' }} - run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build-leak | tee build-leak.output - - - name: Checking for detected leak - if: ${{ github.event_name == 'pull_request' }} - run: | - if grep -q 'LEAK:' build-leak.output ; then - echo "Leak detected, please inspect build log" - exit 1 - else - echo "No Leak detected" - fi - - uses: actions/upload-artifact@v2 if: ${{ failure() }} with: diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 58e4d26bc0f..4e0ffe866cc 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -26,12 +26,15 @@ jobs: - uses: actions/checkout@v2 # Cache .m2/repository - - uses: actions/cache@v1 + - uses: actions/cache@v2 + env: + cache-name: deploy-linux-x86_64-cache-m2-repository with: path: ~/.m2/repository - key: deploy-linux-x86_64-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-deploy-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - deploy-linux-x86_64-${{ runner.os }}-maven- + ${{ runner.os }}-deploy-${{ env.cache-name }}- + ${{ runner.os }}-deploy- # Enable caching of Docker layers - uses: satackey/action-docker-layer-caching@v0.0.8 @@ -64,12 +67,15 @@ jobs: - uses: actions/checkout@v2 # Cache .m2/repository - - uses: actions/cache@v1 + - uses: actions/cache@v2 + env: + cache-name: deploy-linux-aarch64-cache-m2-repository with: path: ~/.m2/repository - key: deploy-linux-aarch64-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-deploy-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - deploy-linux-aarch64-${{ runner.os }}-maven- + ${{ runner.os }}-deploy-${{ env.cache-name }}- + ${{ runner.os }}-deploy- # Enable caching of Docker layers - uses: satackey/action-docker-layer-caching@v0.0.8 diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 00000000000..25614d6f862 --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,154 @@ +name: Build PR + +on: + pull_request: + branches: [ "4.1"] + + schedule: + - cron: '30 1 * * 1' # At 01:30 on Monday, every Monday. + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + verify: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + # Cache .m2/repository + - uses: actions/cache@v2 + env: + cache-name: verify-cache-m2-repository + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ env.cache-name }}- + ${{ runner.os }}-pr- + + - name: Verify with Maven + run: mvn verify -B --file pom.xml -DskipTests=true + + build-linux-x86_64-java8: + runs-on: ubuntu-latest + needs: verify + steps: + - uses: actions/checkout@v2 + + # Cache .m2/repository + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java8-cache-m2-repository + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ env.cache-name }}- + ${{ runner.os }}-pr- + + # Enable caching of Docker layers + - uses: satackey/action-docker-layer-caching@v0.0.8 + continue-on-error: true + with: + key: build-linux-x86_64-java8-docker-cache-{hash} + restore-keys: | + build-linux-x86_64-java8-docker-cache- + + - name: Build docker image + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml build + + - name: Build project with leak detection + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak | tee build-leak.output + + - name: Checking for detected leak + run: ./.github/scripts/check_leak.sh build-leak.output + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: target + path: "**/target/" + + build-linux-x86_64-java11: + runs-on: ubuntu-latest + needs: verify + steps: + - uses: actions/checkout@v2 + + # Cache .m2/repository + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java11-cache-m2-repository + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ env.cache-name }}- + ${{ runner.os }}-pr- + + # Enable caching of Docker layers + - uses: satackey/action-docker-layer-caching@v0.0.8 + continue-on-error: true + with: + key: build-linux-x86_64-java11-docker-cache-{hash} + restore-keys: | + build-linux-x86_64-java11-docker-cache- + + - name: Build docker image + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml build + + - name: Build project with leak detection + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run build-leak | tee build-leak.output + + - name: Checking for detected leak + run: ./.github/scripts/check_leak.sh build-leak.output + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: target + path: "**/target/" + + build-linux-x86_64-java15: + runs-on: ubuntu-latest + needs: verify + steps: + - uses: actions/checkout@v2 + + # Cache .m2/repository + - uses: actions/cache@v2 + env: + cache-name: build-linux-x86_64-java15-cache-m2-repository + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ env.cache-name }}- + ${{ runner.os }}-pr- + + # Enable caching of Docker layers + - uses: satackey/action-docker-layer-caching@v0.0.8 + continue-on-error: true + with: + key: build-linux-x86_64-java15-docker-cache-{hash} + restore-keys: | + build-linux-x86_64-java15-docker-cache- + + - name: Build docker image + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml build + + - name: Build project with leak detection + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.115.yaml run build-leak | tee build-leak.output + + - name: Checking for detected leak + run: ./.github/scripts/check_leak.sh build-leak.output + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: target + path: "**/target/"