-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use upstream pkl-gha for GitHub Action Workflows (#3677)
* Use upstream for pkl workflows Signed-off-by: StefMa <[email protected]> * Remove custom pkl project Signed-off-by: StefMa <[email protected]> * Translate pkl actions --------- Signed-off-by: StefMa <[email protected]>
- Loading branch information
Showing
25 changed files
with
399 additions
and
1,108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
Get-ChildItem -Path './pkl-workflows' -Filter *.pkl -File -Name | ForEach-Object { | ||
&pkl eval ./pkl-workflows/$_ -o "./workflows/$($_.Replace('pkl', 'yml'))" | ||
} | ||
pkl eval pkl-workflows/*.pkl -o workflows/%{moduleName}.yml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module codeql | ||
|
||
amends "GithubAction/GithubAction.pkl" | ||
amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
module baas | ||
|
||
import "../GithubAction/GithubAction.pkl" as gha | ||
import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/GitHubAction.pkl" as gha | ||
import "Common.pkl" | ||
import "Steps.pkl" | ||
|
||
function deploy(differentiators: Listing<Common.SyncDifferentiator>): gha.MatrixJob = new { | ||
function deploy(differentiators: Listing<Common.SyncDifferentiator>): 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<Common.SyncDifferentiator>): gha.MatrixJob = new { | ||
function cleanup(differentiators: Listing<Common.SyncDifferentiator>): 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 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module common | ||
|
||
import "../GithubAction/GithubAction.pkl" as gha | ||
import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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<String> = | ||
List("macos", "catalyst") | ||
|
@@ -36,7 +36,7 @@ const wrapperBinaryNames: List<String> = | |
+ uwpArchs.map((arch) -> "windows-uwp-\(arch)") | ||
+ applePlatformTargets((platform, target) -> "\(platform)-\(target)") | ||
|
||
const defaultEnv: Mapping<String, String | Boolean> = new { | ||
const defaultEnv: Mapping<String, String|Boolean|Number> = new { | ||
["REALM_DISABLE_ANALYTICS"] = true | ||
["DOTNET_NOLOGO"] = true | ||
} | ||
|
@@ -50,13 +50,13 @@ const packages: List<String> = nugetPackages + List("Realm.UnityUtils", "Realm.U | |
|
||
const testTimeout: Int = 60 | ||
|
||
const function defaultBuildJobs(baasDifferentiators: Listing<SyncDifferentiator>, netCoreVersions: Listing<NetFramework>): Mapping<String, gha.JobBase> = new { | ||
[job_Wrappers] = new gha.ReusableWorkflowJob { | ||
const function defaultBuildJobs(baasDifferentiators: Listing<SyncDifferentiator>, netCoreVersions: Listing<NetFramework>): Mapping<String, gha.Job> = 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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected]#/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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module package | ||
|
||
import "../GithubAction/GithubAction.pkl" as gha | ||
import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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,15 +37,15 @@ 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) | ||
} | ||
} | ||
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 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import "../GithubAction/GithubAction.pkl" as gha | ||
import "Common.pkl" | ||
import "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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<gha.Step> = new { | ||
const function checkout(submodules: (Boolean|"recursive")): Listing<gha.Step> = 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<gha.Step> = 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<gha.Step> = new { | ||
const function uploadToNPM(tag: "latest"|"alpha"): Listing<gha.Step> = 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<String> | ||
target: String? | ||
properties: Mapping<String, String> = new{} | ||
properties: Mapping<String, String> = 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 { | ||
|
Oops, something went wrong.