show test summary for CI job #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| # pull_request: | |
| # branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| flavor: [prod] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Good practice for git-based versioning | |
| - name: set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Generate Version Info | |
| id: vars | |
| run: | | |
| # 558 is your base version code. github.run_number increments by 1 every build. | |
| echo "version_code=$((558 + ${{ github.run_number }}))" >> $GITHUB_OUTPUT | |
| echo "short_hash=-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Build with Gradle | |
| # We capitalize the flavor name (dev -> Dev) to match the Gradle task: assembleDevRelease | |
| run: | | |
| FLAVOR_CAPITALIZED=$(echo ${{ matrix.flavor }} | sed 's/./\u&/') | |
| ./gradlew "assemble${FLAVOR_CAPITALIZED}Release" \ | |
| -PnewVersionCode=${{ steps.vars.outputs.version_code }} \ | |
| -PversionNameSuffix=${{ steps.vars.outputs.short_hash }} | |
| - name: Run Unit Tests | |
| run: | | |
| ./gradlew testProdReleaseUnitTest | |
| - name: Sign APK | |
| uses: ilharp/sign-android-release@v2 | |
| id: sign_app | |
| with: | |
| releaseDir: app/build/outputs/apk/${{ matrix.flavor }}/release | |
| signingKey: ${{ secrets.SIGNING_KEY }} | |
| keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }} | |
| keyStorePassword: ${{ secrets.SIGNING_KEY_STORE_PASSWORD }} | |
| keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
| buildToolsVersion: 36.1.0 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ActivityManager-${{ matrix.flavor }}-${{ steps.vars.outputs.version_code }} | |
| path: ${{ steps.sign_app.outputs.signedFile }} | |
| archive: false | |
| - name: Test Summary | |
| uses: test-summary/action@v2 | |
| with: | |
| paths: "app/build/test-results/**/TEST-*.xml" | |
| if: always() # Ensure this runs even if tests fail |