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: