Skip to content

Commit

Permalink
Combine build and test actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xxfast committed Jan 22, 2024
1 parent ddca956 commit bf5aef9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 71 deletions.
60 changes: 51 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,40 @@ jobs:

build:
strategy:
fail-fast: true
matrix:
config: [
{ target: jvm, os: ubuntu-latest },
{ target: apple, os: macos-latest },
{ target: android, os: ubuntu-latest, tasks: testDebugUnitTest testReleaseUnitTest },
{ target: apple, os: macos-latest, tasks: iosX64Test iosSimulatorArm64Test macosX64Test macosArm64Test tvosX64Test tvosSimulatorArm64Test watchosX64Test watchosSimulatorArm64Test },
{ target: windows, os: windows-latest, tasks: windowsTest },
{ target: js, os: ubuntu-latest, tasks: jsTest },
{ target: desktop, os: ubuntu-latest, tasks: desktopTest },
]
runs-on: ${{ matrix.config.os }}
timeout-minutes: 60
needs:
- check

name: Build ${{ matrix.config.target }}
needs: check
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Setup gradle
uses: gradle/gradle-build-action@v2

- name: Test ${{ matrix.config.target }} targets
run: ./gradlew ${{ matrix.config.tasks }}

test:
name: Test on Android
runs-on: ubuntu-latest
timeout-minutes: 60
needs: check
strategy:
fail-fast: true
matrix:
api-level: [ 25, 33, 34 ]

steps:
- uses: actions/checkout@v3
Expand All @@ -71,15 +93,34 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build
# API 30+ emulators only have x86_64 system images.
- name: Get AVD info
uses: ./.github/actions/get-avd-info
id: avd-info
with:
api-level: ${{ matrix.api-level }}

- name: Enable KVM
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: Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ steps.avd-info.outputs.arch }}
target: ${{ steps.avd-info.outputs.target }}
script: ./gradlew connectedDebugAndroidTest

release:
name: Release to sonatype
if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
needs:
- build
- test
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down Expand Up @@ -118,6 +159,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
- test
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit bf5aef9

Please sign in to comment.