From 91cc9995238e9a8ce2be40c8f080cde758d93ea1 Mon Sep 17 00:00:00 2001 From: DaneEvans Date: Sat, 12 Jul 2025 11:31:58 +1000 Subject: [PATCH] add a skip value, so we can run and skip tests at the same level. (#2413) --- .github/workflows/pull-request.yml | 11 ++++++++--- .github/workflows/reusable-android-build.yml | 6 ++++++ .github/workflows/reusable-android-test.yml | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 60b735e75..535c3995f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,22 +15,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Always pass for scheduled-updates - run: echo Scheduled updates branch, auto-passing by default. + run: | + echo Scheduled updates branch, auto-passing by default. + echo We could add an xml linter here. build_and_detekt: - if: github.repository == 'meshtastic/Meshtastic-Android' && github.head_ref != 'scheduled-updates' + if: github.repository == 'meshtastic/Meshtastic-Android' uses: ./.github/workflows/reusable-android-build.yml + with: + skip_tests: ${{ github.head_ref == 'scheduled-updates' }} secrets: GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }} # inputs.upload_artifacts defaults to true, so no need to specify for PRs androidTest: # AssumingandroidTest should also only run for the main repository - if: github.repository == 'meshtastic/Meshtastic-Android' && github.head_ref != 'scheduled-updates' + if: github.repository == 'meshtastic/Meshtastic-Android' uses: ./.github/workflows/reusable-android-test.yml with: api_levels: '[35]' # Run only on API 35 for PRs + skip_tests: ${{ github.head_ref == 'scheduled-updates' }} # upload_artifacts defaults to true, so no need to explicitly set secrets: GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/reusable-android-build.yml b/.github/workflows/reusable-android-build.yml index 0f0905286..751d3c5e3 100644 --- a/.github/workflows/reusable-android-build.yml +++ b/.github/workflows/reusable-android-build.yml @@ -8,6 +8,11 @@ on: required: false type: boolean default: true + skip_tests: + description: 'Whether to skip running tests' + required: false + type: boolean + default: false secrets: GRADLE_ENCRYPTION_KEY: required: false @@ -16,6 +21,7 @@ jobs: build_and_detekt: runs-on: ubuntu-latest timeout-minutes: 35 + if: ${{ !inputs.skip_tests }} steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/reusable-android-test.yml b/.github/workflows/reusable-android-test.yml index 1056a0202..99f3ed96f 100644 --- a/.github/workflows/reusable-android-test.yml +++ b/.github/workflows/reusable-android-test.yml @@ -13,12 +13,18 @@ on: required: false type: string default: '[26, 35]' # Default to running both if not specified by caller + skip_tests: + description: 'Whether to skip running tests' + required: false + type: boolean + default: false secrets: GRADLE_ENCRYPTION_KEY: required: false jobs: androidTest: + if: ${{ !inputs.skip_tests }} runs-on: ubuntu-latest timeout-minutes: 25 strategy: