From 82d5f552f00018b81f9db6defddfc75e88a208b4 Mon Sep 17 00:00:00 2001 From: matejsemancik Date: Fri, 24 Nov 2023 14:34:28 +0100 Subject: [PATCH] Add file filter to android PR check workflow --- .github/workflows/android_pull_request.yml | 24 +++++++++++++++++++++- .github/workflows/ios_test.yml | 11 +++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android_pull_request.yml b/.github/workflows/android_pull_request.yml index 9145952a..b88eb2f3 100644 --- a/.github/workflows/android_pull_request.yml +++ b/.github/workflows/android_pull_request.yml @@ -7,9 +7,31 @@ concurrency: cancel-in-progress: true jobs: - pr: + detect-changes: + name: Detect Changes + runs-on: ubuntu-latest + outputs: + # Matches all files which can affect iOS build, when changed + iosFiles: ${{ steps.file-changes.outputs.notAndroid }} + # Matches all files which can affect Android build, when changed + androidFiles: ${{ steps.file-changes.outputs.notIos }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect Changes + uses: dorny/paths-filter@v2 + id: file-changes + with: + filters: | + notAndroid: + - "!(androidApp/**)" + notIos: + - "!(iosApp/**)" + pr-check: name: Android PR check runs-on: [ ubuntu-latest ] + needs: detect-changes + if: ${{ needs.detect-changes.outputs.androidFiles == 'true' }} env: # TODO Platform-specific slack channel name for notifications, eg. "gmlh-android" SLACK_CHANNEL: project-slack-channel-name diff --git a/.github/workflows/ios_test.yml b/.github/workflows/ios_test.yml index 4e3c7035..6c88dc2c 100644 --- a/.github/workflows/ios_test.yml +++ b/.github/workflows/ios_test.yml @@ -11,7 +11,10 @@ jobs: name: Detect Changes runs-on: ubuntu-latest outputs: - shouldRunJobs: ${{ steps.file-changes.outputs.anythingExceptAndroid }} + # Matches all files which can affect iOS build, when changed + iosFiles: ${{ steps.file-changes.outputs.notAndroid }} + # Matches all files which can affect Android build, when changed + androidFiles: ${{ steps.file-changes.outputs.notIos }} steps: - name: Checkout uses: actions/checkout@v4 @@ -20,14 +23,16 @@ jobs: id: file-changes with: filters: | - anythingExceptAndroid: + notAndroid: - "!(androidApp/**)" + notIos: + - "!(iosApp/**)" test: name: iOS Test runs-on: self-hosted timeout-minutes: 30 needs: detect-changes - if: ${{ needs.detect-changes.outputs.shouldRunJobs == 'true' }} + if: ${{ needs.detect-changes.outputs.iosFiles == 'true' }} steps: - name: Checkout uses: actions/checkout@v4