Skip to content

Commit

Permalink
Fix some workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed May 23, 2024
1 parent 8d2d447 commit 7daf5c2
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/pkl-workflows/GithubAction/GithubAction.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ abstract class JobBase {
outputs: Mapping<String, String>?
`timeout-minutes`: Int?
permissions: (*Permissions|"read-all"|"write-all")?
environment: String?
}

abstract class StepJobBase extends JobBase {
Expand Down
6 changes: 4 additions & 2 deletions .github/pkl-workflows/codeql.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ jobs {
queries:
- uses: security-and-quality
query-filters:
- exclude: cs/call-to-unmanaged-code
- exclude: cs/unmanaged-code
- exclude:
id: cs/call-to-unmanaged-code
- exclude:
id: cs/unmanaged-code
"""
}
}
Expand Down
3 changes: 3 additions & 0 deletions .github/pkl-workflows/helpers/Actions.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ const restoreCache = "actions/cache/restore@v4"
const cache = "actions/cache@v4"
const codeQLInit = "github/codeql-action/init@a57c67b89589d2d13d5ac85a9fc4679c7539f94c"
const codeQLAnalyze = "github/codeql-action/analyze@a57c67b89589d2d13d5ac85a9fc4679c7539f94c"
const findPR = "juliangruber/find-pull-request-action@48b6133aa6c826f267ebd33aa2d29470f9d9e7d0" // 1.9.0
const mergePR = "juliangruber/merge-pull-request-action@9234b8714dda9a08f3d1df5b2a6a3abd7b695353" // 1.3.1
const publishGithubRelease = "ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5" // 1.14.0
8 changes: 4 additions & 4 deletions .github/pkl-workflows/helpers/Package.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function nuget(shouldBuildDocsCondition: String): gha.Job = new gha.Job {
name = "Package NuGet"
`runs-on` = new gha.WindowsLatest{}
outputs {
[Steps.getVersionOutput] = "${{ steps.\(Steps.getVersionStepName).outputs.\(Steps.getVersionOutput) }}"
[Steps.getVersionOutput] = Steps.getVersionExpresssion
}
`timeout-minutes` = 30
steps {
Expand All @@ -26,16 +26,16 @@ function nuget(shouldBuildDocsCondition: String): gha.Job = new gha.Job {
setVersionSuffix
...Steps.fetchWrappers(null)
...Steps.msbuild(new Steps.MSBuildConfig {
projects = Common.nugetPackages.map((pkg) -> "Realm/\(pkg)").toListing()
projects = Common.packages.map((pkg) -> "Realm/\(pkg)").toListing()
target = "Pack"
properties {
["PackageOutputPath"] = "${{ github.workspace }}/Realm/packages"
["VersionSuffix"] = "${{ steps.\(setVersionSuffixStep).outputs.\(buildSuffixOutput) }}"
}
})
Steps.readVersionFromPackage()
for (pkgName in Common.nugetPackages) {
let (finalPkgName = "\(pkgName).${{ steps.\(Steps.getVersionStepName).outputs.\(Steps.getVersionOutput) }}")
for (pkgName in Common.packages) {
let (finalPkgName = "\(pkgName).\(Steps.getVersionExpresssion)")
Steps.uploadArtifacts(finalPkgName, "Realm/packages/\(finalPkgName).*nupkg")
}
Steps.uploadArtifacts("ExtractedChangelog", "Realm/Realm/ExtractedChangelog.md")
Expand Down
6 changes: 4 additions & 2 deletions .github/pkl-workflows/helpers/Steps.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "Actions.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 Listing {
checkoutWithoutMatchers(submodules)
registerProblemMatchers()
Expand Down Expand Up @@ -126,7 +128,7 @@ const function setupAndroid(): Listing<gha.Step> = new Listing<gha.Step> {
}
}

const function configureAWSCredentials(accessKey: String, secretKey: String, region: "us-east-1" | "us-west-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 @@ -148,7 +150,7 @@ const function readVersionFromPackage(): gha.Step = new {
}

const function uploadToNPM(tag: "latest" | "alpha"): Listing<gha.Step> = new Listing<gha.Step> {
local packageName = "io.realm.unity-${{ steps.\(getVersionStepName).outputs.\(getVersionOutput) }}.tgz"
local packageName = "io.realm.unity-\(getVersionExpresssion).tgz"

new gha.Step {
uses = Actions.setupNode
Expand Down
1 change: 1 addition & 0 deletions .github/pkl-workflows/helpers/Test.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ function unity(config: UnityTestConfig): Mapping<String, gha.Job> = new Mapping<
}
needs {
Common.job_Packages
Common.job_Unity
}
`timeout-minutes` = 30
`if` = Common.ifNotCanceledCondition
Expand Down
3 changes: 1 addition & 2 deletions .github/pkl-workflows/publish-prerelease.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ amends "GithubAction/GithubAction.pkl"

import "helpers/Common.pkl"
import "helpers/Steps.pkl"
import "helpers/Actions.pkl"

name = "Publish Prerelease"
on {
Expand All @@ -26,7 +25,7 @@ jobs {

Steps.configureAWSCredentials("NUGET_S3_ACCESS_KEY", "NUGET_S3_SECRET_KEY", "us-east-1")
for (package in Common.nugetPackages) {
let (packageWithVersion = "\(package).${{ steps.\(Steps.getVersionStepName).outputs.\(Steps.getVersionOutput) }}")
let (packageWithVersion = "\(package).\(Steps.getVersionExpresssion)")
new Step {
name = "NuGet Publish \(packageWithVersion)"
run = "sleet push ${{ github.workspace }}/Realm/packages/\(packageWithVersion)/\(packageWithVersion).nupkg --config ${{ github.workspace }}/.github/sleet.json --source NugetSource"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ jobs:
queries:
- uses: security-and-quality
query-filters:
- exclude: cs/call-to-unmanaged-code
- exclude: cs/unmanaged-code
- exclude:
id: cs/call-to-unmanaged-code
- exclude:
id: cs/unmanaged-code
- name: Setup JDK
uses: actions/setup-java@2e74cbce18569d23ca8b812590dbb83f13ac7c5a
with:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ jobs:
run: msbuild Realm/Realm -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.PlatformHelpers
run: msbuild Realm/Realm.PlatformHelpers -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityUtils
run: msbuild Realm/Realm.UnityUtils -t:Pack -restore -p:Configuration=Release -p:PackageOutputPath=${{ github.workspace }}/Realm/packages -p:VersionSuffix=${{ steps.set-version-suffix.outputs.build_suffix }}
- name: Build Realm/Realm.UnityWeaver
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
run: |-
Expand All @@ -231,6 +235,20 @@ jobs:
path: Realm/packages/Realm.PlatformHelpers.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityUtils.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
uses: actions/upload-artifact@v4
with:
name: Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}
path: Realm/packages/Realm.UnityWeaver.${{ steps.get-version.outputs.package_version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for ExtractedChangelog
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -314,6 +332,7 @@ jobs:
name: Build Unity linux
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
Expand Down Expand Up @@ -392,6 +411,7 @@ jobs:
name: Build Unity windows
needs:
- build-packages
- build-unity
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
timeout-minutes: 30
runs-on:
Expand Down

0 comments on commit 7daf5c2

Please sign in to comment.