Allow GitHubRunner as a project setting (#1177)

Allow GitHubRunner as a project setting. This would enable us to compile
apps on linux-based GitHub runners while running the tests on either
windows GitHub runners or self-hosted runners.
This commit is contained in:
Alexander Holstrup 2024-09-09 12:10:48 +02:00 коммит произвёл GitHub
Родитель 564c339085
Коммит a2a51be438
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
16 изменённых файлов: 36 добавлений и 40 удалений

Просмотреть файл

@ -768,6 +768,11 @@ function ReadSettings {
if ($settings.shell -ne "powershell" -and $settings.shell -ne "pwsh") {
throw "Invalid value for setting: shell: $($settings.githubRunnerShell)"
}
if (($settings.githubRunner -like "ubuntu-*") -and ($settings.githubRunnerShell -eq "powershell")) {
Write-Host "Switching shell to pwsh for ubuntu"
$settings.githubRunnerShell = "pwsh"
}
if($settings.projectName -eq '') {
$settings.projectName = $project # Default to project path as project name
}

Просмотреть файл

@ -65,8 +65,7 @@ function Test-SettingsJson {
Test-Property -settingsDescription $settingsDescription -json $json -key 'templateUrl' -should
}
if ($type -eq 'Project') {
# GitHubRunner should not be in a project settings file (only read from repo or workflow settings)
Test-Property -settingsDescription $settingsDescription -json $json -key 'githubRunner' -shouldnot
# Test for things that should / should not exist in a project settings file
Test-Property -settingsDescription $settingsDescription -json $json -key 'bcContainerHelperVersion' -shouldnot
}
if ($type -eq 'Workflow') {

Просмотреть файл

@ -156,6 +156,8 @@ function CreateBuildDimensions {
foreach($project in $projects) {
$projectSettings = ReadSettings -project $project -baseFolder $baseFolder
$gitHubRunner = $projectSettings.githubRunner.Split(',').Trim() | ConvertTo-Json -compress
$githubRunnerShell = $projectSettings.githubRunnerShell
$buildModes = @($projectSettings.buildModes)
if(!$buildModes) {
@ -168,6 +170,8 @@ function CreateBuildDimensions {
project = $project
projectName = $projectSettings.projectName
buildMode = $buildMode
gitHubRunner = $gitHubRunner
githubRunnerShell = $githubRunnerShell
}
}
}

Просмотреть файл

@ -2,6 +2,10 @@
- Issue 1184 Publish to Environment fails on 'Permission Denied'
### Allow GitHubRunner and GitHubRunnerShell as project settings
Previously, AL-Go required the GitHubRunner and GitHubRunnerShell settings to be set on repository level. This has now been changed such that they can be set on project level.
## v5.3
### Issues

Просмотреть файл

@ -152,8 +152,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -35,8 +35,6 @@ jobs:
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -90,8 +88,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}

Просмотреть файл

@ -152,7 +152,7 @@ jobs:
id: sign
uses: microsoft/AL-Go-Actions/Sign@main
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
shell: ${{ inputs.shell }}
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'

Просмотреть файл

@ -152,8 +152,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -22,8 +22,6 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -75,8 +73,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}

Просмотреть файл

@ -35,8 +35,6 @@ jobs:
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@ -90,8 +88,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}

Просмотреть файл

@ -152,7 +152,7 @@ jobs:
id: sign
uses: microsoft/AL-Go-Actions/Sign@main
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
shell: ${{ inputs.shell }}
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'