-
Notifications
You must be signed in to change notification settings - Fork 7
160 lines (154 loc) · 5.97 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
name: Nightly Android builds
on:
push:
branches:
- main
- build/nightly-android-test-deploy
workflow_dispatch:
# schedule:
# - cron: '39 20 * * 1-5'
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@v4
with:
fetch-depth: 0
- name: Check for changes
id: check
run: |
git diff --quiet @{yesterday}.. || echo "changed=true" >> $GITHUB_OUTPUT
node-deb-gh-build-play:
runs-on: ubuntu-latest
needs: check_date
if: ${{ needs.check_date.outputs.changed == 'true' }}
continue-on-error: false
env:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
strategy:
matrix:
node-version: ['20']
steps:
- name: Configure Turborepo Remote Cache
run: |
mkdir -p .turbo
if [ -n "${{ vars.TURBO_API_URL }}" ]; then
echo '{"apiurl": "${{ vars.TURBO_API_URL }}"}' > .turbo/config.json
echo "Turborepo config file created at .turbo/config.json"
else
echo "TURBO_API_URL not set. Skipping Turborepo cache configuration."
fi
if [ -n "$TURBO_TEAM" ] && [ -n "$TURBO_TOKEN" ]; then
echo "TURBO_TEAM and TURBO_TOKEN environment variables set"
else
echo "TURBO_TEAM and/or TURBO_TOKEN not set. Remote caching may not be available."
fi
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
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 }}-
- name: Install jq
run: sudo apt-get install -y jq
- name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "app_version=$(jq -r '.version' app/package.json)" >> "$GITHUB_ENV"
- name: Create version string
shell: bash
run: |
echo "version_string=v${{env.app_version}}-android-#${{env.sha_short}}" >> "$GITHUB_ENV"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
- name: Cache Gradle packages
uses: actions/cache@v4
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@v4
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@v4
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: 3.3.1
bundler-cache: true
working-directory: app/android
- 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@v3
- name: Building webapp
run: |
export platform="github-actions-play"
export serverprefix="testing"
export VITE_CLUSTER_ADMIN_GROUP_NAME=cluster-admin
export VITE_COMMIT_VERSION=${{env.version_string}}
export VITE_SHOW_WIPE=true
export VITE_SHOW_MINIFAUXTON=true
export VITE_CONDUCTOR_URL=${{env.NIGHTLY_CONDUCTOR_URL}}
export VITE_PRODUCTION_BUILD=true
export VITE_SERVICES=FAIMSTEXT
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: npm run app-update android --workspace=@faims3/app
- run: npm run webapp-sync --workspace=@faims3/app -- --deployment android
- name: Fastlane
run: |
cd app/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: ${{env.version_string}}
# - run: cd android && ./gradlew assembleDebug
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: assets
path: |
${{ github.workspace }}/app/android/app/build/outputs/bundle/release