Skip to content

Commit a2a51be

Browse files
authored
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.
1 parent 564c339 commit a2a51be

16 files changed

+36
-40
lines changed

Actions/AL-Go-Helper.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,11 @@ function ReadSettings {
768768
if ($settings.shell -ne "powershell" -and $settings.shell -ne "pwsh") {
769769
throw "Invalid value for setting: shell: $($settings.githubRunnerShell)"
770770
}
771+
if (($settings.githubRunner -like "ubuntu-*") -and ($settings.githubRunnerShell -eq "powershell")) {
772+
Write-Host "Switching shell to pwsh for ubuntu"
773+
$settings.githubRunnerShell = "pwsh"
774+
}
775+
771776
if($settings.projectName -eq '') {
772777
$settings.projectName = $project # Default to project path as project name
773778
}

Actions/AL-Go-TestRepoHelper.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ function Test-SettingsJson {
6565
Test-Property -settingsDescription $settingsDescription -json $json -key 'templateUrl' -should
6666
}
6767
if ($type -eq 'Project') {
68-
# GitHubRunner should not be in a project settings file (only read from repo or workflow settings)
69-
Test-Property -settingsDescription $settingsDescription -json $json -key 'githubRunner' -shouldnot
68+
# Test for things that should / should not exist in a project settings file
7069
Test-Property -settingsDescription $settingsDescription -json $json -key 'bcContainerHelperVersion' -shouldnot
7170
}
7271
if ($type -eq 'Workflow') {

Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.psm1

+4
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ function CreateBuildDimensions {
156156

157157
foreach($project in $projects) {
158158
$projectSettings = ReadSettings -project $project -baseFolder $baseFolder
159+
$gitHubRunner = $projectSettings.githubRunner.Split(',').Trim() | ConvertTo-Json -compress
160+
$githubRunnerShell = $projectSettings.githubRunnerShell
159161
$buildModes = @($projectSettings.buildModes)
160162

161163
if(!$buildModes) {
@@ -168,6 +170,8 @@ function CreateBuildDimensions {
168170
project = $project
169171
projectName = $projectSettings.projectName
170172
buildMode = $buildMode
173+
gitHubRunner = $gitHubRunner
174+
githubRunnerShell = $githubRunnerShell
171175
}
172176
}
173177
}

RELEASENOTES.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
- Issue 1184 Publish to Environment fails on 'Permission Denied'
44

5+
### Allow GitHubRunner and GitHubRunnerShell as project settings
6+
7+
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.
8+
59
## v5.3
610

711
### Issues

Templates/AppSource App/.github/workflows/CICD.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ jobs:
152152
uses: ./.github/workflows/_BuildALGoProject.yaml
153153
secrets: inherit
154154
with:
155-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
156-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
155+
shell: ${{ matrix.githubRunnerShell }}
156+
runsOn: ${{ matrix.githubRunner }}
157157
project: ${{ matrix.project }}
158158
projectName: ${{ matrix.projectName }}
159159
buildMode: ${{ matrix.buildMode }}

Templates/AppSource App/.github/workflows/Current.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/AppSource App/.github/workflows/NextMajor.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/AppSource App/.github/workflows/NextMinor.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/AppSource App/.github/workflows/PullRequestHandler.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
if: (!failure() && !cancelled())
3636
runs-on: [ windows-latest ]
3737
outputs:
38-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
39-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
4038
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
4139
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
4240
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -90,8 +88,8 @@ jobs:
9088
uses: ./.github/workflows/_BuildALGoProject.yaml
9189
secrets: inherit
9290
with:
93-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
94-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
91+
shell: ${{ matrix.githubRunnerShell }}
92+
runsOn: ${{ matrix.githubRunner }}
9593
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
9694
project: ${{ matrix.project }}
9795
projectName: ${{ matrix.projectName }}

Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
id: sign
153153
uses: microsoft/AL-Go-Actions/Sign@main
154154
with:
155-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
155+
shell: ${{ inputs.shell }}
156156
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
157157
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
158158

Templates/Per Tenant Extension/.github/workflows/CICD.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ jobs:
152152
uses: ./.github/workflows/_BuildALGoProject.yaml
153153
secrets: inherit
154154
with:
155-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
156-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
155+
shell: ${{ matrix.githubRunnerShell }}
156+
runsOn: ${{ matrix.githubRunner }}
157157
project: ${{ matrix.project }}
158158
projectName: ${{ matrix.projectName }}
159159
buildMode: ${{ matrix.buildMode }}

Templates/Per Tenant Extension/.github/workflows/Current.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
needs: [ ]
2323
runs-on: [ windows-latest ]
2424
outputs:
25-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
26-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
2725
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
2826
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
2927
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -75,8 +73,8 @@ jobs:
7573
uses: ./.github/workflows/_BuildALGoProject.yaml
7674
secrets: inherit
7775
with:
78-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
79-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
76+
shell: ${{ matrix.githubRunnerShell }}
77+
runsOn: ${{ matrix.githubRunner }}
8078
project: ${{ matrix.project }}
8179
projectName: ${{ matrix.projectName }}
8280
buildMode: ${{ matrix.buildMode }}

Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
if: (!failure() && !cancelled())
3636
runs-on: [ windows-latest ]
3737
outputs:
38-
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
39-
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
4038
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
4139
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
4240
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
@@ -90,8 +88,8 @@ jobs:
9088
uses: ./.github/workflows/_BuildALGoProject.yaml
9189
secrets: inherit
9290
with:
93-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
94-
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
91+
shell: ${{ matrix.githubRunnerShell }}
92+
runsOn: ${{ matrix.githubRunner }}
9593
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
9694
project: ${{ matrix.project }}
9795
projectName: ${{ matrix.projectName }}

Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
id: sign
153153
uses: microsoft/AL-Go-Actions/Sign@main
154154
with:
155-
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
155+
shell: ${{ inputs.shell }}
156156
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
157157
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
158158

0 commit comments

Comments
 (0)