Merge pull request #132 from minvws/sync/20240104-130815 #150
This file contains 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: Build test and distribute | |
on: | |
push: | |
branches: | |
- main | |
- 'release/*' | |
pull_request: | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: setup | |
uses: ./.github/actions/setup | |
- name: Spotless | |
run: ./gradlew spotlessCheck | |
- name: Test | |
run: ./gradlew testAccDebugUnitTest | |
- name: Emulator Test | |
if: "!contains(github.event.pull_request.labels.*.name, 'skip-screenshot-tests')" | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
script: ./gradlew accDebugExecuteScreenshotTests | |
profile: pixel | |
- name: Archive test-results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: | | |
holder/build/reports | |
retention-days: 2 | |
distribute: | |
if: ${{ (github.event.repository.name == 'nl-covid19-coronacheck-app-android-private' && (github.ref == 'refs/heads/main' || contains(github.event.ref, 'release/') || contains(github.event.pull_request.labels.*.name, 'generate-builds'))) }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_URL }} | |
SLACK_MESSAGE: 'New build for Android :android:' | |
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} | |
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} | |
runs-on: ubuntu-latest | |
needs: [ "build-and-test" ] | |
steps: | |
- uses: actions/checkout@v3 | |
- id: setup | |
uses: ./.github/actions/setup | |
- name: Write key store | |
run: echo $KEYSTORE_FILE | base64 --decode > keystore.jks | |
- name: Set version number | |
run: | | |
version=$(( $GITHUB_RUN_NUMBER )) | |
echo VERSION_NUMBER=$version >> $GITHUB_ENV | |
- name: Build | |
run: ./gradlew :holder:assemAccRelease :holder:assemProdRelease :holder:bundleProdRelease | |
- name: Build fdroid | |
if: ${{ env.GENERATE_FDROID_BUILDS == 'true' }} | |
run: ./gradlew assemFdroidAccRelease assemFdroidProdRelease | |
- name: Clean up key store | |
run: rm keystore.jks | |
- name: Archive apks | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apks | |
path: | | |
holder/build/outputs/apk | |
retention-days: 5 | |
- name: Archive bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bundle | |
path: | | |
holder/build/outputs/bundle | |
retention-days: 5 | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: apks | |
path: apks | |
- name: Install firebase-cli | |
uses: littlerobots/firebase-action@0bd9bd607cbc96e84fa2a95f74d1b31c93e56f5e | |
with: | |
serviceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Distribute holder acc variant | |
run: | | |
firebase appdistribution:distribute `ls apks/acc/release/holder-*.apk` \ | |
--app 1:168257592968:android:5df6b2057b90a30826493d \ | |
--groups testers | |
- name: Distribute holder fdroid acc variant | |
if: ${{ env.GENERATE_FDROID_BUILDS == 'true' }} | |
run: | | |
firebase appdistribution:distribute `ls apks/fdroidAcc/release/holder-*.apk` \ | |
--app 1:168257592968:android:28c578809115867926493d \ | |
--groups testers | |
- name: Distribute holder prod variant | |
run: | | |
firebase appdistribution:distribute `ls apks/prod/release/holder-*.apk` \ | |
--app 1:168257592968:android:aaa5afb416536fdb26493d \ | |
--groups testers | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |