From e4dcf05b19692f43efa512b1a18e49a210867fa0 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Sat, 31 May 2025 15:51:40 +0100 Subject: [PATCH] Execute spotless before building the project This will avoid building the entire project just to find out there is a formatting issue that will be committed/pushed and automatically cancel the current workflow. Also, moving the required permission to the closest scope it needs (job). --- .github/workflows/build_and_test.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1fd2b36f..882319ff 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -12,14 +12,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true -permissions: - contents: write # Needed for git-auto-commit-action - jobs: build_test_lint: name: "Build, Test, and Lint" runs-on: ubuntu-latest timeout-minutes: 60 + permissions: + contents: write # Needed for git-auto-commit-action steps: - name: Checkout code @@ -40,9 +39,6 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Build debug APK - run: ./gradlew assembleDebug --no-configuration-cache - - name: Apply Spotless run: ./gradlew spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache @@ -52,6 +48,9 @@ jobs: commit_message: 🤖 Apply Spotless formatting file_pattern: '**/*.kt **/*.kts **/*.java **/*.xml' + - name: Build debug APK + run: ./gradlew assembleDebug --no-configuration-cache + - name: Verify Screenshot Tests (AndroidX) run: ./gradlew validateDebugScreenshotTest @@ -143,4 +142,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: test-reports-${{ matrix.api-level }} - path: '**/build/reports/androidTests' \ No newline at end of file + path: '**/build/reports/androidTests'