-
Notifications
You must be signed in to change notification settings - Fork 327
223 lines (201 loc) · 7.9 KB
/
build-mobile-external.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: "@Mobile • Build App (external)"
run-name: "@Mobile • Build App (external) triggered by ${{ inputs.login }} ${{ format('on ref {0}', github.ref_name) }}"
on:
workflow_dispatch:
inputs:
ref:
description: the branch which triggered this workflow
required: false
login:
description: The GitHub username that triggered the workflow
required: true
base_ref:
description: The base branch to merge the head into when checking out the code
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-mobile-app-android:
name: "Build Ledger Live Mobile (Android)"
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop
with:
ref: ${{ github.ref_name }}
base: ${{ inputs.base_ref }}
- name: set git user
run: |
git config user.email "105061298+live-github-bot[bot]@users.noreply.github.com"
git config user.name "live-github-bot[bot]"
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
env:
ImageOS: ubuntu20
- uses: actions/setup-java@v3
with:
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "11"
- name: setup Android SDK
uses: android-actions/setup-android@v2.0.10
- name: install dependencies
run: pnpm i --filter="live-mobile..." --filter="ledger-live" --no-frozen-lockfile --unsafe-perm
- uses: ./tools/actions/get-package-infos
id: version
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: set beta name
uses: ./tools/actions/change-product-name
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: Get short SHA
id: slug
run: echo "sha8=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: make local version
env:
VERSION: ${{ steps.version.outputs.clean }}-sha.${{ steps.slug.outputs.sha8 }}
run: cd apps/ledger-live-mobile && npm version $VERSION
- name: TurboRepo local caching server
id: turborepo-cache-server
uses: ./tools/actions/turborepo-s3-cache
with:
server-token: "yolo"
cleanup-cache-folder: "true"
aws-access-key: ${{ secrets.AWS_S3_CACHE_ACCESS_KEY }}
aws-secret-key: ${{ secrets.AWS_S3_CACHE_SECRET_KEY }}
- name: build the app
env:
ANDROID_KEYSTORE_PASS: staging
ANDROID_KEY_ALIAS: staging
ANDROID_KEY_PASS: staging
NODE_OPTIONS: "--max-old-space-size=7168"
ANDROID_KEYSTORE_FILE: ${{ github.workspace }}/apps/ledger-live-mobile/android/app/staging.kstr
run: pnpm build:llm:android --api="http://127.0.0.1:${{ steps.turborepo-cache-server.outputs.port }}" --token="yolo" --team="foo"
- uses: ./tools/actions/get-package-infos
id: post-version
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: upload Android app
uses: actions/upload-artifact@v3
with:
name: ${{ steps.post-version.outputs.version }}-release
path: ${{ github.workspace }}/apps/ledger-live-mobile/android/app/build/outputs/apk/release
build-mobile-app-ios:
runs-on: macos-latest
name: "Build Ledger Live Mobile (Mac OS X)"
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop
with:
ref: ${{ github.ref_name }}
base: ${{ inputs.base_ref }}
- name: set git user
run: |
git config user.email "105061298+live-github-bot[bot]@users.noreply.github.com"
git config user.name "live-github-bot[bot]"
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
- name: Cache LLM pods
uses: actions/cache@v3
with:
path: |
apps/ledger-live-mobile/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('apps/ledger-live-mobile/ios/Podfile.lock') }}
- name: install dependencies
run: pnpm i --filter="live-mobile..." --filter="ledger-live" --no-frozen-lockfile --unsafe-perm
report:
runs-on: ubuntu-latest
needs: [build-mobile-app-android, build-mobile-app-ios]
if: always() && !cancelled() && github.event_name == 'workflow_dispatch'
steps:
- uses: actions/github-script@v6
name: get statuses of runs
id: status
with:
script: |
const fs = require("fs");
const statuses = [
"${{ needs.build-mobile-app-android.result }}",
"${{ needs.build-mobile-app-ios.result }}",
];
const [ owner, repo ] = "${{ github.repository }}".split("/");
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRunAttempt, {
owner,
repo,
run_id: "${{ github.run_id }}",
attempt_number: "${{ github.run_attempt }}",
});
const findJobUrl = os =>
jobs.find(job => job.name == `Build Ledger Live Mobile (${os})`)?.html_url;
const keys = {
ios: {
symbol: "🍏",
name: "iOS",
jobUrl: findJobUrl("Mac OS X")
},
android: {
symbol: "🤖",
name: "Android",
jobUrl: findJobUrl("Android")
},
};
const report = {
android: {
pass: ${{ needs.build-mobile-app-android.result == 'success' }},
status: "${{ needs.build-mobile-app-android.result }}",
},
ios: {
pass: ${{ needs.build-mobile-app-ios.result == 'success' }},
status: "${{ needs.build-mobile-app-ios.result }}",
},
};
const isFailed = statuses.some(e => e === "failure");
const isCancelled = statuses.some(e => e === "cancelled");
const iosSuccess = report.ios.pass;
let summary = ``;
summary += `|`
const reportKeys = Object.keys(report);
reportKeys.forEach((k) => {
summary += ` [${keys[k].symbol} ${keys[k].name}](${keys[k].jobUrl}) |`;
});
summary += `
|`;
for (let i = 0; i < reportKeys.length; i++) {
summary += ` :--: |`;
}
summary += `
|`;
Object.entries(report).forEach(([os, values]) => {
summary += ` ${values.pass ? "✅" : "❌"} (${values.status}) |`;
});
summary += `
[⚙️ Summary](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }})
`;
const output = {
summary,
actions: iosSuccess ? [] : [{
// 20 chars max
label: "Regen. Pods",
// 20 chars max
identifier: "regen_pods",
// 40 chars max
description: "Will regenerate cocoapods lockfile",
}],
}
fs.writeFileSync("summary.json", JSON.stringify(output), "utf-8");
- uses: actions/upload-artifact@v3
name: upload output
with:
path: ${{ github.workspace }}/summary.json
name: summary.json