Skip to content

Commit be20da4

Browse files
committed
ci: split build, test and reporting (#179)
1 parent 226fc19 commit be20da4

File tree

2 files changed

+96
-76
lines changed

2 files changed

+96
-76
lines changed

.github/workflows/ci.yml renamed to .github/workflows/ci-build-and-test.yml

Lines changed: 14 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ on:
77
- develop
88

99
env:
10-
node-version: 12
1110
android-api-level: 31
11+
android-avd-name: Pixel_3_API_S_1
12+
android-avd-ram-size: 1024M
13+
android-sdk-root: /Users/ely/Library/Android/sdk
14+
android-adb-command-timeout-milliseconds: 20_000L
15+
android-promise-timeout-milliseconds: 75_000L
16+
node-version: 12
1217

1318
jobs:
1419
build-typescript-linux:
@@ -124,19 +129,20 @@ jobs:
124129
with:
125130
path: node_modules
126131
key: yarn-${{ hashFiles('**/yarn.lock') }}
127-
- uses: reactivecircus/android-emulator-runner@v2.20.0
132+
- uses: reactivecircus/android-emulator-runner@v2.21.0
128133
env:
129-
ANDROID_SDK_ROOT: ${{ secrets.ANDROID_SDK_ROOT }}
130-
ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS: ${{ secrets.ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS }}
131-
ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS: ${{ secrets.ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS }}
134+
ANDROID_SDK_ROOT: ${{ env.android-sdk-root }}
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS: ${{ env.android-adb-command-timeout-milliseconds }}
137+
ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS: ${{ env.android-promise-timeout-milliseconds }}
132138
TARGET: android:instrumented
133139
with:
134140
api-level: ${{ env.android-api-level }}
135141
arch: arm64-v8a
136-
avd-name: ${{ secrets.ANDROID_AVD_NAME }}
142+
avd-name: ${{ env.android-avd-name }}
137143
emulator-options: -no-snapshot -noaudio -no-boot-anim
138144
force-avd-creation: false
139-
ram-size: ${{ secrets.ANDROID_AVD_RAM_SIZE }}
145+
ram-size: ${{ env.android-avd-ram-size }}
140146
script: |
141147
adb logcat -c
142148
adb logcat | tee android_instrumented_logcat.log | grep 'io.deckers.blob_courier' &
@@ -180,72 +186,4 @@ jobs:
180186
- uses: actions/upload-artifact@v2
181187
with:
182188
name: ios-test-results
183-
path: build/reports/**/*.xml
184-
publish-typescript-test-results:
185-
needs:
186-
- run-typescript-tests
187-
runs-on: ubuntu-latest
188-
steps:
189-
- uses: actions/download-artifact@v2
190-
with:
191-
name: ts-test-results
192-
path: report-ts
193-
- uses: EnricoMi/[email protected]
194-
with:
195-
check_name: "Tests: TypeScript"
196-
comment_title: TypeScript Test Report
197-
deduplicate_classes_by_file_name: false
198-
files: report-ts/**/*.xml
199-
github_token: ${{ secrets.GITHUB_TOKEN }}
200-
hide_comments: all but latest
201-
report_individual_runs: true
202-
publish-android-test-results:
203-
needs:
204-
- run-android-unit-tests
205-
- run-android-instrumented-tests
206-
runs-on: ubuntu-latest
207-
steps:
208-
- uses: actions/download-artifact@v2
209-
with:
210-
name: android-unit-test-results
211-
path: report-android-unit
212-
- uses: actions/download-artifact@v2
213-
with:
214-
name: android-instrumented-test-results
215-
path: report-android-instrument
216-
- uses: EnricoMi/[email protected]
217-
with:
218-
check_name: "Tests: Android - Unit"
219-
comment_title: Android Unit Test Report
220-
deduplicate_classes_by_file_name: false
221-
files: report-android-unit/**/*.xml
222-
github_token: ${{ secrets.GITHUB_TOKEN }}
223-
hide_comments: all but latest
224-
report_individual_runs: true
225-
- uses: EnricoMi/[email protected]
226-
with:
227-
check_name: "Tests: Android - Instrumented"
228-
comment_title: Android Instrumented Test Report
229-
deduplicate_classes_by_file_name: false
230-
files: report-android-instrument/**/*.xml
231-
github_token: ${{ secrets.GITHUB_TOKEN }}
232-
hide_comments: all but latest
233-
report_individual_runs: true
234-
publish-ios-test-results:
235-
needs:
236-
- run-ios-tests
237-
runs-on: ubuntu-latest
238-
steps:
239-
- uses: actions/download-artifact@v2
240-
with:
241-
name: ios-test-results
242-
path: report-ios
243-
- uses: EnricoMi/[email protected]
244-
with:
245-
check_name: "Tests: iOS"
246-
comment_title: iOS Test Report
247-
deduplicate_classes_by_file_name: false
248-
files: report-ios/**/*.xml
249-
github_token: ${{ secrets.GITHUB_TOKEN }}
250-
hide_comments: all but latest
251-
report_individual_runs: true
189+
path: build/reports/**/*.xml
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish test results
2+
on:
3+
workflow_run:
4+
workflows: ["Build and test"]
5+
types:
6+
- completed
7+
8+
jobs:
9+
publish-test-results:
10+
runs-on: ubuntu-latest
11+
if: github.event.workflow_run.conclusion != 'skipped'
12+
steps:
13+
# https://github.com/LouisBrunner/checks-action/issues/22#issuecomment-885047551
14+
- name: Recognize sha ref
15+
id: sharef
16+
run: |
17+
if [ "$EVENT" == 'workflow_run' ]
18+
then
19+
echo "::set-output name=sha::$(echo ${{github.event.workflow_run.head_sha}})"
20+
fi
21+
env:
22+
EVENT: ${{ github.event_name }}
23+
REF: ${{ github.ref }}
24+
# https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
25+
- name: Download and Extract Artifacts
26+
env:
27+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
28+
run: |
29+
mkdir -p artifacts && cd artifacts
30+
31+
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
32+
33+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
34+
do
35+
IFS=$'\t' read name url <<< "$artifact"
36+
gh api $url > "$name.zip"
37+
unzip -d "$name" "$name.zip"
38+
done
39+
- name: Publish TypeScript Test Report
40+
uses: EnricoMi/[email protected]
41+
with:
42+
check_name: "Tests: TypeScript"
43+
comment_title: TypeScript Test Report
44+
commit: ${{steps.sharef.outputs.sha}}
45+
deduplicate_classes_by_file_name: false
46+
files: artifacts/ts-test-results/**/*.xml
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
hide_comments: all but latest
49+
report_individual_runs: true
50+
- name: Publish Android Unit Test Report
51+
uses: EnricoMi/[email protected]
52+
with:
53+
check_name: "Tests: Android - Unit"
54+
comment_title: Android Unit Test Report
55+
commit: ${{steps.sharef.outputs.sha}}
56+
deduplicate_classes_by_file_name: false
57+
files: artifacts/android-unit-test-results/**/*.xml
58+
github_token: ${{ secrets.GITHUB_TOKEN }}
59+
hide_comments: all but latest
60+
report_individual_runs: true
61+
- name: Publish Android Instrumented Test Report
62+
uses: EnricoMi/[email protected]
63+
with:
64+
check_name: "Tests: Android - Instrumented"
65+
comment_title: Android Instrumented Test Report
66+
commit: ${{steps.sharef.outputs.sha}}
67+
deduplicate_classes_by_file_name: false
68+
files: artifacts/android-instrumented-test-results/**/*.xml
69+
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
hide_comments: all but latest
71+
report_individual_runs: true
72+
- name: Publish iOS Test Report
73+
uses: EnricoMi/[email protected]
74+
with:
75+
check_name: "Tests: iOS"
76+
comment_title: iOS Test Report
77+
commit: ${{steps.sharef.outputs.sha}}
78+
deduplicate_classes_by_file_name: false
79+
files: artifacts/ios-test-results/**/*.xml
80+
github_token: ${{ secrets.GITHUB_TOKEN }}
81+
hide_comments: all but latest
82+
report_individual_runs: true

0 commit comments

Comments
 (0)