|
| 1 | +name: Android CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + api-check: |
| 7 | + description: 'Whether to run API checks' |
| 8 | + required: false |
| 9 | + type: boolean |
| 10 | + default: true |
| 11 | + |
| 12 | + secrets: |
| 13 | + BUILD_CACHE_AWS_REGION: |
| 14 | + required: false |
| 15 | + BUILD_CACHE_AWS_BUCKET: |
| 16 | + required: false |
| 17 | + BUILD_CACHE_AWS_ACCESS_KEY_ID: |
| 18 | + required: false |
| 19 | + BUILD_CACHE_AWS_SECRET_KEY: |
| 20 | + required: false |
| 21 | + |
| 22 | +env: |
| 23 | + BUILD_CACHE_AWS_REGION: ${{ secrets.BUILD_CACHE_AWS_REGION }} |
| 24 | + BUILD_CACHE_AWS_BUCKET: ${{ secrets.BUILD_CACHE_AWS_BUCKET }} |
| 25 | + BUILD_CACHE_AWS_ACCESS_KEY_ID: ${{ secrets.BUILD_CACHE_AWS_ACCESS_KEY_ID }} |
| 26 | + BUILD_CACHE_AWS_SECRET_KEY: ${{ secrets.BUILD_CACHE_AWS_SECRET_KEY }} |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + name: Build |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main |
| 35 | + - name: Build |
| 36 | + run: ./gradlew assembleDebug --scan |
| 37 | + |
| 38 | + static-checks: |
| 39 | + name: Run static checks |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main |
| 44 | + - name: Spotless |
| 45 | + run: ./gradlew spotlessCheck |
| 46 | + - name: Lint |
| 47 | + if: always() |
| 48 | + run: ./gradlew lint |
| 49 | + - name: API check |
| 50 | + if: always() && inputs.api-check == 'true' |
| 51 | + run: ./gradlew apiCheck |
| 52 | + |
| 53 | + unit-test: |
| 54 | + name: Run unit tests |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + - uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main |
| 59 | + - name: Run unit tests |
| 60 | + run: ./gradlew testCoverage --scan --stacktrace |
| 61 | + - name: Upload tests results |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + if: failure() |
| 64 | + with: |
| 65 | + name: unit-tests-results |
| 66 | + path: ./**/build/reports/tests/** |
| 67 | + - name: Sonar |
| 68 | + if: github.event.pull_request.head.repo.full_name == github.repository |
| 69 | + run: ./gradlew sonar |
| 70 | + env: |
| 71 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 72 | + - name: Sonar skipped if PR from fork |
| 73 | + if: github.event.pull_request.head.repo.full_name != github.repository |
| 74 | + run: echo "⚠️ Sonar skipped because the PR comes from a fork." |
0 commit comments