-
Notifications
You must be signed in to change notification settings - Fork 7
176 lines (169 loc) · 6.93 KB
/
nightly-android-testbuild.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
---
# Nightly compile for e2e testing
name: Nightly Android builds
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '39 20 * * 1-5'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.commitswithintime.outputs.has-new-commits-within-time }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run CommitsWithinTime script
uses: AlexHolderDeveloper/CommitsWithinTime@v1.1.11
id: commitswithintime
with:
days: 1
- name: Get the output from CommitsWithinTime
run: |
echo "The 'has-new-commits-within-time' value is ${{ steps.commitswithintime.outputs.has-new-commits-within-time }}"
echo "The 'number-of-commits-within-time' value is ${{ steps.commitswithintime.outputs.number-of-commits-within-time }}"
echo "The 'total-commits' value is ${{ steps.commitswithintime.outputs.total-commits }}"
node-deb-gh-build-play:
# The type of runner that the job will run on
# https://github.com/Apple-Actions/Example-iOS/blob/master/.github/workflows/test.yml
runs-on: ubuntu-latest
needs: check_date
if: ${{ needs.check_date.outputs.should_run == 'true' }}
continue-on-error: false
strategy:
matrix:
node-version: ['20']
outputs:
prnum: ${{ steps.prnum.outputs.value }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
- name: Set up adopt JDK 1.17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
# https://www.runway.team/blog/ci-cd-pipeline-android-app-fastlane-github-actions
# Because fastlane stuff is in android, we need working-directory
- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.5
bundler-cache: true
working-directory: android
# We'll do this when we have android-specific tests...
# - name: Run tests
# run: |
# cd android
# bundle exec fastlane android test
# echo -n "::set-output name=value::$(git log --perl-regexp --pretty='%s' | grep 'Merge #' | head -n1 | cut -d'#' -f2)-$(git describe --long 2>/dev/null || git describe --all --long --always)"
- name: Get PR Number
id: prnum
run: |
echo -n "value=$(bin/getDescribeString.sh gh-play)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Decode Service Account Key JSON File
uses: timheuer/base64-to-file@v1
id: service_account_json_file
with:
fileName: "fastlane-android-google-play-key.json"
encodedString: ${{ secrets.GPLAY_SERVICE_ACCOUNT_KEY_JSON }}
- name: Decode Keystore File
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: "android-signing-keystore.jks"
encodedString: ${{ secrets.KEYSTORE_FILE }}
# https://github.com/android-actions/setup-android
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Building webapp
run: |
export platform="github-actions-play"
export serverprefix="testing"
export VITE_CLUSTER_ADMIN_GROUP_NAME=cluster-admin
export VITE_COMMIT_VERSION=$(bin/getDescribeString.sh testing-android)
export VITE_SHOW_WIPE=true
export VITE_SHOW_NEW_NOTEBOOK=true
export VITE_SHOW_MINIFAUXTON=true
export VITE_DIRECTORY_HOST=db.testing.fieldmark.app
export VITE_DIRECTORY_PORT=443
export VITE_PRODUCTION_BUILD=true
export VITE_SERVICES=FAIMSTEXT
export VITE_USE_REAL_DATA=true
export VITE_PROD_BUILD=true
export VITE_TAG=prodAndroid
export VITE_BUGSNAG_KEY=${{secrets.BUGSNAG_KEY}}
git clean -xfd
npm ci
npm run build
# https://capacitorjs.com/docs/android
# The bundle install shouldn't be necessary, but given we've got ios and android in...
- run: npx cap update android
- run: npx cap sync --deployment android
- name: Fastlane
run: |
cd android
bundle install
bundle exec fastlane deploy_fieldmark_closed_track
env:
JAVA_KEYSTORE: ${{ steps.android_keystore.outputs.filePath }}
JAVA_KEYSTORE_PASSWORD: ${{ secrets.JAVA_KEYSTORE_PASSWORD }}
JAVA_KEY: ${{ secrets.JAVA_KEY}}
JAVA_KEY_PASSWORD: ${{ secrets.JAVA_KEY_PASSWORD }}
ANDROID_JSON_KEY_FILE: ${{ steps.service_account_json_file.outputs.filePath }}
serverprefix: "testing"
prnum: ${{steps.prnum.outputs.value}}
# - run: cd android && ./gradlew assembleDebug
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: assets
path: |
${{ github.workspace }}/android/app/build/outputs/bundle/release
# - uses: "marvinpinto/action-automatic-releases@latest"
# with:
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
# automatic_release_tag: "latest-android"
# prerelease: true
# title: "Android APK Development Build"
# files: |
# LICENSE
# *.apk