Skip to content
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

Merge main into community #3686

Merged
merged 16 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/run-android-device-farm-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ runs:
remote_src: true
test_spec: |
version: 0.1
android_test_host: amazon_linux_2
phases:
install:
commands:
Expand Down
2 changes: 1 addition & 1 deletion .github/build-workflows.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Get-ChildItem -Path './pkl-workflows' -Filter *.pkl -File -Name | ForEach-Object {
&pkl eval ./pkl-workflows/$_ -o "./workflows/$($_.Replace('pkl', 'yml'))"
}
}
695 changes: 0 additions & 695 deletions .github/pkl-workflows/GithubAction/GithubAction.pkl

This file was deleted.

8 changes: 0 additions & 8 deletions .github/pkl-workflows/GithubAction/PklProject

This file was deleted.

4 changes: 0 additions & 4 deletions .github/pkl-workflows/GithubAction/PklProject.deps.json

This file was deleted.

5 changes: 0 additions & 5 deletions .github/pkl-workflows/PklProject

This file was deleted.

10 changes: 0 additions & 10 deletions .github/pkl-workflows/PklProject.deps.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/pkl-workflows/Readme.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
```
23 changes: 10 additions & 13 deletions .github/pkl-workflows/helpers/Common.pkl
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 "Lint.pkl"
import "Package.pkl"
import "Test.pkl" as TestJobs
Expand All @@ -11,7 +11,7 @@ const linuxArchs: List<String> = List("x86_64", "armhf", "aarch64")
const applePlatforms: List<String> = List("iOS", "tvOS")
const androidABIs: List<String> = List("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
const windowsArchs: List<String> = List("Win32", "x64", "ARM64")
const uwpArchs: List<String> = List("Win32", "x64", "ARM", "ARM64")
const uwpArchs: List<String> = List("Win32", "x64", "ARM64")

const appleTargets: List<String> = List("Device", "Simulator")

Expand All @@ -23,9 +23,9 @@ local const job_Wrappers: String = "build-wrappers"

const mainBranch: String = "community"

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"))|String(startsWith("net9"))
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")
Expand All @@ -35,7 +35,8 @@ 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
}

Expand All @@ -48,12 +49,12 @@ const packages: List<String> = nugetPackages + List("Realm.UnityUtils", "Realm.U

const testTimeout: Int = 60

const function defaultBuildJobs(netCoreVersions: Listing<NetFramework>): Mapping<String, gha.JobBase> = new {
[job_Wrappers] = new gha.ReusableWorkflowJob {
const function defaultBuildJobs(netCoreVersions: Listing<NetFramework>): Mapping<String, gha.Job> = new {
[job_Wrappers] = new gha.ReusableJob {
uses = "./.github/workflows/wrappers.yml"
name = "Wrappers"
}
[job_Packages] = (Package.nuget("contains(github.head_ref, 'release')")){
[job_Packages] = (Package.nuget("contains(github.head_ref, 'release')")) {
needs {
job_Wrappers
}
Expand All @@ -69,12 +70,8 @@ const function defaultBuildJobs(netCoreVersions: Listing<NetFramework>): Mapping
["test-net-framework"] = TestJobs.netFramework()
["test-uwp"] = TestJobs.uwp()
["test-net-core"] = TestJobs.netCore(netCoreVersions)
["test-macos-xamarin"] = TestJobs.macOS_Xamarin()
["test-macos-maui"] = TestJobs.macOS_Maui()
["test-ios-xamarin"] = TestJobs.iOS_Xamarin()
["test-ios-maui"] = TestJobs.iOS_Maui()
["test-tvos"] = TestJobs.tvOS()
["test-android-xamarin"] = TestJobs.android_Xamarin()
["test-android-maui"] = TestJobs.android_Maui()
["test-woven-classes"] = TestJobs.wovenClasses()
["test-source-generation"] = TestJobs.sourceGeneration()
Expand Down
12 changes: 6 additions & 6 deletions .github/pkl-workflows/helpers/Lint.pkl
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 {
Expand All @@ -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
Expand All @@ -33,7 +33,7 @@ function verifyNamespaces(): gha.Job = new {
Steps.checkoutWithoutMatchers(false)
...Steps.fetchPackages(null)
new {
run = "dotnet tool install ilspycmd -g --version 8.0.0.7345"
run = "dotnet tool install ilspycmd -g --version 9.0.0.7833-preview3"
}
new {
name = "Verify Namespaces"
Expand Down Expand Up @@ -66,4 +66,4 @@ function verifyNamespaces(): gha.Job = new {
shell = "pwsh"
}
}
}
}
10 changes: 5 additions & 5 deletions .github/pkl-workflows/helpers/Package.pkl
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"

Expand All @@ -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
Expand All @@ -36,15 +36,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 {
Expand Down
28 changes: 14 additions & 14 deletions .github/pkl-workflows/helpers/Steps.pkl
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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 ""
Expand Down Expand Up @@ -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 {
Expand Down
Loading
Loading