Skip to content

Commit

Permalink
Improve Github workflows (#235)
Browse files Browse the repository at this point in the history
* Update PR workflow to use compile instead assemble;
* Add caching gradle to speed up builds in release and PR workflows;
* Update checkout and setup-java to v4 in PR workflow;
* Remove matrix strategy and run tests only on AOSP build in PR workflow;
  • Loading branch information
AleksandarIlic authored and markocic committed Nov 28, 2024
1 parent 33b0a10 commit dbc8cdf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/PR-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,36 @@ on:
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
flavor: [Aosp, Google]

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Cache gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Check detekt
run: ./gradlew detekt

- name: Check lint
run: ./gradlew lint
- name: Run tests on ${{ matrix.flavor }} flavour
run: ./gradlew test${{ matrix.flavor }}DebugUnitTest
- name: Assemble ${{ matrix.flavor }} debug build
run: ./gradlew assemble${{ matrix.flavor }}Debug

- name: Run tests on AOSP flavour
run: ./gradlew testAospDebugUnitTest

- name: Compile AOSP debug build to verify no-compilation errors
run: ./gradlew compileAospDebugKotlin

- name: Compile Google debug build to verify no-compilation errors
run: ./gradlew compileGoogleDebugKotlin
9 changes: 8 additions & 1 deletion .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Cache gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Unpack secrets
run: |
Expand Down

0 comments on commit dbc8cdf

Please sign in to comment.