From 7c8657579dc79a39c204a24d379f68afe7e11e82 Mon Sep 17 00:00:00 2001 From: StefMa Date: Mon, 21 Oct 2024 13:44:58 +0200 Subject: [PATCH 1/3] Use upstream for pkl workflows Signed-off-by: StefMa --- .github/pkl-workflows/codeql.pkl | 6 +- .github/pkl-workflows/helpers/BaaS.pkl | 12 ++- .github/pkl-workflows/helpers/Common.pkl | 16 ++-- .github/pkl-workflows/helpers/Lint.pkl | 8 +- .github/pkl-workflows/helpers/Package.pkl | 10 +- .github/pkl-workflows/helpers/Steps.pkl | 28 +++--- .github/pkl-workflows/helpers/Test.pkl | 98 ++++++++++---------- .github/pkl-workflows/main.pkl | 10 +- .github/pkl-workflows/pr.pkl | 2 +- .github/pkl-workflows/publish-prerelease.pkl | 4 +- .github/pkl-workflows/publish-release.pkl | 8 +- .github/pkl-workflows/wrappers.pkl | 32 ++++--- 12 files changed, 122 insertions(+), 112 deletions(-) diff --git a/.github/pkl-workflows/codeql.pkl b/.github/pkl-workflows/codeql.pkl index 6627000c37..a36d74ce06 100644 --- a/.github/pkl-workflows/codeql.pkl +++ b/.github/pkl-workflows/codeql.pkl @@ -1,6 +1,6 @@ module codeql -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" import "helpers/Common.pkl" import "helpers/Steps.pkl" @@ -34,9 +34,9 @@ concurrency { `cancel-in-progress` = true } jobs { - ["analyze-csharp"] = new Job { + ["analyze-csharp"] { name = "Analyze C#" - `runs-on` = new WindowsLatest{} + `runs-on` = new WindowsLatest {} permissions { actions = "read" contents = "read" diff --git a/.github/pkl-workflows/helpers/BaaS.pkl b/.github/pkl-workflows/helpers/BaaS.pkl index ae228a428a..b639bc2700 100644 --- a/.github/pkl-workflows/helpers/BaaS.pkl +++ b/.github/pkl-workflows/helpers/BaaS.pkl @@ -1,16 +1,17 @@ module baas -import "../GithubAction/GithubAction.pkl" as gha +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha import "Common.pkl" import "Steps.pkl" -function deploy(differentiators: Listing): gha.MatrixJob = new { +function deploy(differentiators: Listing): gha.Job = new { name = "Deploy BaaS" - `runs-on` = new gha.UbuntuLatest{} + `runs-on` = new gha.UbuntuLatest {} strategy { matrix { ["differentiator"] = differentiators } + `fail-fast` = false } `if` = Common.ifNotCanceledCondition steps { @@ -26,13 +27,14 @@ function deployStep(differentiator: Common.SyncDifferentiator?, shouldDeploy: Bo `working-directory` = "Tools/DeployApps" }) else List() -function cleanup(differentiators: Listing): gha.MatrixJob = new { +function cleanup(differentiators: Listing): gha.Job = new { name = "Cleanup BaaS" - `runs-on` = new gha.UbuntuLatest{} + `runs-on` = new gha.UbuntuLatest {} strategy { matrix { ["differentiator"] = differentiators } + `fail-fast` = false } `if` = Common.ifNotCanceledCondition steps { diff --git a/.github/pkl-workflows/helpers/Common.pkl b/.github/pkl-workflows/helpers/Common.pkl index 7b013bed94..5a3b7a287b 100644 --- a/.github/pkl-workflows/helpers/Common.pkl +++ b/.github/pkl-workflows/helpers/Common.pkl @@ -1,6 +1,6 @@ module common -import "../GithubAction/GithubAction.pkl" as gha +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha import "BaaS.pkl" import "Lint.pkl" import "Package.pkl" @@ -24,9 +24,9 @@ local const job_Wrappers: String = "build-wrappers" const mainBranch: String = "main" -typealias NetFramework = "net6.0" | "net8.0" | String(startsWith("${{ matrix")) | String(startsWith("net8")) -typealias NetRuntime = "win-x64" | "linux-x64" | "osx-x64" | "osx-arm64" | String(startsWith("${{ matrix")) -typealias SyncDifferentiator = "ios-maui" | "android-maui" | "tvos" | "macos-maui" | "code-coverage" | "uwp" | "net-framework" | String(startsWith("${{ matrix")) +typealias NetFramework = "net6.0"|"net8.0"|String(startsWith("${{ matrix"))|String(startsWith("net8")) +typealias NetRuntime = "win-x64"|"linux-x64"|"osx-x64"|"osx-arm64"|String(startsWith("${{ matrix")) +typealias SyncDifferentiator = "ios-maui"|"android-maui"|"tvos"|"macos-maui"|"code-coverage"|"uwp"|"net-framework"|String(startsWith("${{ matrix")) const wrapperBinaryNames: List = List("macos", "catalyst") @@ -36,7 +36,7 @@ const wrapperBinaryNames: List = + uwpArchs.map((arch) -> "windows-uwp-\(arch)") + applePlatformTargets((platform, target) -> "\(platform)-\(target)") -const defaultEnv: Mapping = new { +const defaultEnv: Mapping = new { ["REALM_DISABLE_ANALYTICS"] = true ["DOTNET_NOLOGO"] = true } @@ -50,13 +50,13 @@ const packages: List = nugetPackages + List("Realm.UnityUtils", "Realm.U const testTimeout: Int = 60 -const function defaultBuildJobs(baasDifferentiators: Listing, netCoreVersions: Listing): Mapping = new { - [job_Wrappers] = new gha.ReusableWorkflowJob { +const function defaultBuildJobs(baasDifferentiators: Listing, netCoreVersions: Listing): Mapping = new { + [job_Wrappers] = new gha.ReusableJob { uses = "./.github/workflows/wrappers.yml" name = "Wrappers" } [job_Baas] = BaaS.deploy(baasDifferentiators) - [job_Packages] = (Package.nuget("contains(github.head_ref, 'release')")){ + [job_Packages] = (Package.nuget("contains(github.head_ref, 'release')")) { needs { job_Wrappers } diff --git a/.github/pkl-workflows/helpers/Lint.pkl b/.github/pkl-workflows/helpers/Lint.pkl index 16c1ae04bb..044c93a301 100644 --- a/.github/pkl-workflows/helpers/Lint.pkl +++ b/.github/pkl-workflows/helpers/Lint.pkl @@ -1,14 +1,14 @@ module lint -import "../GithubAction/GithubAction.pkl" as gha -import "Steps.pkl" +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha import "Common.pkl" +import "Steps.pkl" const actionVerifyTODO = "nirinchev/verify-todo@ffa352ac028b4cdc8bc626471d33aa341b3ab7c9" function lint(): gha.Job = new { name = "Verify TODOs" - `runs-on` = new gha.UbuntuLatest{} + `runs-on` = new gha.UbuntuLatest {} steps { Steps.checkoutWithoutMatchers(false) new gha.Step { @@ -24,7 +24,7 @@ function lint(): gha.Job = new { } function verifyNamespaces(): gha.Job = new { - `runs-on` = new gha.UbuntuLatest{} + `runs-on` = new gha.UbuntuLatest {} name = "Verify Namespaces" needs { Common.job_Packages diff --git a/.github/pkl-workflows/helpers/Package.pkl b/.github/pkl-workflows/helpers/Package.pkl index 782e104448..8ed16f3bea 100644 --- a/.github/pkl-workflows/helpers/Package.pkl +++ b/.github/pkl-workflows/helpers/Package.pkl @@ -1,9 +1,9 @@ module package -import "../GithubAction/GithubAction.pkl" as gha +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha +import "Actions.pkl" import "Common.pkl" import "Steps.pkl" -import "Actions.pkl" const unityPkgName = "io.realm.unity-${{ needs.\(Common.job_Packages).outputs.\(Steps.getVersionOutput) }}.tgz" @@ -14,7 +14,7 @@ local const buildSuffixOutput = "build_suffix" function nuget(shouldBuildDocsCondition: String): gha.Job = new { name = "Package NuGet" - `runs-on` = new gha.WindowsLatest{} + `runs-on` = new gha.WindowsLatest {} `if` = Common.ifNotCanceledCondition outputs { [Steps.getVersionOutput] = Steps.getVersionExpresssion @@ -37,7 +37,7 @@ function nuget(shouldBuildDocsCondition: String): gha.Job = new { Steps.readVersionFromPackage() for (pkgName in Common.packages) { let (finalPkgName = "\(pkgName).\(Steps.getVersionExpresssion)") - Steps.uploadArtifacts(finalPkgName, "Realm/packages/\(finalPkgName).*nupkg") + Steps.uploadArtifacts(finalPkgName, "Realm/packages/\(finalPkgName).*nupkg") } Steps.uploadArtifacts("ExtractedChangelog", "Realm/Realm/ExtractedChangelog.md") ...buildDocs(shouldBuildDocsCondition) @@ -45,7 +45,7 @@ function nuget(shouldBuildDocsCondition: String): gha.Job = new { } function unity(): gha.Job = new { name = "Package Unity" - `runs-on` = new gha.WindowsLatest{} + `runs-on` = new gha.WindowsLatest {} `timeout-minutes` = 30 `if` = Common.ifNotCanceledCondition needs { diff --git a/.github/pkl-workflows/helpers/Steps.pkl b/.github/pkl-workflows/helpers/Steps.pkl index 2abac1bf9f..68a476220d 100644 --- a/.github/pkl-workflows/helpers/Steps.pkl +++ b/.github/pkl-workflows/helpers/Steps.pkl @@ -1,18 +1,18 @@ -import "../GithubAction/GithubAction.pkl" as gha -import "Common.pkl" +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha import "Actions.pkl" +import "Common.pkl" const getVersionStepName = "get-version" const getVersionOutput = "package_version" const getVersionExpresssion = "${{ steps.\(getVersionStepName).outputs.\(getVersionOutput) }}" -const function checkout(submodules: (Boolean | "recursive")): Listing = new { +const function checkout(submodules: (Boolean|"recursive")): Listing = new { checkoutWithoutMatchers(submodules) registerProblemMatchers() } -const function checkoutWithoutMatchers(submodules: (Boolean | "recursive")): gha.Step = new { +const function checkoutWithoutMatchers(submodules: (Boolean|"recursive")): gha.Step = new { name = "Checkout Code" uses = Actions.checkout with { @@ -136,7 +136,7 @@ const function setupAndroid(): Listing = new { } } -const function configureAWSCredentials(accessKey: String, secretKey: String, region: "us-east-1" | "us-west-2" | "us-east-2"): gha.Step = new { +const function configureAWSCredentials(accessKey: String, secretKey: String, region: "us-east-1"|"us-west-2"|"us-east-2"): gha.Step = new { name = "Configure AWS Credentials" uses = Actions.awsConfigureCredentials with { @@ -157,7 +157,7 @@ const function readVersionFromPackage(): gha.Step = new { shell = "bash" } -const function uploadToNPM(tag: "latest" | "alpha"): Listing = new { +const function uploadToNPM(tag: "latest"|"alpha"): Listing = new { local packageName = "io.realm.unity-\(getVersionExpresssion).tgz" new { @@ -186,18 +186,18 @@ const function uploadPackagesToSleet(versionExpression: String, expectShortPath: configureAWSCredentials("NUGET_S3_ACCESS_KEY", "NUGET_S3_SECRET_KEY", "us-east-1") for (package in Common.nugetPackages) { let (packageWithVersion = "\(package).\(versionExpression)") - let (packagePath = "\(if (expectShortPath) "" else "\(packageWithVersion)/")\(packageWithVersion).nupkg") - new { - name = "NuGet Publish \(packageWithVersion)" - run = "sleet push ${{ github.workspace }}/Realm/packages/\(packagePath) --config ${{ github.workspace }}/.github/sleet.json --source NugetSource" - } + let (packagePath = "\(if (expectShortPath) "" else "\(packageWithVersion)/")\(packageWithVersion).nupkg") + new { + name = "NuGet Publish \(packageWithVersion)" + run = "sleet push ${{ github.workspace }}/Realm/packages/\(packagePath) --config ${{ github.workspace }}/.github/sleet.json --source NugetSource" + } } } class MSBuildConfig { projects: Listing target: String? - properties: Mapping = new{} + properties: Mapping = new {} standaloneExe: Boolean = false function getTargetForInvocation(): String = if (target != null) " -t:\(target)" else "" @@ -280,9 +280,9 @@ const function cleanupWorkspace(): gha.Step = new { class SimulatorConfig { appPath: String bundleId: String - iphoneToSimulate: "Apple-TV-1080p" | "iPhone-8" | "iPhone-15" + iphoneToSimulate: "Apple-TV-1080p"|"iPhone-8"|"iPhone-15" arguments: String - os: "tvOS" | "iOS" + os: "tvOS"|"iOS" } class DeviceFarmConfig { diff --git a/.github/pkl-workflows/helpers/Test.pkl b/.github/pkl-workflows/helpers/Test.pkl index 7b6dcc7c0b..73e37b02b5 100644 --- a/.github/pkl-workflows/helpers/Test.pkl +++ b/.github/pkl-workflows/helpers/Test.pkl @@ -1,10 +1,10 @@ module test -import "../GithubAction/GithubAction.pkl" as gha -import "Common.pkl" -import "Steps.pkl" +import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" as gha import "BaaS.pkl" +import "Common.pkl" import "Package.pkl" +import "Steps.pkl" local const actionReportTestResults = "dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5" @@ -12,14 +12,14 @@ local const outputFile = "TestResults.xml" local const executableExpression = "${{ steps.dotnet-publish.outputs.executable-path }}" // Public test targets -function netFramework(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function netFramework(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { title = ".NET Framework" needsPackages = true syncDifferentiator = "net-framework" syncDifferentiators = _syncDifferentiators }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { ...prepareTests(config) @@ -39,28 +39,29 @@ function netFramework(_syncDifferentiators: Listing): gha.StepJobBase = ...reportTestResults(config) }) -function netCore(frameworks: Listing): gha.StepJobBase = testJob( +function netCore(frameworks: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }}" shouldCleanWorkspace = true }, "${{ matrix.os.runner }}", - new gha.MatrixStrategy { + new gha.Strategy { matrix { ["framework"] = frameworks - ["os"] = new Listing { + ["os"] = new { new { runner = "windows-latest" runtime = "win-x64" } new { runner = "ubuntu-latest" runtime = "linux-x64" } - new { runner = "macos-13" runtime = "osx-x64" } + new { runner = "macos-14" runtime = "osx-x64" } } - ["include"] = new Listing { - new Mapping { + ["include"] = new { + new { ["framework"] = "net8.0" ["os"] = new MatrixOS { runner = "macos-14" runtime = "osx-arm64" } } } } + `fail-fast` = false }, (config) -> new Listing { ...prepareTests(config) @@ -85,65 +86,66 @@ function netCore(frameworks: Listing): gha.StepJobBase = te ...reportTestResults(config) }) -function weaver(): gha.StepJobBase = testJob( +function weaver(): gha.Job = testJob( new TestConfig { title = "Weaver" shouldCleanWorkspace = true }, "${{ matrix.os.runner }}", - new gha.MatrixStrategy { + new gha.Strategy { matrix { - ["os"] = new Listing { + ["os"] = new { new { runner = "windows-latest" runtime = "win-x64" } new { runner = "ubuntu-latest" runtime = "linux-x64" } new { runner = "macos-14" runtime = "osx-arm64" } } } + `fail-fast` = false }, (config) -> new Listing { ...Steps.checkout(false) ...Steps.setupWorkloads(null, "6.0.x") - ...Steps.dotnetPublish("Tests/Weaver/Realm.Fody.Tests", "net6.0", "${{ matrix.os.runtime }}", new Mapping{}).toList() + ...Steps.dotnetPublish("Tests/Weaver/Realm.Fody.Tests", "net6.0", "${{ matrix.os.runtime }}", new Mapping {}).toList() ...dotnetRunTests(false) ...reportTestResults(config) }) -function xunit(): gha.StepJobBase = testJob( +function xunit(): gha.Job = testJob( new TestConfig { title = "xUnit Compatibility" needsPackages = true }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { ...prepareTests(config) - ...Steps.dotnetPublish("Tests/Tests.XUnit", "net6.0", "win-x64", new Mapping{}).toList() + ...Steps.dotnetPublish("Tests/Tests.XUnit", "net6.0", "win-x64", new Mapping {}).toList() new { name = "Run Tests" run = "dotnet test \(executableExpression)/Tests.XUnit.dll --logger GitHubActions" } }) -function sourceGeneration(): gha.StepJobBase = testJob( +function sourceGeneration(): gha.Job = testJob( new TestConfig { title = "Source Generation" }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { ...Steps.checkout(false) ...Steps.setupWorkloads(null, "6.0.x") - ...Steps.dotnetPublish("Tests/SourceGenerators/Realm.SourceGenerator.Tests", "net6.0", "win-x64", new Mapping{}).toList() + ...Steps.dotnetPublish("Tests/SourceGenerators/Realm.SourceGenerator.Tests", "net6.0", "win-x64", new Mapping {}).toList() ...dotnetRunTests(false) ...reportTestResults(config) }) -function wovenClasses(): gha.StepJobBase = testJob( +function wovenClasses(): gha.Job = testJob( new TestConfig { needsPackages = true title = "Woven Classes" }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { ...prepareTests(config) @@ -155,7 +157,7 @@ function wovenClasses(): gha.StepJobBase = testJob( } ) -function tvOS(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function tvOS(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "Xamarin.tvOS" @@ -174,7 +176,7 @@ function tvOS(_syncDifferentiators: Listing): gha.Ste ["Platform"] = "iPhoneSimulator" } }) - Steps.runSimulator(new Steps.SimulatorConfig{ + Steps.runSimulator(new Steps.SimulatorConfig { appPath = "Tests/Tests.XamarinTVOS/bin/iPhoneSimulator/\(Common.configuration)/Tests.XamarinTVOS.app" arguments = "--headless --result=${{ github.workspace }}/\(outputFile) --labels=All \(baasTestArgs(config))" bundleId = "io.realm.Tests-XamarinTVOS" @@ -184,7 +186,7 @@ function tvOS(_syncDifferentiators: Listing): gha.Ste ...reportTestResults(config) }) -function iOS_Xamarin(): gha.StepJobBase = testJob( +function iOS_Xamarin(): gha.Job = testJob( new TestConfig { needsPackages = true title = "Xamarin.iOS" @@ -201,7 +203,7 @@ function iOS_Xamarin(): gha.StepJobBase = testJob( ["Platform"] = "iPhoneSimulator" } }) - Steps.runSimulator(new Steps.SimulatorConfig{ + Steps.runSimulator(new Steps.SimulatorConfig { appPath = "Tests/Tests.iOS/bin/iPhoneSimulator/\(Common.configuration)/Tests.iOS.app" arguments = "--headless --result=${{ github.workspace }}/\(outputFile) --labels=All \(baasTestArgs(config))" bundleId = "io.realm.dotnettests" @@ -211,7 +213,7 @@ function iOS_Xamarin(): gha.StepJobBase = testJob( ...reportTestResults(config) }) -function iOS_Maui(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function iOS_Maui(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "Maui.iOS" @@ -226,7 +228,7 @@ function iOS_Maui(_syncDifferentiators: Listing): gha ...Steps.setupWorkloads("maui", null) Steps.setupXcode("latest-stable") Steps.dotnetBuild("Tests/Tests.Maui", "net8.0-ios", null, getTestProps(false)) - Steps.runSimulator(new Steps.SimulatorConfig{ + Steps.runSimulator(new Steps.SimulatorConfig { appPath = "Tests/Tests.Maui/bin/\(Common.configuration)/net8.0-ios/iossimulator-x64/Tests.Maui.app" arguments = "--headless --result=${{ github.workspace }}/\(outputFile) --labels=All \(baasTestArgs(config))" bundleId = "io.realm.mauitests" @@ -236,7 +238,7 @@ function iOS_Maui(_syncDifferentiators: Listing): gha ...reportTestResults(config) }) -function macOS_Xamarin(): gha.StepJobBase = testJob( +function macOS_Xamarin(): gha.Job = testJob( new TestConfig { needsPackages = true title = "Xamarin.macOS" @@ -257,7 +259,7 @@ function macOS_Xamarin(): gha.StepJobBase = testJob( ...reportTestResults(config) }) -function macOS_Maui(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function macOS_Maui(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "Maui.MacCatalyst" @@ -279,14 +281,14 @@ function macOS_Maui(_syncDifferentiators: Listing): g ...reportTestResults(config) }) -function uwp(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function uwp(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "UWP" syncDifferentiators = _syncDifferentiators syncDifferentiator = "uwp" }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { ...prepareTests(config) @@ -320,12 +322,12 @@ function uwp(_syncDifferentiators: Listing): gha.Step ...reportTestResultsWithCustomFile("${{ env.TEST_RESULTS }}", config) }) -function android_Xamarin(): gha.StepJobBase = testJob( +function android_Xamarin(): gha.Job = testJob( new TestConfig { needsPackages = true title = "Xamarin.Android" }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { Steps.setupJDK() @@ -347,7 +349,7 @@ function android_Xamarin(): gha.StepJobBase = testJob( ...reportTestResultsWithCustomFile("${{ steps.run_tests.outputs.test-results-path }}", config) }) -function android_Maui(_syncDifferentiators: Listing): gha.StepJobBase = testJob( +function android_Maui(_syncDifferentiators: Listing): gha.Job = testJob( new TestConfig { needsPackages = true title = "Maui.Android" @@ -355,7 +357,7 @@ function android_Maui(_syncDifferentiators: Listing): syncDifferentiators = _syncDifferentiators transformResults = true }, - new gha.WindowsLatest{}, + new gha.WindowsLatest {}, null, (config) -> new Listing { Steps.setupJDK() @@ -369,14 +371,14 @@ function android_Maui(_syncDifferentiators: Listing): ...reportTestResultsWithCustomFile("${{ steps.run_tests.outputs.test-results-path }}", config) }) -function codeCoverage(wrappersJob: String, _syncDifferentiators: Listing): gha.StepJobBase = (testJob( +function codeCoverage(wrappersJob: String, _syncDifferentiators: Listing): gha.Job = (testJob( new TestConfig { title = "Code Coverage" syncDifferentiator = "code-coverage" syncDifferentiators = _syncDifferentiators usedWrappers = List("linux-x86_64") }, - new gha.UbuntuLatest{}, + new gha.UbuntuLatest {}, null, (config) -> new Listing { ...prepareTests(config) @@ -397,10 +399,10 @@ function codeCoverage(wrappersJob: String, _syncDifferentiators: Listing = new Mapping { ["build-unity-tests-\(config.os)"] = new gha.Job { @@ -468,7 +470,7 @@ function unity(config: UnityTestConfig): Mapping = new Mapping< } } -function benchmark(): gha.StepJobBase = testJob( +function benchmark(): gha.Job = testJob( new TestConfig { title = "Benchmark" shouldCleanWorkspace = true @@ -515,17 +517,17 @@ function benchmark(): gha.StepJobBase = testJob( }) class UnityTestConfig { - os: "windows" | "linux" + os: "windows"|"linux" settings: String = "Mono-Net4" function platform() = "\(os.capitalize())64" - function runsOn():gha.Machine = if (os == "windows") new gha.WindowsLatest{} else if (os == "linux") new gha.UbuntuLatest{} else throw("invalid os: \(os)") + function runsOn(): gha.Machine = if (os == "windows") new gha.WindowsLatest {} else if (os == "linux") new gha.UbuntuLatest {} else throw("invalid os: \(os)") } // Private helpers -local function testJob(config: TestConfig, runsOn: gha.Machine | String, _strategy: gha.MatrixStrategy?, _steps: Function1>): gha.StepJobBase = (if (_strategy != null) new gha.MatrixJob{ +local function testJob(config: TestConfig, runsOn: gha.Machine|String, _strategy: gha.Strategy?, _steps: Function1>): gha.Job = (if (_strategy != null) new gha.Job { strategy = _strategy -} else new gha.Job{}) { +} else new gha.Job {}) { name = "Test \(config.title)" `runs-on` = runsOn when (config.needsPackages) { @@ -628,7 +630,7 @@ local function archiveCoreDump(): gha.Step = (Steps.uploadArtifacts("crash-repor } local class MatrixOS { - runner: "windows-latest" | "ubuntu-latest" | "macos-13" | "macos-14" + runner: "windows-latest"|"ubuntu-latest"|"macos-13"|"macos-14" runtime: Common.NetRuntime } diff --git a/.github/pkl-workflows/main.pkl b/.github/pkl-workflows/main.pkl index 20e7df3ca8..403cc6eb94 100644 --- a/.github/pkl-workflows/main.pkl +++ b/.github/pkl-workflows/main.pkl @@ -1,6 +1,6 @@ module main -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" import "helpers/Common.pkl" import "helpers/Steps.pkl" @@ -47,12 +47,10 @@ on { env = Common.defaultEnv jobs = (Common.defaultBuildJobs(baasDifferentiators, netCoreFrameworks)) { - ["publish-packages-to-sleet"] = new Job { - `runs-on` = new UbuntuLatest{} + ["publish-packages-to-sleet"] { + `runs-on` = new UbuntuLatest {} name = "Publish package to S3" - needs { - Common.job_Packages - } + needs = Common.job_Packages `if` = "${{ \(Common.ifNotCanceledCondition) && (github.event_name == 'push' || github.event.inputs.publish-prerelease) }}" steps { Steps.checkoutWithoutMatchers(false) diff --git a/.github/pkl-workflows/pr.pkl b/.github/pkl-workflows/pr.pkl index 3f8de3eaef..05baa35ebe 100644 --- a/.github/pkl-workflows/pr.pkl +++ b/.github/pkl-workflows/pr.pkl @@ -1,6 +1,6 @@ module pr -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" import "helpers/Common.pkl" diff --git a/.github/pkl-workflows/publish-prerelease.pkl b/.github/pkl-workflows/publish-prerelease.pkl index af5c685994..0a79c39ef4 100644 --- a/.github/pkl-workflows/publish-prerelease.pkl +++ b/.github/pkl-workflows/publish-prerelease.pkl @@ -1,6 +1,6 @@ module prerelease -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" import "helpers/Common.pkl" import "helpers/Steps.pkl" @@ -11,7 +11,7 @@ on { } env = Common.defaultEnv jobs { - ["main"] = new Job { + ["main"] { `runs-on` = new UbuntuLatest{} name = "Publish package to S3" steps { diff --git a/.github/pkl-workflows/publish-release.pkl b/.github/pkl-workflows/publish-release.pkl index e4023f8cc3..9f644522e5 100644 --- a/.github/pkl-workflows/publish-release.pkl +++ b/.github/pkl-workflows/publish-release.pkl @@ -1,6 +1,6 @@ module release -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" import "helpers/Common.pkl" import "helpers/Steps.pkl" @@ -12,10 +12,12 @@ on { } env = Common.defaultEnv jobs { - ["main"] = new Job { + ["main"] { `runs-on` = new WindowsLatest{} name = "Publish Release" - environment = "Production" + environment { + name = "Production" + } steps { Steps.checkoutWithoutMatchers(false) Steps.downloadAllArtifacts() diff --git a/.github/pkl-workflows/wrappers.pkl b/.github/pkl-workflows/wrappers.pkl index eba15a2880..20ae20aa9b 100644 --- a/.github/pkl-workflows/wrappers.pkl +++ b/.github/pkl-workflows/wrappers.pkl @@ -1,10 +1,10 @@ module wrappers -amends "GithubAction/GithubAction.pkl" +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" +import "helpers/Actions.pkl" import "helpers/Common.pkl" import "helpers/Steps.pkl" -import "helpers/Actions.pkl" local job_CheckCache = "check-cache" @@ -18,7 +18,7 @@ on { env = Common.defaultEnv jobs { - [job_CheckCache] = new MatrixJob { + [job_CheckCache] { strategy { matrix { ["os"] { @@ -26,6 +26,7 @@ jobs { "windows" } } + `fail-fast` = false } `runs-on` = "${{ matrix.os }}-latest" name = "Check Cache" @@ -33,7 +34,7 @@ jobs { ["CACHE_SKIP_SAVE"] = true } outputs = Common.wrapperBinaryNames - .toMap((platform) -> "wrappers-\(platform)",(platform) -> "${{ steps.check-cache-\(platform).outputs.cache-hit }}") + .toMap((platform) -> "wrappers-\(platform)", (platform) -> "${{ steps.check-cache-\(platform).outputs.cache-hit }}") .toMapping() steps { Steps.checkoutWithoutMatchers("recursive") @@ -66,12 +67,13 @@ jobs { Steps.setupCmake("3.29.0") } }) - ["apple-platform"] = new MatrixJob { + ["apple-platform"] = new Job { strategy { matrix { ["platform"] = Common.applePlatforms.toListing() - ["target"] { "Device" "Simulator"} + ["target"] { "Device" "Simulator" } } + `fail-fast` = false } `runs-on` = "macos-12" name = "Apple Platform" @@ -85,13 +87,14 @@ jobs { } ifCondition = "\(Common.applePlatformTargets((platform, target) -> "needs.\(job_CheckCache).outputs.wrappers-\(platform)-\(target) != 'true'").join(" || "))" }) - ["linux"] = new MatrixJob { + ["linux"] = new Job { `runs-on` = new UbuntuLatest {} name = "Linux" strategy { matrix { ["arch"] = Common.linuxArchs.toListing() } + `fail-fast` = false } } |> wrappersJob(new JobConfig { cmd = "./wrappers/build-linux.sh -a=${{ matrix.arch }}" @@ -105,13 +108,14 @@ jobs { } } }) - ["android"] = new MatrixJob { + ["android"] = new Job { `runs-on` = "ubuntu-20.04" name = "Android" strategy { matrix { ["arch"] = Common.androidABIs.toListing() } + `fail-fast` = false } } |> wrappersJob(new JobConfig { cmd = "./wrappers/build-android.sh --ARCH=${{ matrix.arch }}" @@ -119,13 +123,14 @@ jobs { enableLTO = false ifCondition = "\(Common.androidABIs.map((abi) -> "needs.check-cache.outputs.wrappers-android-\(abi) != 'true'").join(" || "))" }) - ["windows"] = new MatrixJob { - `runs-on` = new WindowsLatest{} + ["windows"] = new Job { + `runs-on` = new WindowsLatest {} name = "Windows" strategy { matrix { ["arch"] = Common.windowsArchs.toListing() } + `fail-fast` = false } } |> wrappersJob(new JobConfig { cmd = "pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -ExtraCMakeArgs \"-T v143,version=14.35\"" @@ -135,13 +140,14 @@ jobs { } ifCondition = "\(Common.windowsArchs.map((arch) -> "needs.check-cache.outputs.wrappers-windows-\(arch) != 'true'").join(" || "))" }) - ["uwp"] = new MatrixJob { - `runs-on` = new WindowsLatest{} + ["uwp"] = new Job { + `runs-on` = new WindowsLatest {} name = "UWP" strategy { matrix { ["arch"] = Common.uwpArchs.toListing() } + `fail-fast` = false } } |> wrappersJob(new JobConfig { cmd = "pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -ExtraCMakeArgs \"-T v143,version=14.35\"" @@ -174,7 +180,7 @@ local function cacheStep(platform: String, idSuffix: String?): Mixin = new } } -local function wrappersJob(config: JobConfig): Mixin = new { +local function wrappersJob(config: JobConfig): Mixin = new { `timeout-minutes` = WrappersBuildTimeout needs { job_CheckCache From 0ea7ddba4f67b7c8d849828b1a31c3e43e0619e6 Mon Sep 17 00:00:00 2001 From: StefMa Date: Mon, 21 Oct 2024 13:46:46 +0200 Subject: [PATCH 2/3] Remove custom pkl project Signed-off-by: StefMa --- .github/build-workflows.ps1 | 4 +- .../GithubAction/GithubAction.pkl | 690 ------------------ .github/pkl-workflows/GithubAction/PklProject | 8 - .../GithubAction/PklProject.deps.json | 4 - .github/pkl-workflows/PklProject | 5 - .github/pkl-workflows/PklProject.deps.json | 10 - .github/pkl-workflows/Readme.md | 4 +- 7 files changed, 3 insertions(+), 722 deletions(-) delete mode 100644 .github/pkl-workflows/GithubAction/GithubAction.pkl delete mode 100644 .github/pkl-workflows/GithubAction/PklProject delete mode 100644 .github/pkl-workflows/GithubAction/PklProject.deps.json delete mode 100644 .github/pkl-workflows/PklProject delete mode 100644 .github/pkl-workflows/PklProject.deps.json diff --git a/.github/build-workflows.ps1 b/.github/build-workflows.ps1 index 2da93619d1..b0b90bb282 100644 --- a/.github/build-workflows.ps1 +++ b/.github/build-workflows.ps1 @@ -1,3 +1 @@ -Get-ChildItem -Path './pkl-workflows' -Filter *.pkl -File -Name | ForEach-Object { - &pkl eval ./pkl-workflows/$_ -o "./workflows/$($_.Replace('pkl', 'yml'))" -} \ No newline at end of file +pkl eval pkl-workflows/*.pkl -o workflows/%{moduleName}.yml \ No newline at end of file diff --git a/.github/pkl-workflows/GithubAction/GithubAction.pkl b/.github/pkl-workflows/GithubAction/GithubAction.pkl deleted file mode 100644 index d99ca79acd..0000000000 --- a/.github/pkl-workflows/GithubAction/GithubAction.pkl +++ /dev/null @@ -1,690 +0,0 @@ -// This is based on https://github.com/StefMa/pkl-gha with modifications -// to add missing GHA options - -module com.github.GitHubAction - -// JSON Schema definition for GitHub Actions workflow files: -// https://json.schemastore.org/github-workflow.json - -// GitHub Action lint: -// https://rhysd.github.io/actionlint/ - -// Definitions - -// Trigger -abstract class Trigger { - paths: Listing? - `paths-ignore`: Listing? - branches: Listing? - `branches-ignore`: Listing? -} - -/// Runs your workflow anytime the branch_protection_rule event occurs. More than one activity type triggers this event. -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#branch_protection_rule -class BranchProtectionRule extends Trigger { - types: Listing? -} -typealias BranchProtectionRuleType = - "created" - |"edited" - |"deleted" - -/// Runs your workflow anytime the check_run event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/checks/runs. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#check_run -class CheckRun extends Trigger { - types: Listing? -} -typealias CheckRunType = - "created" - |"rerequested" - |"completed" - |"requested_action" - -/// Runs your workflow anytime the check_suite event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/checks/suites/ -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#check_suite -class CheckSuite extends Trigger { - types: Listing? -} -typealias CheckSuiteType = - "completed" - |"requested" - |"rerequested" - -/// Runs your workflow anytime someone creates a branch or tag, which triggers the create event. -/// For information about the REST API, see https://developer.github.com/v3/git/refs/#create-a-reference. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#create -class Create extends Trigger - -// Runs your workflow anytime someone deletes a branch or tag, which triggers the delete event. -/// For information about the REST API, see https://developer.github.com/v3/git/refs/#delete-a-reference. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#delete -class Delete extends Trigger - -/// Runs your workflow anytime someone creates a deployment, which triggers the deployment event. -/// Deployments created with a commit SHA may not have a Git ref. -/// For information about the REST API, see https://developer.github.com/v3/repos/deployments/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#deployment -class Deployment extends Trigger - -/// Runs your workflow anytime a third party provides a deployment status, which triggers the deployment_status event. -/// Deployments created with a commit SHA may not have a Git ref. -/// For information about the REST API, see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#deployment_status -class DeploymentStatus extends Trigger - -/// Runs your workflow anytime the discussion event occurs. More than one activity type triggers this event. -/// For information about the GraphQL API, see https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#discussion -class Discussion extends Trigger { - types: Listing? -} -typealias DiscussionType = - "created" - |"edited" - |"deleted" - |"transferred" - |"pinned" - |"unpinned" - |"labeled" - |"unlabeled" - |"locked" - |"unlocked" - |"category_changed" - |"answered" - |"unanswered" - -/// Runs your workflow anytime the discussion_comment event occurs. More than one activity type triggers this event. -/// For information about the GraphQL API, see https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#discussion_comment -class DiscussionComment extends Trigger { - types: Listing? -} -typealias DiscussionCommentType = - "created" - |"edited" - |"deleted" - -/// Runs your workflow anytime when someone forks a repository, which triggers the fork event. -/// For information about the REST API, see https://developer.github.com/v3/repos/forks/#create-a-fork -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#fork -class Fork extends Trigger - -/// Runs your workflow when someone creates or updates a Wiki page, which triggers the gollum event. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#gollum -class Gollum extends Trigger - -/// Runs your workflow anytime the issue_comment event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/issues/comments/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment -class IssueComment extends Trigger { - types: Listing? -} -typealias IssueCommentType = - "created" - |"edited" - |"deleted" - -/// Runs your workflow anytime the issues event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/issues. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues -class Issues extends Trigger { - types: Listing? -} -typealias IssuesType = - "opened" - |"edited" - |"deleted" - |"transferred" - |"pinned" - |"unpinned" - |"closed" - |"reopened" - |"assigned" - |"unassigned" - |"labeled" - |"unlabeled" - |"locked" - |"unlocked" - |"milestoned" - |"demilestoned" - -/// Runs your workflow anytime the label event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/issues/labels/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#label -class Label extends Trigger { - types: Listing? -} -typealias LabelType = - "created" - |"edited" - |"deleted" - -/// Runs your workflow when a pull request is added to a merge queue, which adds the pull request to a merge group. -/// For information about the merge queue, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request-with-a-merge-queue. -/// -/// https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#merge_group -class MergeGroup extends Trigger { - types: Listing? -} -typealias MergeGroupType = - "checked_requested" - -/// Runs your workflow anytime the milestone event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/issues/milestones/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#milestone -class Milestone extends Trigger { - types: Listing? -} -typealias MilestoneType = - "created" - |"closed" - |"opened" - |"edited" - |"deleted" - -/// Runs your workflow anytime someone pushes to a GitHub Pages-enabled branch, which triggers the page_build event. -/// For information about the REST API, see https://developer.github.com/v3/repos/pages/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#page_build -class PageBuild extends Trigger - -/// Runs your workflow anytime the project event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/projects/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#project -class Project extends Trigger { - types: Listing? -} -typealias ProjectType = - "created" - |"updated" - |"closed" - |"reopened" - |"edited" - |"deleted" - -/// Runs your workflow anytime the project_card event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/projects/cards. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#project_card -class ProjectCard extends Trigger { - types: Listing? -} -typealias ProjectCardType = - "created" - |"moved" - |"converted" - |"edited" - |"deleted" - -/// Runs your workflow anytime the project_column event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/projects/columns. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#project_column -class ProjectColumn extends Trigger { - types: Listing? -} -typealias ProjectColumnType = - "created" - |"updated" - |"moved" - |"deleted" - -/// Runs your workflow anytime someone makes a private repository public, which triggers the public event. -/// For information about the REST API, see https://developer.github.com/v3/repos/#edit. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#public -class Public extends Trigger - -/// Runs your workflow anytime the pull_request event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/pulls. -/// Note: Workflows do not run on private base repositories when you open a pull request from a forked repository. -/// When you create a pull request from a forked repository to the base repository, -/// GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository. -/// Workflows don't run on forked repositories by default. -/// You must enable GitHub Actions in the Actions tab of the forked repository. -/// The permissions for the GITHUB_TOKEN in forked repositories is read-only. -/// For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request -class PullRequest extends Trigger { - types: Listing? -} -typealias PullRequestType = - "assigned" - |"unassigned" - |"review_requested" - |"review_request_removed" - |"labeled" - |"unlabeled" - |"opened" - |"edited" - |"closed" - |"reopened" - |"synchronize" - |"ready_for_review" - |"locked" - |"unlocked" - |"ready_for_review" - |"converted_to_draft" - |"demilestoned" - |"milestoned" - |"review_requested" - |"review_request_removed" - |"auto_merge_enabled" - |"auto_merge_disabled" - -/// Runs your workflow anytime the pull_request_review event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/pulls/reviews. -/// Note: Workflows do not run on private base repositories when you open a pull request from a forked repository. -/// When you create a pull request from a forked repository to the base repository, -/// GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository. -/// Workflows don't run on forked repositories by default. -/// You must enable GitHub Actions in the Actions tab of the forked repository. -/// The permissions for the GITHUB_TOKEN in forked repositories is read-only. -/// For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_review -class PullRequestReview extends Trigger { - types: Listing? -} -typealias PullRequestReviewType = - "submitted" - |"edited" - |"dismissed" - -/// Runs your workflow anytime a comment on a pull request's unified diff is modified, which triggers the pull_request_review_comment event. -/// More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/pulls/comments. -/// Note: Workflows do not run on private base repositories when you open a pull request from a forked repository. -/// When you create a pull request from a forked repository to the base repository, -/// GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository. -/// Workflows don't run on forked repositories by default. -/// You must enable GitHub Actions in the Actions tab of the forked repository. -/// The permissions for the GITHUB_TOKEN in forked repositories is read-only. -/// For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_review_comment -class PullRequestReviewComment extends Trigger { - types: Listing? -} -typealias PullRequestReviewCommentType = - "created" - |"edited" - |"deleted" - -/// This event is similar to pull_request, except that it runs in the context of the base repository of the pull request, -/// rather than in the merge commit. -/// This means that you can more safely make your secrets available to the workflows triggered by the pull request, -/// because only workflows defined in the commit on the base repository are run. -/// For example, this event allows you to create workflows that label and comment on pull requests, -/// based on the contents of the event payload. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target -class PullRequestTarget extends Trigger { - types: Listing? -} -typealias PullRequestTargetType = - "assigned" - |"unassigned" - |"labeled" - |"unlabeled" - |"opened" - |"edited" - |"closed" - |"reopened" - |"synchronize" - |"converted_to_draft" - |"ready_for_review" - |"locked" - |"unlocked" - |"review_requested" - |"review_request_removed" - |"auto_merge_enabled" - |"auto_merge_disabled" - -/// Runs your workflow when someone pushes to a repository branch, which triggers the push event. -/// Note: The webhook payload available to GitHub Actions does not include the added, removed, and modified attributes in the commit object. -/// You can retrieve the full commit object using the REST API. -/// For more information, see https://developer.github.com/v3/repos/commits/#get-a-single-commit. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push -class Push extends Trigger { - tags: Listing? - `tags-ignore`: Listing? -} - -/// Runs your workflow anytime a package is published or updated. -/// For more information, see https://help.github.com/en/github/managing-packages-with-github-packages -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#registry_package -class RegistryPackage extends Trigger { - types: Listing? -} -typealias RegistryPackageType = - "published" - |"updated" - -/// Runs your workflow anytime the release event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/repos/releases/ in the GitHub Developer documentation. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release -class Release extends Trigger { - types: Listing? -} -typealias ReleaseType = - "published" - |"unpublished" - |"created" - |"edited" - |"deleted" - |"prereleased" - |"released" - -/// You can use the GitHub API to trigger a webhook event called repository_dispatch -/// when you want to trigger a workflow for activity that happens outside of GitHub. -/// For more information, see https://developer.github.com/v3/repos/#create-a-repository-dispatch-event. -/// To trigger the custom repository_dispatch webhook event, you must send a POST request to a GitHub API endpoint -/// and provide an event_type name to describe the activity type. -/// To trigger a workflow run, you must also configure your workflow to use the repository_dispatch event. -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#repository_dispatch -class RepositoryDispatch extends Trigger { - types: Listing? -} - -/// You can schedule a workflow to run at specific UTC times using POSIX cron syntax (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07). -/// Scheduled workflows run on the latest commit on the default or base branch. -/// The shortest interval you can run scheduled workflows is once every 5 minutes. -/// Note: GitHub Actions does not support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly, and @reboot. -/// You can use crontab guru (https://crontab.guru/) to help generate your cron syntax and confirm what time it will run. -/// To help you get started, there is also a list of crontab guru examples (https://crontab.guru/examples.html). -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#schedule -class Schedule extends Trigger { - cron: Listing(length > 0) -} -typealias ScheduleCron = String - -/// Runs your workflow anytime the status of a Git commit changes, which triggers the status event. -/// For information about the REST API, see https://developer.github.com/v3/repos/statuses/. -/// -/// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#status -class Status extends Trigger - -/// Runs your workflow anytime the watch event occurs. More than one activity type triggers this event. -/// For information about the REST API, see https://developer.github.com/v3/activity/starring/ -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#watch -class Watch extends Trigger - -/// Allows workflows to be reused by other workflows. -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_call -class WorkflowCall extends Trigger { - inputs: Mapping? - outputs: Mapping? - secrets: Listing? -} -class WorkflowCallOutput { - description: String? - value: Any -} -class WorkflowCallSecrets { - description: String? - required: Boolean -} - -/// You can now create workflows that are manually triggered with the new workflow_dispatch event. -/// You will then see a 'Run workflow' button on the Actions tab, enabling you to easily trigger a run. -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch -class WorkflowDispatch extends Trigger { - inputs: Mapping? -} - -class WorkflowInput { - description: String - deprecatedMessage: String? - required: Boolean? - default: String? - type: WorkflowInputType? - options: Listing? -} -typealias WorkflowInputType = "boolean"|"string"|"choice"|"environment"|"number" - -/// This event occurs when a workflow run is requested or completed, -/// and allows you to execute a workflow based on the finished result of another workflow. -/// For example, if your pull_request workflow generates build artifacts, -/// you can create a new workflow that uses workflow_run to analyze the results and add a comment to the original pull request. -/// -/// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_run -class WorkflowRun extends Trigger { - types: Listing? - workflows: Listing(length > 0) -} -typealias WorkflowRunType = - "requested" - |"completed" - |"in_progress" - -// On -class On { - branch_protection_rule: BranchProtectionRule? - check_run: CheckRun? - check_suite: CheckSuite? - create: Create? - `delete`: Delete? - deployment: Deployment? - deployment_status: DeploymentStatus? - discussion: Discussion? - discussion_comment: DiscussionComment? - fork: Fork? - gollum: Gollum? - issue_comment: IssueComment? - issues: Issues? - label: Label? - merge_group: MergeGroup? - milestone: Milestone? - page_build: PageBuild? - project: Project? - project_card: ProjectCard? - project_column: ProjectColumn? - public: Public? - pull_request: PullRequest? - pull_request_review: PullRequestReview? - pull_request_review_comment: PullRequestReviewComment? - pull_request_target: PullRequestTarget? - push: Push? - registry_package: RegistryPackage? - release: Release? - repository_dispatch: RepositoryDispatch? - schedule: Schedule? - status: Status? - watch: Watch? - workflow_call: WorkflowCall? - workflow_dispatch: WorkflowDispatch? - workflow_run: WorkflowRun? -} - -// Environment Variables -typealias EnvironmentVariables = Mapping - -// Permissions -class Permissions { - actions: Permission? - checks: Permission? - contents: Permission? - deployments: Permission? - `id-token`: Permission? - issues: Permission? - discussions: Permission? - packages: Permission? - pages: Permission? - `pull-requests`: Permission? - `repository-projects`: Permission? - `security-events`: Permission? - statuses: Permission? -} -typealias Permission = "read"|"write"|"none" - -// Concurrency -class Concurrency { - group: String - `cancel-in-progress`: Boolean -} - -// Strategies -abstract class Strategy - -class MatrixStrategy extends Strategy { - matrix: Mapping - `fail-fast`: Boolean = false -} - -// Jobs -abstract class JobBase { - name: String? - needs: Listing? - `if`: String? - concurrency: Concurrency? - env: EnvironmentVariables? - outputs: Mapping? - `timeout-minutes`: Int? - permissions: (*Permissions|"read-all"|"write-all")? - environment: String? -} - -abstract class StepJobBase extends JobBase { - `runs-on`: Machine|String|Listing - steps: Listing(stepsHasOnlyRunOrUses(this)) -} - -class Job extends StepJobBase - -class MatrixJob extends StepJobBase { - strategy: MatrixStrategy -} - -class ReusableWorkflowJob extends JobBase { - uses: String - with: Mapping? - secrets: Mapping? -} - -// Machines, part of Jobs -abstract class Machine { - name: String -} -class UbuntuLatest extends Machine { - name = "ubuntu-latest" -} -class MacOsLatest extends Machine { - name = "macos-latest" -} -class WindowsLatest extends Machine { - name = "windows-latest" -} - -typealias Shell = "pwsh" | "bash" | "sh" | "cmd" | "powershell" | "python" - -// Step, part of Jobs -class Step { - name: String? - id: String? - `if`: String? - env: EnvironmentVariables? - `working-directory`: String? - run: String? - uses: String? - with: Mapping? - shell: Shell? -} - -// Templating - -name: String - -local const onIsSet = (on: On) -> - on.branch_protection_rule != null || - on.check_run != null || - on.check_suite != null || - on.create != null || - on.`delete` != null || - on.deployment != null || - on.deployment_status != null || - on.discussion != null || - on.discussion_comment != null || - on.fork != null || - on.gollum != null || - on.issue_comment != null || - on.issues != null || - on.label != null || - on.merge_group != null || - on.milestone != null || - on.page_build != null || - on.project != null || - on.project_card != null || - on.project_column != null || - on.public != null || - on.pull_request != null || - on.pull_request_review != null || - on.pull_request_review_comment != null || - on.pull_request_target != null || - on.push != null || - on.registry_package != null || - on.release != null || - on.repository_dispatch != null || - on.schedule != null || - on.status != null || - on.watch != null || - on.workflow_call != null || - on.workflow_dispatch != null || - on.workflow_run != null -on: On(onIsSet) - -env: EnvironmentVariables? - -concurrency: Concurrency? - -permissions: (*Permissions|"read-all"|"write-all")? - -local const jobIsSet = (jobs: Mapping) -> jobs.length > 0 -jobs: Mapping(jobIsSet) - -// Output -local jsonRenderer = new JsonRenderer {} -output { - text = "# Do not modify!\n# This file was generated from a template using https://github.com/apple/pkl\n\n\(super.text)" - renderer = new YamlRenderer { - converters { - ["runs-on"] = (runsOn: String|Machine|Listing) -> if (runsOn is Machine) runsOn.name else runsOn - ["schedule"] = (schedule: Schedule?) -> schedule.ifNonNull((_) -> - schedule.cron.toList().map((cr) -> Map("cron", new RenderDirective { text = " " + jsonRenderer.renderValue(cr) })) - ) - } - } -} - -const local function stepsHasOnlyRunOrUses(steps: Listing): Boolean = steps - .toList() - .every((step) -> !(containsRunAndUses(step) || containsNeitherRunNorUses(step))) -const local function containsRunAndUses(step: Step): Boolean = step.run != null && step.uses != null -const local function containsNeitherRunNorUses(step: Step): Boolean = step.run == null && step.uses == null \ No newline at end of file diff --git a/.github/pkl-workflows/GithubAction/PklProject b/.github/pkl-workflows/GithubAction/PklProject deleted file mode 100644 index 4f9b4d558d..0000000000 --- a/.github/pkl-workflows/GithubAction/PklProject +++ /dev/null @@ -1,8 +0,0 @@ -amends "pkl:Project" - -package { - name = "realm-pkl-gha" - version = "1.0.0" - baseUri = "package://realm.io/realm-pkl-gha" - packageZipUrl = "https://realm.io/realm-pkl-gha@\(version).zip" -} \ No newline at end of file diff --git a/.github/pkl-workflows/GithubAction/PklProject.deps.json b/.github/pkl-workflows/GithubAction/PklProject.deps.json deleted file mode 100644 index 836079aad1..0000000000 --- a/.github/pkl-workflows/GithubAction/PklProject.deps.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schemaVersion": 1, - "resolvedDependencies": {} -} \ No newline at end of file diff --git a/.github/pkl-workflows/PklProject b/.github/pkl-workflows/PklProject deleted file mode 100644 index b98672dbf6..0000000000 --- a/.github/pkl-workflows/PklProject +++ /dev/null @@ -1,5 +0,0 @@ -amends "pkl:Project" - -dependencies { - ["realm-gha"] = import("GithubAction/PklProject") -} \ No newline at end of file diff --git a/.github/pkl-workflows/PklProject.deps.json b/.github/pkl-workflows/PklProject.deps.json deleted file mode 100644 index 6a15a31b7e..0000000000 --- a/.github/pkl-workflows/PklProject.deps.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "schemaVersion": 1, - "resolvedDependencies": { - "package://realm.io/realm-pkl-gha@1": { - "type": "local", - "uri": "projectpackage://realm.io/realm-pkl-gha@1.0.0", - "path": "GithubAction" - } - } -} \ No newline at end of file diff --git a/.github/pkl-workflows/Readme.md b/.github/pkl-workflows/Readme.md index 194b251ecb..8eefddff4d 100644 --- a/.github/pkl-workflows/Readme.md +++ b/.github/pkl-workflows/Readme.md @@ -1,6 +1,6 @@ # Preprocessing the GA workflows -We're using [pkl](http://github.com/apple/pkl) to generate the github actions workflows. +We're using [pkl](http://github.com/apple/pkl) to generate the GitHub actions workflows. ## Prerequisites @@ -18,5 +18,5 @@ Run `pwsh .github/build-workflows.ps1` or the following bash script if you don't ```bash cd $SolutionDir/.github/pkl-workflows -for file in *.pkl ; do pkl eval $file -o ../workflows/$(echo $file | sed s/pkl/yml/) ; done +pkl eval *.pkl -o ../workflows/%{moduleName}.yml ``` From 4032f0d81acf7405f0d57d06091670c28a950eb3 Mon Sep 17 00:00:00 2001 From: StefMa Date: Mon, 21 Oct 2024 16:04:45 +0200 Subject: [PATCH 3/3] Translate pkl actions --- .github/workflows/codeql.yml | 6 +- .github/workflows/main.yml | 227 +++++++++++------------ .github/workflows/pr.yml | 184 +++++++++--------- .github/workflows/publish-prerelease.yml | 4 +- .github/workflows/publish-release.yml | 9 +- .github/workflows/wrappers.yml | 118 ++++++------ 6 files changed, 274 insertions(+), 274 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a7d2f8b2bf..1da22d32f9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,17 +1,17 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: CodeQL 'on': pull_request: + branches: + - main paths: - '**.cs' - '**.cpp' - '**.hpp' - '**.csproj' - .github/workflows/codeql.yml - branches: - - main push: branches: - main diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92b2880a4c..b5a76a6019 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: Main Build 'on': @@ -26,6 +26,17 @@ jobs: deploy-baas: name: Deploy BaaS if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + strategy: + matrix: + differentiator: + - code-coverage + - net-framework + - uwp + - macos-maui + - android-maui + - ios-maui + - macos-maui + fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout Code @@ -43,26 +54,15 @@ jobs: - name: Deploy Apps working-directory: Tools/DeployApps run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }} - strategy: - matrix: - differentiator: - - code-coverage - - net-framework - - uwp - - macos-maui - - android-maui - - ios-maui - - macos-maui - fail-fast: false build-packages: name: Package NuGet + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-wrappers - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + runs-on: windows-latest + timeout-minutes: 30 outputs: package_version: ${{ steps.get-version.outputs.package_version }} - timeout-minutes: 30 - runs-on: windows-latest steps: - name: Checkout Code uses: actions/checkout@v4 @@ -89,6 +89,7 @@ jobs: run: dotnet workload install tvos ios maccatalyst android - name: Set version suffix id: set-version-suffix + shell: pwsh run: |- $suffix = "" if ($env:GITHUB_EVENT_NAME -eq "pull_request") @@ -103,7 +104,6 @@ jobs: $suffix = "alpha.$env:GITHUB_RUN_NUMBER" } echo "build_suffix=$suffix" >> $Env:GITHUB_OUTPUT - shell: pwsh - name: Fetch wrappers for macos uses: actions/download-artifact@v4 with: @@ -217,11 +217,11 @@ jobs: run: msbuild Realm/Realm.UnityWeaver -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }} - name: Read version id: get-version + shell: bash run: |- cd Realm/packages pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p') echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT - shell: bash - name: Store artifacts for Realm.${{ steps.get-version.outputs.package_version }} uses: actions/upload-artifact@v4 with: @@ -276,6 +276,7 @@ jobs: run: C:\docfx\docfx Docs/docfx.json - name: Update Improve this doc links if: contains(github.head_ref, 'release') + shell: pwsh run: |- Get-ChildItem Docs/_site -Filter *.html -Recurse -File | ForEach-Object { @@ -283,7 +284,6 @@ jobs: $content = $content -replace "/Docs/apispec/new\?filename", "/Docs/apispec?filename" Set-Content $_.FullName $content } - shell: pwsh - name: Archive docs if: contains(github.head_ref, 'release') run: Compress-Archive -Path Docs/_site -DestinationPath "Realm/packages/Docs.zip" @@ -297,11 +297,11 @@ jobs: if-no-files-found: error build-unity: name: Package Unity + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: windows-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -352,14 +352,14 @@ jobs: if-no-files-found: error build-unity-tests-linux: name: Build Unity linux + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - build-unity - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: - unity - linux + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -393,11 +393,11 @@ jobs: if-no-files-found: error run-unity-tests-linux: name: Test Unity linux + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-unity-tests-linux - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -431,14 +431,14 @@ jobs: fail-on-error: true build-unity-tests-windows: name: Build Unity windows + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - build-unity - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: - unity - windows + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -472,11 +472,11 @@ jobs: if-no-files-found: error run-unity-tests-windows: name: Test Unity windows + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-unity-tests-windows - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: windows-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -493,10 +493,10 @@ jobs: name: UnityTestsRunner.windows path: TestRunner - name: Run Tests + shell: pwsh run: |- Start-Process ${{ github.workspace }}\TestRunner\PlayerWithTests.exe -Wait -ArgumentList "-logFile","${{ github.workspace }}\test.log","--result=${{ github.workspace }}\TestResults.xml" cat ${{ github.workspace }}\test.log - shell: pwsh - name: Publish Unit Test Results if: always() uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 @@ -509,12 +509,12 @@ jobs: fail-on-error: true test-net-framework: name: Test .NET Framework + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - deploy-baas - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -557,12 +557,12 @@ jobs: fail-on-error: true test-uwp: name: Test UWP + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - deploy-baas - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -587,20 +587,20 @@ jobs: working-directory: Tools/DeployApps run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=uwp-${{ github.run_id }}-${{ github.run_attempt }} - name: Import test certificate + shell: powershell run: |- $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") $currentDirectory = Get-Location [IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte) certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx - shell: powershell - name: Add msbuild to PATH if: ${{ runner.os == 'Windows' }} uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9 - name: Build Tests/Tests.UWP run: msbuild Tests/Tests.UWP -restore -p:Configuration=Release -p:AppxBundle=Always -p:PackageCertificateKeyFile=${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx -p:PackageCertificatePassword=${{ secrets.Pfx_Password }} -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} - name: Run the tests - run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs ' --baasaas-api-key=${{ secrets.BAASAAS_API_KEY}} --baas-differentiator=uwp-${{ github.run_id }}-${{ github.run_attempt }}' shell: powershell + run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs ' --baasaas-api-key=${{ secrets.BAASAAS_API_KEY}} --baas-differentiator=uwp-${{ github.run_id }}-${{ github.run_attempt }}' - name: Publish Unit Test Results if: always() uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 @@ -613,11 +613,29 @@ jobs: fail-on-error: true test-net-core: name: Test ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }} + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 + strategy: + matrix: + framework: + - net6.0 + - net8.0 + os: + - runner: windows-latest + runtime: win-x64 + - runner: ubuntu-latest + runtime: linux-x64 + - runner: macos-14 + runtime: osx-x64 + include: + - framework: net8.0 + os: + runner: macos-14 + runtime: osx-arm64 + fail-fast: false runs-on: ${{ matrix.os.runner }} + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -645,10 +663,10 @@ jobs: run: dotnet nuget locals all --clear - name: Extract .NET version id: get-net-version + shell: bash run: |2- NET_VERSION=$(echo '${{ matrix.framework }}.x' | sed 's/net//g') echo "version=$NET_VERSION" >> $GITHUB_OUTPUT - shell: bash - uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59 with: dotnet-version: ${{ steps.get-net-version.outputs.version }} @@ -656,8 +674,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests env: DOTNET_DbgEnableMiniDump: 1 @@ -681,31 +699,13 @@ jobs: list-suites: failed path-replace-backslashes: true fail-on-error: true - strategy: - matrix: - framework: - - net6.0 - - net8.0 - os: - - runner: windows-latest - runtime: win-x64 - - runner: ubuntu-latest - runtime: linux-x64 - - runner: macos-13 - runtime: osx-x64 - include: - - framework: net8.0 - os: - runner: macos-14 - runtime: osx-arm64 - fail-fast: false test-macos-xamarin: name: Test Xamarin.macOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -745,12 +745,12 @@ jobs: fail-on-error: true test-macos-maui: name: Test Maui.MacCatalyst + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - deploy-baas - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-13 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -801,11 +801,11 @@ jobs: fail-on-error: true test-ios-xamarin: name: Test Xamarin.iOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -851,12 +851,12 @@ jobs: fail-on-error: true test-ios-maui: name: Test Maui.iOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - deploy-baas - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-13 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -913,11 +913,11 @@ jobs: fail-on-error: true test-tvos: name: Test Xamarin.tvOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -963,11 +963,11 @@ jobs: fail-on-error: true test-android-xamarin: name: Test Xamarin.Android + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Setup JDK uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a @@ -1024,12 +1024,12 @@ jobs: fail-on-error: true test-android-maui: name: Test Maui.Android + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - deploy-baas - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Setup JDK uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a @@ -1067,8 +1067,8 @@ jobs: run: dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4.0.2 with: @@ -1097,11 +1097,11 @@ jobs: fail-on-error: true test-woven-classes: name: Test Woven Classes + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1126,8 +1126,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true -p:TestWeavedClasses=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1143,8 +1143,8 @@ jobs: test-source-generation: name: Test Source Generation if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1164,8 +1164,8 @@ jobs: run: dotnet publish Tests/SourceGenerators/Realm.SourceGenerator.Tests -c Release -f net6.0 -r win-x64 --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/SourceGenerators/Realm.SourceGenerator.Tests/bin/Release/net6.0/win-x64/Realm.SourceGenerator.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/SourceGenerators/Realm.SourceGenerator.Tests/bin/Release/net6.0/win-x64/Realm.SourceGenerator.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1181,8 +1181,18 @@ jobs: test-weaver: name: Test Weaver if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 + strategy: + matrix: + os: + - runner: windows-latest + runtime: win-x64 + - runner: ubuntu-latest + runtime: linux-x64 + - runner: macos-14 + runtime: osx-arm64 + fail-fast: false runs-on: ${{ matrix.os.runner }} + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1202,8 +1212,8 @@ jobs: run: dotnet publish Tests/Weaver/Realm.Fody.Tests -c Release -f net6.0 -r ${{ matrix.os.runtime }} --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Weaver/Realm.Fody.Tests/bin/Release/net6.0/${{ matrix.os.runtime }}/Realm.Fody.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Weaver/Realm.Fody.Tests/bin/Release/net6.0/${{ matrix.os.runtime }}/Realm.Fody.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1216,23 +1226,13 @@ jobs: list-suites: failed path-replace-backslashes: true fail-on-error: true - strategy: - matrix: - os: - - runner: windows-latest - runtime: win-x64 - - runner: ubuntu-latest - runtime: linux-x64 - - runner: macos-14 - runtime: osx-arm64 - fail-fast: false test-code-coverage: name: Test Code Coverage + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-wrappers - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: ubuntu-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1260,8 +1260,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r linux-x64 -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests env: DOTNET_DbgEnableMiniDump: 1 @@ -1297,6 +1297,7 @@ jobs: fail-on-error: true cleanup-baas: name: Cleanup BaaS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - test-code-coverage - test-net-framework @@ -1305,7 +1306,17 @@ jobs: - test-android-maui - test-ios-maui - test-macos-maui - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + strategy: + matrix: + differentiator: + - code-coverage + - net-framework + - uwp + - macos-maui + - android-maui + - ios-maui + - macos-maui + fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout Code @@ -1323,17 +1334,6 @@ jobs: - name: Terminate Baas working-directory: Tools/DeployApps run: dotnet run terminate-baas --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }} - strategy: - matrix: - differentiator: - - code-coverage - - net-framework - - uwp - - macos-maui - - android-maui - - ios-maui - - macos-maui - fail-fast: false verify-namespaces: name: Verify Namespaces needs: @@ -1367,6 +1367,7 @@ jobs: path: ${{ github.workspace }}/Realm/packages/ - run: dotnet tool install ilspycmd -g --version 8.0.0.7345 - name: Verify Namespaces + shell: pwsh run: |- $isFailure = $false Get-ChildItem ./Realm/packages -Filter *.nupkg | Foreach-Object { @@ -1392,7 +1393,6 @@ jobs: if ($isFailure) { exit 1 } - shell: pwsh lint: name: Verify TODOs runs-on: ubuntu-latest @@ -1410,9 +1410,8 @@ jobs: pattern: \\WR[A-Z]+-[0-9]+ publish-packages-to-sleet: name: Publish package to S3 - needs: - - build-packages if: ${{ always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name == 'push' || github.event.inputs.publish-prerelease) }} + needs: build-packages runs-on: ubuntu-latest steps: - name: Checkout Code @@ -1447,11 +1446,11 @@ jobs: run: sleet push ${{ github.workspace }}/Realm/packages/Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }}.nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource test-xunit: name: Test xUnit Compatibility + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1476,17 +1475,17 @@ jobs: run: dotnet publish Tests/Tests.XUnit -c Release -f net6.0 -r win-x64 --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Tests.XUnit/bin/Release/net6.0/win-x64/Tests.XUnit' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Tests.XUnit/bin/Release/net6.0/win-x64/Tests.XUnit' >> $GITHUB_OUTPUT - name: Run Tests run: dotnet test ${{ steps.dotnet-publish.outputs.executable-path }}/Tests.XUnit.dll --logger GitHubActions benchmark-linux: name: Test Benchmark + if: ${{ always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name == 'push' || github.event.inputs.run-benchmark) }} needs: - build-packages - if: ${{ always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && (github.event_name == 'push' || github.event.inputs.run-benchmark) }} - timeout-minutes: 60 runs-on: performance-tests + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1515,17 +1514,17 @@ jobs: run: dotnet publish Tests/Benchmarks/PerformanceTests -c Release -f net6.0 -r linux-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Benchmarks/PerformanceTests/bin/Release/net6.0/linux-x64/PerformanceTests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Benchmarks/PerformanceTests/bin/Release/net6.0/linux-x64/PerformanceTests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }}/PerformanceTests -f "*" --join - name: Find Results file id: find-results-file + shell: bash run: |- cd BenchmarkDotNet.Artifacts/results file=$(basename BenchmarkRun*json) echo "benchmark-results=$file" >> $GITHUB_OUTPUT - shell: bash - name: Publish Benchmark Results uses: ./github/actions/benchmark-uploader with: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 755fcbe25f..b917bf821c 100755 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,5 +1,5 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: PR Build 'on': @@ -32,6 +32,11 @@ jobs: deploy-baas: name: Deploy BaaS if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + strategy: + matrix: + differentiator: + - code-coverage + fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout Code @@ -49,20 +54,15 @@ jobs: - name: Deploy Apps working-directory: Tools/DeployApps run: dotnet run deploy-apps --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }} - strategy: - matrix: - differentiator: - - code-coverage - fail-fast: false build-packages: name: Package NuGet + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-wrappers - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + runs-on: windows-latest + timeout-minutes: 30 outputs: package_version: ${{ steps.get-version.outputs.package_version }} - timeout-minutes: 30 - runs-on: windows-latest steps: - name: Checkout Code uses: actions/checkout@v4 @@ -89,6 +89,7 @@ jobs: run: dotnet workload install tvos ios maccatalyst android - name: Set version suffix id: set-version-suffix + shell: pwsh run: |- $suffix = "" if ($env:GITHUB_EVENT_NAME -eq "pull_request") @@ -103,7 +104,6 @@ jobs: $suffix = "alpha.$env:GITHUB_RUN_NUMBER" } echo "build_suffix=$suffix" >> $Env:GITHUB_OUTPUT - shell: pwsh - name: Fetch wrappers for macos uses: actions/download-artifact@v4 with: @@ -217,11 +217,11 @@ jobs: run: msbuild Realm/Realm.UnityWeaver -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }} - name: Read version id: get-version + shell: bash run: |- cd Realm/packages pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p') echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT - shell: bash - name: Store artifacts for Realm.${{ steps.get-version.outputs.package_version }} uses: actions/upload-artifact@v4 with: @@ -276,6 +276,7 @@ jobs: run: C:\docfx\docfx Docs/docfx.json - name: Update Improve this doc links if: contains(github.head_ref, 'release') + shell: pwsh run: |- Get-ChildItem Docs/_site -Filter *.html -Recurse -File | ForEach-Object { @@ -283,7 +284,6 @@ jobs: $content = $content -replace "/Docs/apispec/new\?filename", "/Docs/apispec?filename" Set-Content $_.FullName $content } - shell: pwsh - name: Archive docs if: contains(github.head_ref, 'release') run: Compress-Archive -Path Docs/_site -DestinationPath "Realm/packages/Docs.zip" @@ -297,11 +297,11 @@ jobs: if-no-files-found: error build-unity: name: Package Unity + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: windows-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -352,14 +352,14 @@ jobs: if-no-files-found: error build-unity-tests-linux: name: Build Unity linux + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - build-unity - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: - unity - linux + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -393,11 +393,11 @@ jobs: if-no-files-found: error run-unity-tests-linux: name: Test Unity linux + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-unity-tests-linux - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -431,14 +431,14 @@ jobs: fail-on-error: true build-unity-tests-windows: name: Build Unity windows + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - build-unity - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: - unity - windows + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -472,11 +472,11 @@ jobs: if-no-files-found: error run-unity-tests-windows: name: Test Unity windows + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-unity-tests-windows - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 30 runs-on: windows-latest + timeout-minutes: 30 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -493,10 +493,10 @@ jobs: name: UnityTestsRunner.windows path: TestRunner - name: Run Tests + shell: pwsh run: |- Start-Process ${{ github.workspace }}\TestRunner\PlayerWithTests.exe -Wait -ArgumentList "-logFile","${{ github.workspace }}\test.log","--result=${{ github.workspace }}\TestResults.xml" cat ${{ github.workspace }}\test.log - shell: pwsh - name: Publish Unit Test Results if: always() uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 @@ -509,11 +509,11 @@ jobs: fail-on-error: true test-net-framework: name: Test .NET Framework + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -553,11 +553,11 @@ jobs: fail-on-error: true test-uwp: name: Test UWP + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -579,20 +579,20 @@ jobs: name: Realm.PlatformHelpers.${{ needs.build-packages.outputs.package_version }} path: ${{ github.workspace }}/Realm/packages/ - name: Import test certificate + shell: powershell run: |- $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") $currentDirectory = Get-Location [IO.File]::WriteAllBytes("${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx", $pfx_cert_byte) certutil -f -p "${{ secrets.Pfx_Password }}" -importpfx my ${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx - shell: powershell - name: Add msbuild to PATH if: ${{ runner.os == 'Windows' }} uses: microsoft/setup-msbuild@70b70342ae97ca98d5eaad06cafd26d30f9592a9 - name: Build Tests/Tests.UWP run: msbuild Tests/Tests.UWP -restore -p:Configuration=Release -p:AppxBundle=Always -p:PackageCertificateKeyFile=${{ github.workspace }}\Tests\Tests.UWP\Tests.UWP_TemporaryKey.pfx -p:PackageCertificatePassword=${{ secrets.Pfx_Password }} -p:UseDotNetNativeToolchain=false -p:AppxBundlePlatforms=x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} - name: Run the tests - run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs '' shell: powershell + run: ./Tests/Tests.UWP/RunTests.ps1 -ExtraAppArgs '' - name: Publish Unit Test Results if: always() uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 @@ -605,11 +605,28 @@ jobs: fail-on-error: true test-net-core: name: Test ${{ matrix.framework }}, ${{ (matrix.os.runner == 'win81' && 'win81') || matrix.os.runtime }} + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 + strategy: + matrix: + framework: + - net6.0 + os: + - runner: windows-latest + runtime: win-x64 + - runner: ubuntu-latest + runtime: linux-x64 + - runner: macos-14 + runtime: osx-x64 + include: + - framework: net8.0 + os: + runner: macos-14 + runtime: osx-arm64 + fail-fast: false runs-on: ${{ matrix.os.runner }} + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -637,10 +654,10 @@ jobs: run: dotnet nuget locals all --clear - name: Extract .NET version id: get-net-version + shell: bash run: |2- NET_VERSION=$(echo '${{ matrix.framework }}.x' | sed 's/net//g') echo "version=$NET_VERSION" >> $GITHUB_OUTPUT - shell: bash - uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59 with: dotnet-version: ${{ steps.get-net-version.outputs.version }} @@ -648,8 +665,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f ${{ matrix.framework }} -r ${{ matrix.os.runtime }} -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/${{ matrix.framework }}/${{ matrix.os.runtime }}/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests env: DOTNET_DbgEnableMiniDump: 1 @@ -673,30 +690,13 @@ jobs: list-suites: failed path-replace-backslashes: true fail-on-error: true - strategy: - matrix: - framework: - - net6.0 - os: - - runner: windows-latest - runtime: win-x64 - - runner: ubuntu-latest - runtime: linux-x64 - - runner: macos-13 - runtime: osx-x64 - include: - - framework: net8.0 - os: - runner: macos-14 - runtime: osx-arm64 - fail-fast: false test-macos-xamarin: name: Test Xamarin.macOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -736,11 +736,11 @@ jobs: fail-on-error: true test-macos-maui: name: Test Maui.MacCatalyst + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-13 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -788,11 +788,11 @@ jobs: fail-on-error: true test-ios-xamarin: name: Test Xamarin.iOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -838,11 +838,11 @@ jobs: fail-on-error: true test-ios-maui: name: Test Maui.iOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-13 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -896,11 +896,11 @@ jobs: fail-on-error: true test-tvos: name: Test Xamarin.tvOS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: macos-12 + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -946,11 +946,11 @@ jobs: fail-on-error: true test-android-xamarin: name: Test Xamarin.Android + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Setup JDK uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a @@ -1007,11 +1007,11 @@ jobs: fail-on-error: true test-android-maui: name: Test Maui.Android + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Setup JDK uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a @@ -1046,8 +1046,8 @@ jobs: run: dotnet publish Tests/Tests.Maui -c Release -f net8.0-android -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Tests.Maui/bin/Release/net8.0-android/null/Tests.Maui' >> $GITHUB_OUTPUT - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4.0.2 with: @@ -1076,11 +1076,11 @@ jobs: fail-on-error: true test-woven-classes: name: Test Woven Classes + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-packages - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1105,8 +1105,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r win-x64 -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }} -p:RealmTestsStandaloneExe=true -p:TestWeavedClasses=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/win-x64/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1122,8 +1122,8 @@ jobs: test-source-generation: name: Test Source Generation if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: windows-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1143,8 +1143,8 @@ jobs: run: dotnet publish Tests/SourceGenerators/Realm.SourceGenerator.Tests -c Release -f net6.0 -r win-x64 --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/SourceGenerators/Realm.SourceGenerator.Tests/bin/Release/net6.0/win-x64/Realm.SourceGenerator.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/SourceGenerators/Realm.SourceGenerator.Tests/bin/Release/net6.0/win-x64/Realm.SourceGenerator.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1160,8 +1160,18 @@ jobs: test-weaver: name: Test Weaver if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 + strategy: + matrix: + os: + - runner: windows-latest + runtime: win-x64 + - runner: ubuntu-latest + runtime: linux-x64 + - runner: macos-14 + runtime: osx-arm64 + fail-fast: false runs-on: ${{ matrix.os.runner }} + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1181,8 +1191,8 @@ jobs: run: dotnet publish Tests/Weaver/Realm.Fody.Tests -c Release -f net6.0 -r ${{ matrix.os.runtime }} --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Weaver/Realm.Fody.Tests/bin/Release/net6.0/${{ matrix.os.runtime }}/Realm.Fody.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Weaver/Realm.Fody.Tests/bin/Release/net6.0/${{ matrix.os.runtime }}/Realm.Fody.Tests' >> $GITHUB_OUTPUT - name: Run the tests run: ${{ steps.dotnet-publish.outputs.executable-path }} --result=TestResults.xml --labels=After - name: Publish Unit Test Results @@ -1195,23 +1205,13 @@ jobs: list-suites: failed path-replace-backslashes: true fail-on-error: true - strategy: - matrix: - os: - - runner: windows-latest - runtime: win-x64 - - runner: ubuntu-latest - runtime: linux-x64 - - runner: macos-14 - runtime: osx-arm64 - fail-fast: false test-code-coverage: name: Test Code Coverage + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - build-wrappers - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') - timeout-minutes: 60 runs-on: ubuntu-latest + timeout-minutes: 60 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -1239,8 +1239,8 @@ jobs: run: dotnet publish Tests/Realm.Tests -c Release -f net8.0 -r linux-x64 -p:RealmTestsStandaloneExe=true --no-self-contained - name: Output executable path id: dotnet-publish - run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64/Realm.Tests' >> $GITHUB_OUTPUT shell: bash + run: echo 'executable-path=./Tests/Realm.Tests/bin/Release/net8.0/linux-x64/Realm.Tests' >> $GITHUB_OUTPUT - name: Run the tests env: DOTNET_DbgEnableMiniDump: 1 @@ -1276,9 +1276,14 @@ jobs: fail-on-error: true cleanup-baas: name: Cleanup BaaS + if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') needs: - test-code-coverage - if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + strategy: + matrix: + differentiator: + - code-coverage + fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout Code @@ -1296,11 +1301,6 @@ jobs: - name: Terminate Baas working-directory: Tools/DeployApps run: dotnet run terminate-baas --baasaas-api-key=${{ secrets.BAASAAS_API_KEY }} --baas-differentiator=${{ matrix.differentiator }}-${{ github.run_id }}-${{ github.run_attempt }} - strategy: - matrix: - differentiator: - - code-coverage - fail-fast: false verify-namespaces: name: Verify Namespaces needs: @@ -1334,6 +1334,7 @@ jobs: path: ${{ github.workspace }}/Realm/packages/ - run: dotnet tool install ilspycmd -g --version 8.0.0.7345 - name: Verify Namespaces + shell: pwsh run: |- $isFailure = $false Get-ChildItem ./Realm/packages -Filter *.nupkg | Foreach-Object { @@ -1359,7 +1360,6 @@ jobs: if ($isFailure) { exit 1 } - shell: pwsh lint: name: Verify TODOs runs-on: ubuntu-latest diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml index 45019006a8..272a9c0f01 100644 --- a/.github/workflows/publish-prerelease.yml +++ b/.github/workflows/publish-prerelease.yml @@ -1,5 +1,5 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: Publish Prerelease 'on': @@ -26,11 +26,11 @@ jobs: workflow_conclusion: completed - name: Read version id: get-version + shell: bash run: |- cd Realm/packages pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p') echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT - shell: bash - uses: actions/setup-dotnet@5d1464d5da459f3d7085106d52e499f4dc5d0f59 with: dotnet-version: 8.0.x diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 7ddf53b098..9e60662a17 100755 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,5 +1,5 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: Publish Release 'on': @@ -10,8 +10,9 @@ env: jobs: main: name: Publish Release - environment: Production runs-on: windows-latest + environment: + name: Production steps: - name: Checkout Code uses: actions/checkout@v4 @@ -27,11 +28,11 @@ jobs: workflow_conclusion: completed - name: Read version id: get-version + shell: bash run: |- cd Realm/packages pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p') echo "package_version=$pkgVersion" >> $GITHUB_OUTPUT - shell: bash - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4.0.2 with: @@ -80,6 +81,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} draft: false - name: Update Changelog + shell: bash run: |- echo "## vNext (TBD) @@ -96,7 +98,6 @@ jobs: * Using Core x.y.z. " | cat - CHANGELOG.md >> temp mv temp CHANGELOG.md - shell: bash - name: Create vNext PR id: vnext-pr uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e diff --git a/.github/workflows/wrappers.yml b/.github/workflows/wrappers.yml index 3274f7d0c1..f13a31a2e3 100755 --- a/.github/workflows/wrappers.yml +++ b/.github/workflows/wrappers.yml @@ -1,5 +1,5 @@ # Do not modify! -# This file was generated from a template using https://github.com/apple/pkl +# This file was generated from a template using https://github.com/StefMa/pkl-gha name: wrappers 'on': @@ -10,6 +10,13 @@ env: jobs: check-cache: name: Check Cache + strategy: + matrix: + os: + - ubuntu + - windows + fail-fast: false + runs-on: ${{ matrix.os }}-latest env: CACHE_SKIP_SAVE: true outputs: @@ -33,7 +40,6 @@ jobs: wrappers-iOS-Simulator: ${{ steps.check-cache-iOS-Simulator.outputs.cache-hit }} wrappers-tvOS-Device: ${{ steps.check-cache-tvOS-Device.outputs.cache-hit }} wrappers-tvOS-Simulator: ${{ steps.check-cache-tvOS-Simulator.outputs.cache-hit }} - runs-on: ${{ matrix.os }}-latest steps: - name: Checkout Code uses: actions/checkout@v4 @@ -380,19 +386,13 @@ jobs: if-no-files-found: error - if: matrix.os == 'ubuntu' run: git clean -fdx - strategy: - matrix: - os: - - ubuntu - - windows - fail-fast: false macos: name: MacOS + if: needs.check-cache.outputs.wrappers-macos != 'true' needs: - check-cache - if: needs.check-cache.outputs.wrappers-macos != 'true' - timeout-minutes: 90 runs-on: macos-12 + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -422,11 +422,11 @@ jobs: if-no-files-found: error catalyst: name: Catalyst + if: needs.check-cache.outputs.wrappers-catalyst != 'true' needs: - check-cache - if: needs.check-cache.outputs.wrappers-catalyst != 'true' - timeout-minutes: 90 runs-on: macos-12 + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -456,11 +456,20 @@ jobs: if-no-files-found: error apple-platform: name: Apple Platform + if: needs.check-cache.outputs.wrappers-iOS-Device != 'true' || needs.check-cache.outputs.wrappers-iOS-Simulator != 'true' || needs.check-cache.outputs.wrappers-tvOS-Device != 'true' || needs.check-cache.outputs.wrappers-tvOS-Simulator != 'true' needs: - check-cache - if: needs.check-cache.outputs.wrappers-iOS-Device != 'true' || needs.check-cache.outputs.wrappers-iOS-Simulator != 'true' || needs.check-cache.outputs.wrappers-tvOS-Device != 'true' || needs.check-cache.outputs.wrappers-tvOS-Simulator != 'true' - timeout-minutes: 90 + strategy: + matrix: + platform: + - iOS + - tvOS + target: + - Device + - Simulator + fail-fast: false runs-on: macos-12 + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -493,22 +502,20 @@ jobs: path: wrappers/build/** retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} if-no-files-found: error - strategy: - matrix: - platform: - - iOS - - tvOS - target: - - Device - - Simulator - fail-fast: false linux: name: Linux + if: needs.check-cache.outputs.wrappers-linux-x86_64 != 'true' || needs.check-cache.outputs.wrappers-linux-armhf != 'true' || needs.check-cache.outputs.wrappers-linux-aarch64 != 'true' needs: - check-cache - if: needs.check-cache.outputs.wrappers-linux-x86_64 != 'true' || needs.check-cache.outputs.wrappers-linux-armhf != 'true' || needs.check-cache.outputs.wrappers-linux-aarch64 != 'true' - timeout-minutes: 90 + strategy: + matrix: + arch: + - x86_64 + - armhf + - aarch64 + fail-fast: false runs-on: ubuntu-latest + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -534,20 +541,21 @@ jobs: path: wrappers/build/** retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} if-no-files-found: error + android: + name: Android + if: needs.check-cache.outputs.wrappers-android-armeabi-v7a != 'true' || needs.check-cache.outputs.wrappers-android-arm64-v8a != 'true' || needs.check-cache.outputs.wrappers-android-x86 != 'true' || needs.check-cache.outputs.wrappers-android-x86_64 != 'true' + needs: + - check-cache strategy: matrix: arch: + - armeabi-v7a + - arm64-v8a + - x86 - x86_64 - - armhf - - aarch64 fail-fast: false - android: - name: Android - needs: - - check-cache - if: needs.check-cache.outputs.wrappers-android-armeabi-v7a != 'true' || needs.check-cache.outputs.wrappers-android-arm64-v8a != 'true' || needs.check-cache.outputs.wrappers-android-x86 != 'true' || needs.check-cache.outputs.wrappers-android-x86_64 != 'true' - timeout-minutes: 90 runs-on: ubuntu-20.04 + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -570,21 +578,20 @@ jobs: path: wrappers/build/** retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} if-no-files-found: error - strategy: - matrix: - arch: - - armeabi-v7a - - arm64-v8a - - x86 - - x86_64 - fail-fast: false windows: name: Windows + if: needs.check-cache.outputs.wrappers-windows-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-ARM64 != 'true' needs: - check-cache - if: needs.check-cache.outputs.wrappers-windows-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-ARM64 != 'true' - timeout-minutes: 90 + strategy: + matrix: + arch: + - Win32 + - x64 + - ARM64 + fail-fast: false runs-on: windows-latest + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -599,8 +606,8 @@ jobs: key: wrappers-windows-${{ matrix.arch }}-Release-${{hashFiles('./wrappers/**')}} - name: Setup MSVC if: steps.check-cache.outputs.cache-hit != 'true' - run: Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru shell: pwsh + run: Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru - name: Build Wrappers if: steps.check-cache.outputs.cache-hit != 'true' run: pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -ExtraCMakeArgs "-T v143,version=14.35" -Configuration Release -EnableLTO @@ -611,20 +618,21 @@ jobs: path: wrappers/build/** retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} if-no-files-found: error + uwp: + name: UWP + if: needs.check-cache.outputs.wrappers-windows-uwp-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM64 != 'true' + needs: + - check-cache strategy: matrix: arch: - Win32 - x64 + - ARM - ARM64 fail-fast: false - uwp: - name: UWP - needs: - - check-cache - if: needs.check-cache.outputs.wrappers-windows-uwp-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM64 != 'true' - timeout-minutes: 90 runs-on: windows-latest + timeout-minutes: 90 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -639,8 +647,8 @@ jobs: key: wrappers-windows-uwp-${{ matrix.arch }}-Release-${{hashFiles('./wrappers/**')}} - name: Setup MSVC if: steps.check-cache.outputs.cache-hit != 'true' - run: Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru shell: pwsh + run: Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --add Microsoft.VisualStudio.Component.VC.14.35.17.5.${{ startswith(matrix.arch, 'ARM') && matrix.arch || 'x86.x64' }}' -Wait -PassThru - name: Build Wrappers if: steps.check-cache.outputs.cache-hit != 'true' run: pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -ExtraCMakeArgs "-T v143,version=14.35" -Configuration Release -EnableLTO @@ -651,11 +659,3 @@ jobs: path: wrappers/build/** retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }} if-no-files-found: error - strategy: - matrix: - arch: - - Win32 - - x64 - - ARM - - ARM64 - fail-fast: false