-
-
Notifications
You must be signed in to change notification settings - Fork 3
201 lines (185 loc) · 6.24 KB
/
main.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: main
on:
push:
tags:
- '*'
branches:
- master
pull_request:
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
firestore-tests:
name: Test Firestore rules
runs-on: ubuntu-22.04
container: timbru31/java-node:21-jdk-iron
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn test
unit-tests-android:
name: Unit tests (Android)
runs-on: ubuntu-22.04
container: alvrme/alpine-android:android-34-jdk17
steps:
- uses: actions/checkout@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- run: ./gradlew --no-daemon --parallel testDebugUnitTest
unit-tests-jvm:
name: Unit tests (JVM)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Pull rulebooks test data
if: "! github.event.pull_request.head.repo.fork"
uses: actions/checkout@v2
with:
repository: fmasa/wfrp-master-rulebooks
token: ${{ secrets.RULEBOOKS_PULL_TOKEN }}
path: rulebooks
- name: Setup Rulebooks test config
if: "! github.event.pull_request.head.repo.fork"
run: sed -e "s,{GITHUB_WORKSPACE},$GITHUB_WORKSPACE,g" common/src/jvmTest/resources/config-ci.json > common/src/jvmTest/resources/config.json
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew jvmTest
ktlint:
name: Code style (ktlint)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew ktlintCheck
checks-passed:
name: Wait for all checks
needs:
- unit-tests-android
- unit-tests-jvm
- firestore-tests
- ktlint
runs-on: ubuntu-20.04
container:
image: fmasa/lebeda:7.4-ci
steps:
- run: "true"
build-bundle:
name: Build release bundle
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
needs: [checks-passed]
runs-on: ubuntu-22.04
container: alvrme/alpine-android:android-34-jdk17
environment: production
env:
KEYSTORE_FILE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- run: echo "$KEYSTORE_FILE_BASE64" | base64 -d > app/.keystore
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV
- run: 'echo "version code: $SUPPLY_VERSION_CODE, version name: $SUPPLY_VERSION_NAME"'
- run: ./gradlew bundleRelease
- run: mv app/build/outputs/bundle/release/app-release.aab .
- name: Upload bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: app-release.aab
retention-days: 1
google-play:
name: "Publish to Google Play"
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
needs: [build-bundle]
runs-on: ubuntu-22.04
container: ruby:2.7.2-alpine3.12
concurrency: google-play
environment: production
env:
PLAY_STORE_TRACK: internal
PLAY_STORE_JSON_FILE: ${{ secrets.PLAY_STORE_JSON_FILE }}
SUPPLY_UPLOAD_MAX_RETRIES: '5'
steps:
- uses: actions/checkout@v2
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: bundle
- run: apk add build-base
- run: echo "$PLAY_STORE_JSON_FILE" > fastlane/play_store_credentials.json
- run: bundle install -j $(nproc)
- run: bundle exec fastlane deploy
- run: '[ "$GITHUB_REF_TYPE" = "tag" ] && bundle exec fastlane production || echo "Skipped"'
firebase-deploy:
name: "Firebase deploy"
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
needs: [checks-passed]
runs-on: ubuntu-22.04
container: timbru31/java-node:21-jdk-iron
environment: production
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn firebase deploy
firestore-migrations:
name: "Firestore migrations"
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
needs: [checks-passed]
runs-on: ubuntu-22.04
container: timbru31/java-node:21-jdk-iron
environment: production
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn tsc
- id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
- run: yarn fireway migrate --path firebase-build/migrations