-
Notifications
You must be signed in to change notification settings - Fork 28
116 lines (105 loc) · 3.83 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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