Skip to content

Commit

Permalink
[CI] Skip compile job when not on main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Aug 13, 2024
1 parent 3776b50 commit 845ee92
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ concurrency:

jobs:
compile:
name: Compile and cache
name: Compile for build cache
if: ${{ github.ref == 'refs/heads/main-ose' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -23,14 +24,14 @@ jobs:
- uses: gradle/actions/setup-gradle@v3 # creates build cache when on main branch
with:
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
cache-write-only: ${{ github.ref == 'refs/heads/main-ose' }}
dependency-graph: generate-and-submit # submit Github Dependency Graph info
dependency-graph-continue-on-failure: false

- run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:assembleDebug

test:
needs: compile
if: ${{ always() }} # even if compile didn't run (because not on main branch)
name: Tests without emulator
runs-on: ubuntu-latest
steps:
Expand All @@ -49,9 +50,9 @@ jobs:
- name: Run unit tests
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:testOseDebugUnitTest

# generates the build caches because it uses more gradle dependencies
test_on_emulator:
needs: compile
if: ${{ always() }} # even if compile didn't run (because not on main branch)
name: Tests with emulator
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 845ee92

Please sign in to comment.