Skip to content

Commit

Permalink
ci: split build, test and reporting (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
edeckers committed Dec 24, 2021
1 parent 226fc19 commit e24f2d7
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ on:
- develop

env:
node-version: 12
android-api-level: 31
android-avd-name: Pixel_3_API_S_1
android-avd-ram-size: 1024M
android-sdk-root: /Users/ely/Library/Android/sdk
android-adb-command-timeout-milliseconds: 20_000L
android-promise-timeout-milliseconds: 75_000L
node-version: 12

jobs:
build-typescript-linux:
Expand Down Expand Up @@ -124,19 +129,20 @@ jobs:
with:
path: node_modules
key: yarn-${{ hashFiles('**/yarn.lock') }}
- uses: reactivecircus/android-emulator-runner@v2.20.0
- uses: reactivecircus/android-emulator-runner@v2.21.0
env:
ANDROID_SDK_ROOT: ${{ secrets.ANDROID_SDK_ROOT }}
ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS: ${{ secrets.ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS }}
ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS: ${{ secrets.ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS }}
ANDROID_SDK_ROOT: ${{ env.android-sdk-root }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_ADB_COMMAND_TIMEOUT_MILLISECONDS: ${{ env.android-adb-command-timeout-milliseconds }}
ORG_GRADLE_PROJECT_PROMISE_TIMEOUT_MILLISECONDS: ${{ env.android-promise-timeout-milliseconds }}
TARGET: android:instrumented
with:
api-level: ${{ env.android-api-level }}
arch: arm64-v8a
avd-name: ${{ secrets.ANDROID_AVD_NAME }}
avd-name: ${{ env.android-avd-name }}
emulator-options: -no-snapshot -noaudio -no-boot-anim
force-avd-creation: false
ram-size: ${{ secrets.ANDROID_AVD_RAM_SIZE }}
ram-size: ${{ env.android-avd-ram-size }}
script: |
adb logcat -c
adb logcat | tee android_instrumented_logcat.log | grep 'io.deckers.blob_courier' &
Expand Down Expand Up @@ -180,72 +186,4 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: ios-test-results
path: build/reports/**/*.xml
publish-typescript-test-results:
needs:
- run-typescript-tests
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: ts-test-results
path: report-ts
- uses: EnricoMi/[email protected]
with:
check_name: "Tests: TypeScript"
comment_title: TypeScript Test Report
deduplicate_classes_by_file_name: false
files: report-ts/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
publish-android-test-results:
needs:
- run-android-unit-tests
- run-android-instrumented-tests
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: android-unit-test-results
path: report-android-unit
- uses: actions/download-artifact@v2
with:
name: android-instrumented-test-results
path: report-android-instrument
- uses: EnricoMi/[email protected]
with:
check_name: "Tests: Android - Unit"
comment_title: Android Unit Test Report
deduplicate_classes_by_file_name: false
files: report-android-unit/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- uses: EnricoMi/[email protected]
with:
check_name: "Tests: Android - Instrumented"
comment_title: Android Instrumented Test Report
deduplicate_classes_by_file_name: false
files: report-android-instrument/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
publish-ios-test-results:
needs:
- run-ios-tests
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: ios-test-results
path: report-ios
- uses: EnricoMi/[email protected]
with:
check_name: "Tests: iOS"
comment_title: iOS Test Report
deduplicate_classes_by_file_name: false
files: report-ios/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
path: build/reports/**/*.xml
81 changes: 81 additions & 0 deletions .github/workflows/ci-publish-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish test results
on:
workflow_run:
workflows: ["Build and test"]
types:
- completed

jobs:
publish-test-results:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
steps:
# https://github.com/LouisBrunner/checks-action/issues/22#issuecomment-885047551
- name: Recognize sha ref
id: sharef
run: |
if [ "$EVENT" == 'workflow_run' ]
then
echo "::set-output name=sha::$(echo ${{github.event.workflow_run.head_sha}})"
fi
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
# https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish TypeScript Test Report
uses: EnricoMi/[email protected]
with:
check_name: "Tests: TypeScript"
comment_title: TypeScript Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/ts-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish Android Unit Test Report
uses: EnricoMi/[email protected]
with:
check_name: "Tests: Android - Unit"
comment_title: Android Unit Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/android-unit-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish Android Instrumented Test Report
uses: EnricoMi/[email protected]
with:
check_name: "Tests: Android - Instrumented"
comment_title: Android Instrumented Test Report
commit: ${{steps.sharef.outputs.sha}}
deduplicate_classes_by_file_name: false
files: artifacts/android-instrumented-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true
- name: Publish iOS Test Report
uses: EnricoMi/[email protected]
with:
check_name: "Tests: iOS"
comment_title: iOS Test Report
deduplicate_classes_by_file_name: false
files: artifacts/ios-test-results/**/*.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: all but latest
report_individual_runs: true

0 comments on commit e24f2d7

Please sign in to comment.