Split tests by modules in Github Actions #863
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Gradle | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Pull Request | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: ktLint | |
run: ./gradlew lintKotlin | |
- name: run apiCheck | |
run: ./gradlew apiCheck | |
jobMatrixSetup: | |
runs-on: ubuntu-latest | |
outputs: | |
emulator_jobs_matrix: ${{ steps.dataStep.outputs.emulator_jobs_matrix }} | |
ios_test_jobs_matrix: ${{ steps.dataStep.outputs.ios_test_jobs_matrix }} | |
js_test_jobs_matrix: ${{ steps.dataStep.outputs.js_test_jobs_matrix }} | |
jvm_test_jobs_matrix: ${{ steps.dataStep.outputs.jvm_test_jobs_matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: gradle | |
- name: Prepare the matrix JSON | |
run: ./gradlew ciJobsMatrixSetup | |
- id: dataStep | |
run: | | |
echo " | |
emulator_jobs_matrix=$(jq -c . < ./build/emulator_jobs_matrix.json) | |
ios_test_jobs_matrix=$(jq -c . < ./build/ios_test_jobs_matrix.json) | |
js_test_jobs_matrix=$(jq -c . < ./build/js_test_jobs_matrix.json) | |
jvm_test_jobs_matrix=$(jq -c . < ./build/jvm_test_jobs_matrix.json) | |
" >> $GITHUB_OUTPUT | |
build-android: | |
needs: jobMatrixSetup | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.emulator_jobs_matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Setup test environment | |
uses: ./.github/actions/setup_test_action | |
- name: Set Artifact Name | |
run: | | |
echo "ARCHIVE_KEY=$(echo ${{ matrix.gradle_tasks }} | cut -d: -f2)" >> $GITHUB_ENV | |
- name: Apply Android licenses | |
run: ./gradlew ciSdkManagerLicenses | |
- name: Run Android Instrumented Tests | |
run: ./gradlew ${{ matrix.gradle_tasks }} | |
- name: Upload Android test artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: Android ${{ env.ARCHIVE_KEY }} Test Report HTML | |
path: "**/build/reports/androidTests/" | |
- name: Upload Firebase Debug Log | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: Android ${{ env.ARCHIVE_KEY }} Firebase Debug Log | |
path: "**/firebase-debug.log" | |
build-js: | |
needs: jobMatrixSetup | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.js_test_jobs_matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup test environment | |
uses: ./.github/actions/setup_test_action | |
timeout-minutes: 10 | |
- name: Run JS Tests | |
run: ./gradlew ${{ matrix.gradle_tasks }} | |
- name: Upload JS test artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "JS Test Report HTML" | |
path: | | |
**/build/reports/tests/jsTest/ | |
**/build/reports/tests/jsBrowserTest/ | |
**/build/reports/tests/jsNodeTest/ | |
- name: Upload Firebase Debug Log | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "JS Firebase Debug Log" | |
path: "**/firebase-debug.log" | |
build-ios: | |
needs: jobMatrixSetup | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.ios_test_jobs_matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cocoapods cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cocoapods | |
~/Library/Caches/CocoaPods | |
*/build/cocoapods | |
*/build/classes | |
key: cocoapods-cache-v2 | |
- name: Setup test environment | |
uses: ./.github/actions/setup_test_action | |
- name: Run iOS Tests | |
run: ./gradlew ${{ matrix.gradle_tasks }} | |
- name: Upload iOS test artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "iOS Test Report HTML" | |
path: "**/build/reports/tests/iosSimulatorArm64Test/" | |
- name: Upload Firebase Debug Log | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "iOS Firebase Debug Log" | |
path: "**/firebase-debug.log" | |
build-jvm: | |
needs: jobMatrixSetup | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.jvm_test_jobs_matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup test environment | |
uses: ./.github/actions/setup_test_action | |
timeout-minutes: 10 | |
- name: Run JVM Tests | |
run: ./gradlew ${{ matrix.gradle_tasks }} | |
- name: Upload JVM test artifact | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "JVM Test Report HTML" | |
path: | | |
**/build/reports/tests/jvmTest/ | |
- name: Upload Firebase Debug Log | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "JVM Firebase Debug Log" | |
path: "**/firebase-debug.log" |