@@ -3940,3 +3940,88 @@ jobs:
39403940
39413941 - run : swift test -Xswiftc -DENABLE_TESTING
39423942 working-directory : ${{ github.workspace }}/SourceCache/swift-win32
3943+
3944+ smoke_test_android :
3945+ # TODO: Run this job on macOS or make an equivalent Mac-only job
3946+ if : inputs.build_os == 'Windows' && inputs.build_android
3947+ needs : [installer]
3948+ runs-on : ${{ inputs.default_build_runner }}
3949+
3950+ strategy :
3951+ fail-fast : false
3952+ matrix :
3953+ arch : [ x86_64, aarch64 ]
3954+
3955+ steps :
3956+ - name : Download Swift SDK
3957+ uses : actions/download-artifact@v4
3958+ with :
3959+ name : installer-${{ inputs.build_arch }}
3960+ path : ${{ github.workspace }}/tmp
3961+
3962+ # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
3963+ - name : Install Swift SDK
3964+ run : |
3965+ function Update-EnvironmentVariables {
3966+ foreach ($level in "Machine", "User") {
3967+ [Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
3968+ # For Path variables, append the new values, if they're not already in there
3969+ if ($_.Name -Match 'Path$') {
3970+ $_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -Split ';' | Select -Unique) -Join ';'
3971+ }
3972+ $_
3973+ } | Set-Content -Path { "Env:$($_.Name)" }
3974+ }
3975+ }
3976+
3977+ try {
3978+ Write-Host "Starting Install installer.exe..."
3979+ $Process = Start-Process -FilePath ${{ github.workspace }}/tmp/installer.exe -ArgumentList ("-q") -Wait -PassThru
3980+ $ExitCode = $Process.ExitCode
3981+ if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
3982+ Write-Host "Installation successful"
3983+ } else {
3984+ Write-Host "non-zero exit code returned by the installation process: $ExitCode"
3985+ exit $ExitCode
3986+ }
3987+ } catch {
3988+ Write-Host "Failed to install: $($_.Exception.Message)"
3989+ exit 1
3990+ }
3991+ Update-EnvironmentVariables
3992+
3993+ # Reset Path and environment
3994+ echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
3995+ Get-ChildItem Env: | % { echo "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append }
3996+
3997+ - name : Install Android NDK
3998+ uses : nttld/setup-ndk@v1
3999+ id : setup-ndk
4000+ with :
4001+ ndk-version : r26d
4002+ local-cache : true
4003+
4004+ - name : Setup Swift environment
4005+ id : android-swift-env
4006+ run : |
4007+ echo "sysroot=$(resolve-path ${{ steps.setup-ndk.outputs.ndk-path }}\toolchains\llvm\prebuilt\windows-x86_64\sysroot)" >> $env:GITHUB_OUTPUT
4008+ echo "sdkroot=$(resolve-path $env:SDKROOT\..\..\..\..\Android.platform\Developer\SDKs\Android.sdk)" >> $env:GITHUB_OUTPUT
4009+ echo "clang-resource-dir=$(& $(resolve-path "${{ steps.setup-ndk.outputs.ndk-path }}\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe") -print-resource-dir)" >> $env:GITHUB_OUTPUT
4010+
4011+ - name : Checkout cassowary project
4012+ uses : actions/checkout@v4
4013+ with :
4014+ repository : compnerd/cassowary
4015+ ref : 0.0.2
4016+ path : ${{ github.workspace }}/SourceCache/cassowary
4017+
4018+ - name : Build cassowary project
4019+ run : |
4020+ swift build `
4021+ --package-path ${{ github.workspace }}/SourceCache/cassowary `
4022+ --triple ${{ matrix.arch }}-unknown-linux-android${{ inputs.ANDROID_API_LEVEL }} `
4023+ --sdk "${{ steps.android-swift-env.outputs.sysroot }}" `
4024+ -Xswiftc -sdk -Xswiftc "${{ steps.android-swift-env.outputs.sdkroot }}" `
4025+ -Xswiftc -sysroot -Xswiftc "${{ steps.android-swift-env.outputs.sysroot }}" `
4026+ -Xswiftc -I -Xswiftc "${{ steps.android-swift-env.outputs.sdkroot }}\usr\include" `
4027+ -Xswiftc -Xclang-linker -Xswiftc -resource-dir -Xswiftc -Xclang-linker -Xswiftc ${{ steps.android-swift-env.outputs.clang-resource-dir }}
0 commit comments