-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use upstream pkl-gha for GitHub Action Workflows #3677
Open
StefMa
wants to merge
3
commits into
realm:main
Choose a base branch
from
StefMa:use-upstream-pkl-gha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is correct.
Please check this if this still works.
I'm not a Windows user...