-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (51 loc) · 2.82 KB
/
onTestWorkflow.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
name: "(▶) E2E Test"
on:
push:
env:
CI: true
LANG: en_US.UTF-8
API_LEVEL: 34
concurrency:
group: ci-e2e-test-${{ github.ref }}
cancel-in-progress: true
jobs:
uploadApk:
name: 'Upload apk'
runs-on: macos-latest-xl
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: "0"
- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Config root certificate for testing
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const securityConfig = `<network-security-config>\n <base-config>\n <trust-anchors>\n <!-- Trust preinstalled CAs -->\n <certificates src="system" />\n <!-- Additionally trust user added CAs -->\n <certificates src="user" />\n </trust-anchors>\n </base-config>\n</network-security-config>`
fs.mkdirSync(path.join(process.env.GITHUB_WORKSPACE, 'embedded/src/main/res/xml'), { recursive: true });
fs.writeFileSync(path.join(process.env.GITHUB_WORKSPACE, 'embedded/src/main/res/xml/network_security_config.xml'), securityConfig, 'utf8');
let manifest = fs.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'embedded/src/main/AndroidManifest.xml'), 'utf8');
manifest = manifest.replace(/<application/g, '<application android:networkSecurityConfig="@xml/network_security_config"');
fs.writeFileSync(path.join(process.env.GITHUB_WORKSPACE, 'embedded/src/main/AndroidManifest.xml'), manifest, 'utf8');
- name: Clean build
run: ./gradlew clean
- name: Build debug test apk
run: ./gradlew :embedded:assembleDebug -Pandroid.injected.signing.store.file="${{ github.workspace }}/.github/test-jks/debug.keystore" -Pandroid.injected.signing.store.password="android" -Pandroid.injected.signing.key.alias="androiddebugkey" -Pandroid.injected.signing.key.password="android"
- name: Build release test apk
run: ./gradlew :embedded:assembleRelease -Pandroid.injected.signing.store.file="${{ github.workspace }}/.github/test-jks/release.keystore" -Pandroid.injected.signing.store.password="android" -Pandroid.injected.signing.key.alias="androidreleasekey" -Pandroid.injected.signing.key.password="android"
- name: Upload a Assemble Debug Artifact
uses: actions/[email protected]
with:
name: test-debug.apk
path: embedded/build/outputs/apk/debug/embedded-debug.apk
- name: Upload a Assemble Release Artifact
uses: actions/[email protected]
with:
name: test-release.apk
path: embedded/build/outputs/apk/release/embedded-release.apk