From bc41040fd3893d14d0d1d26e528d3f5348c9ff63 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 15 Aug 2021 11:07:27 -0400 Subject: [PATCH] [skip ci] Split push and PR build workflows so they don't cancel each other --- .github/workflows/build_pull_request.yml | 33 +++++++++++++++++++ .../workflows/{build.yml => build_push.yml} | 16 ++------- .github/workflows/cancel_pull_request.yml | 15 +++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build_pull_request.yml rename .github/workflows/{build.yml => build_push.yml} (93%) create mode 100644 .github/workflows/cancel_pull_request.yml diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml new file mode 100644 index 000000000..aba0bc981 --- /dev/null +++ b/.github/workflows/build_pull_request.yml @@ -0,0 +1,33 @@ +name: PR build check +on: + pull_request: + +jobs: + build: + name: Build app + runs-on: ubuntu-latest + + steps: + - name: Clone repo + uses: actions/checkout@v2 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Copy CI gradle.properties + run: | + mkdir -p ~/.gradle + cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Build app + uses: eskatos/gradle-command-action@v1 + with: + arguments: assembleStandardRelease + wrapper-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true diff --git a/.github/workflows/build.yml b/.github/workflows/build_push.yml similarity index 93% rename from .github/workflows/build.yml rename to .github/workflows/build_push.yml index 8868196f4..cc65fe1a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build_push.yml @@ -5,23 +5,10 @@ on: - master tags: - v* - pull_request: jobs: - check_wrapper: - name: Validate Gradle Wrapper - runs-on: ubuntu-latest - - steps: - - name: Clone repo - uses: actions/checkout@v2 - - - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 - build: name: Build app - needs: check_wrapper runs-on: ubuntu-latest steps: @@ -33,6 +20,9 @@ jobs: - name: Clone repo uses: actions/checkout@v2 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: diff --git a/.github/workflows/cancel_pull_request.yml b/.github/workflows/cancel_pull_request.yml new file mode 100644 index 000000000..4d6b65f1e --- /dev/null +++ b/.github/workflows/cancel_pull_request.yml @@ -0,0 +1,15 @@ +name: Cancel old pull request workflows + +on: + workflow_run: + workflows: ["PR build check"] + types: + - requested + +jobs: + cancel: + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.8.0 + with: + workflow_id: ${{ github.event.workflow.id }}