Sync public repo from private repository #144
Workflow file for this run
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: | |
env: | |
WEB_PDF_TOOLS_COMMIT_HASH: 530e22f23d98dc41c1611b1ecfb18719e5ab2570 # v4.1.6 | |
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: Archive mobile core dependency | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mobilecore | |
path: | | |
mobilecore/mobilecore.aar | |
retention-days: 2 | |
- name: Spotless | |
run: ./gradlew spotlessCheck | |
- name: Test | |
run: ./gradlew testDebug testAccDebug holder:lintAccDebug verifier:lintAccDebug | |
- 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 | |
verifier/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 }} | |
GENERATE_FDROID_BUILDS: ${{ contains(github.event.pull_request.labels.*.name, 'generate-fdroid-builds') }} | |
GENERATE_VERIFIER_BUILDS: ${{ contains(github.event.pull_request.labels.*.name, 'generate-verifier-builds') }} | |
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 pdf tools | |
uses: ./.github/actions/build-web-pdf-tools | |
with: | |
web_pdf_tools_commit_hash: ${{ env.WEB_PDF_TOOLS_COMMIT_HASH }} | |
- name: Build | |
run: ./gradlew :holder:assemAccRelease :holder:assemProdRelease :holder:bundleProdRelease | |
- name: Build fdroid | |
if: ${{ env.GENERATE_FDROID_BUILDS == 'true' }} | |
run: ./gradlew assemFdroidAccRelease assemFdroidProdRelease | |
- name: Build verifier | |
if: ${{ env.GENERATE_VERIFIER_BUILDS == 'true' }} | |
run: ./gradlew :verifier:assemAccRelease :verifier:assemProdRelease :verifier:bundleProdRelease | |
- 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 | |
verifier/build/outputs/apk | |
retention-days: 5 | |
- name: Archive bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bundle | |
path: | | |
holder/build/outputs/bundle | |
verifier/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/holder/build/outputs/apk/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/holder/build/outputs/apk/fdroidAcc/release/holder-*.apk` \ | |
--app 1:168257592968:android:28c578809115867926493d \ | |
--groups testers | |
- name: Distribute holder prod variant | |
run: | | |
firebase appdistribution:distribute `ls apks/holder/build/outputs/apk/prod/release/holder-*.apk` \ | |
--app 1:168257592968:android:aaa5afb416536fdb26493d \ | |
--groups testers | |
- name: Distribute verifier acc variant | |
if: ${{ env.GENERATE_VERIFIER_BUILDS == 'true' }} | |
run: | | |
firebase appdistribution:distribute `ls apks/verifier/build/outputs/apk/acc/release/verifier-*.apk` \ | |
--app 1:168257592968:android:e9d445c4115a5c9d26493d \ | |
--groups testers | |
- name: Distribute verifier fdroid acc variant | |
if: ${{ env.GENERATE_FDROID_BUILDS == 'true' }} | |
run: | | |
firebase appdistribution:distribute `ls apks/verifier/build/outputs/apk/fdroidAcc/release/verifier-*.apk` \ | |
--app 1:168257592968:android:a5a6c5d5af1c18c726493d \ | |
--groups testers | |
- name: Distribute verifier prod variant | |
if: ${{ env.GENERATE_VERIFIER_BUILDS == 'true' }} | |
run: | | |
firebase appdistribution:distribute `ls apks/verifier/build/outputs/apk/prod/release/verifier-*.apk` \ | |
--app 1:168257592968:android:79363a1282863aac26493d \ | |
--groups testers | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |