name: ci on: push: branches: [main] pull_request: branches: [main] # Actions are pinned to commit SHAs, not tags: a tag can be moved to point at new code, # which would let a compromised action run with this workflow's permissions. permissions: contents: read concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true CI: true jobs: build: name: build and test runs-on: [linux] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: global-json-file: global.json cache: true cache-dependency-path: '**/packages.lock.json' # Locked mode fails if packages.lock.json does not match the project files, so a # dependency cannot change without the lock file change being reviewed. - name: restore run: dotnet restore DodoSSH.slnx --locked-mode - name: verify formatting run: dotnet format DodoSSH.slnx --verify-no-changes --no-restore - name: build run: dotnet build DodoSSH.slnx --no-restore --configuration Release - name: test run: dotnet test DodoSSH.slnx --no-build --configuration Release # This includes the end-to-end suite, which starts PostgreSQL, Keycloak and an OpenSSH # server through Testcontainers and runs the API as a child process — so it needs a # Docker daemon and gets one here. That is why the tests run on ubuntu rather than # macOS, whose runners have no daemon at all. Expect the Keycloak image pull to # dominate a cold run. android: name: android head runs-on: [linux] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: global-json-file: global.json cache: true cache-dependency-path: '**/packages.lock.json' # A job of its own, because DodoSSH.Client.Android is deliberately not in DodoSSH.slnx. # Adding it there would make the android workload and a full Android SDK a prerequisite of # `dotnet build DodoSSH.slnx` for everyone — including the build job above, which needs # neither and would grow several minutes for a head it does not compile. # # The cost of keeping it out is that nothing in the main job would notice this head # breaking, which for a project sharing view models with the desktop one is a matter of # when rather than whether. This job is that notice. - name: install the android workload run: dotnet workload install android --skip-sign-check # API 36 specifically, and it is not a preference: Avalonia.Controls.WebView ships only a # net10.0-android36.0 assembly, so anything lower cannot resolve it and the head loses its # terminal. See docs/android-port.md. - name: install the android sdk platform run: | echo "y" | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" \ "platforms;android-36" "build-tools;36.0.0" - name: restore run: dotnet restore src/DodoSSH.Client.Android/DodoSSH.Client.Android.csproj --locked-mode - name: build run: > dotnet build src/DodoSSH.Client.Android/DodoSSH.Client.Android.csproj --no-restore --configuration Release # Packaging rather than only compiling, because the two failures this head is most exposed to # are both link-time: a native library with no android ABI, and a managed assembly that # resolves for net10.0 but has nothing to dex. Neither shows up in a compile. - name: package run: > dotnet build src/DodoSSH.Client.Android/DodoSSH.Client.Android.csproj --no-restore --configuration Release -t:SignAndroidPackage -p:RuntimeIdentifier=android-arm64