Run Android tests on macOS only #11
This file contains 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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/workflows/x-*.yml' | |
workflow_dispatch: # manually-triggered runs | |
permissions: | |
# only allowed to read source code (ref. https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) | |
contents: read | |
concurrency: | |
# cancel pending runs when a PR gets updated | |
group: "${{ github.head_ref || github.run_id }}-${{ github.actor }}" | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: "CI - ${{ matrix.name }}" | |
strategy: | |
matrix: | |
include: | |
- name: "Ubuntu x64" | |
os: ubuntu-latest | |
env: | |
OS: "linux" | |
- name: "macOS ARM64" | |
os: macos-15 | |
env: | |
OS: "macOS" | |
runs-on: "${{ matrix.os }}" | |
defaults: | |
run: | |
shell: "bash" | |
env: | |
DOTNET_NOLOGO: 1 | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
SCRIPT_SUFFIX: "${{ matrix.env.OS == 'linux' && 'linux_x64' || 'macos_universal' }}" | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' | |
- name: build C sample | |
run: | | |
cd Samples/Beyond.NET.Sample.C | |
./build_${{ env.SCRIPT_SUFFIX }} | |
- name: build Go sample (Linux) | |
if: "success() && matrix.env.OS == 'linux'" | |
run: | | |
cd Samples/Beyond.NET.Sample.Go | |
./build_${{ env.SCRIPT_SUFFIX }} | |
- name: run Swift tests (macOS) | |
if: "success() && matrix.env.OS == 'macOS'" | |
run: | | |
cd Samples/Beyond.NET.Sample.Swift | |
./build_dependencies | |
xcodebuild -workspace BeyondNETSamplesSwift.xcworkspace -scheme BeyondNETSampleSwift test -destination "name=My Mac" | |
xcodebuild -workspace BeyondNETSamplesSwift.xcworkspace -scheme BeyondNETSampleSwift test -destination "platform=iOS Simulator,name=iPhone 16,OS=18.0" | |
- name: build native sample | |
run: | | |
cd Samples/Beyond.NET.Sample.Native | |
./publish_${{ env.SCRIPT_SUFFIX }} | |
- name: build Android native | |
run: | | |
cd Samples/Beyond.NET.Sample.Native | |
./publish_android_arm64 | |
- name: run Android tests (macOS) | |
if: "success() && matrix.env.OS == 'macOS'" | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 31 | |
arch: arm64-v8a | |
target: google_apis | |
disable-animations: true | |
force-avd-creation: false | |
emulator-boot-timeout: 120 | |
emulator-options: -no-audio -no-boot-anim -no-window -no-snapshot-save -gpu off -camera-back none | |
working-directory: Samples/Beyond.NET.Sample.Android | |
script: ./gradlew connectedAndroidTest | |
#- name: run Android tests (macOS) | |
# if: "success() && matrix.env.OS == 'macOS'" | |
# run: | | |
# pushd Samples/Beyond.NET.Sample.Native | |
# ./publish_android_arm64 | |
# popd | |
# | |
# cd Samples/Beyond.NET.Sample.Android | |
# ./test-on-emulator.ps1 |