From dbc8cdfeddc40ac8f129d90f1681413e27b7732f Mon Sep 17 00:00:00 2001 From: Aleksandar Ilic Date: Wed, 27 Nov 2024 20:56:18 +0100 Subject: [PATCH] Improve Github workflows (#235) * 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; --- .github/workflows/PR-workflow.yml | 33 +++++++++++++++++++++---------- .github/workflows/tag-release.yml | 9 ++++++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/PR-workflow.yml b/.github/workflows/PR-workflow.yml index 6f3d9fa5c..07a23e122 100644 --- a/.github/workflows/PR-workflow.yml +++ b/.github/workflows/PR-workflow.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 13243a088..799fb0b1a 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -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: |