Add GH CI script #1
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-14 | |
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: | | |
Samples/Beyond.NET.Sample.C/build_${{ env.SCRIPT_SUFFIX }} | |
- name: build Go sample | |
run: | | |
Samples/Beyond.NET.Sample.Go/build_${{ env.SCRIPT_SUFFIX }} | |
- name: build Swift dependencies | |
run: | | |
Samples/Beyond.NET.Sample.Swift/build_dependencies | |
- name: run Swift tests (macOS) | |
if: "success() && matrix.env.OS == 'macOS'" | |
run: | | |
sudo xcode-select --switch /Applications/Xcode_16.0.app | |
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: | | |
Samples/Beyond.NET.Sample.Native/publish_${{ env.SCRIPT_SUFFIX }} | |
- name: run Android tests (macOS) | |
if: "success() && matrix.env.OS == 'macOS'" | |
run: | | |
Samples/Beyond.NET.Sample.Native/publish_android_arm64 | |
pwsh Samples/Beyond.NET.Sample.Android/test-on-emulator.ps1 |