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

Allow GitHubRunner as a project setting #1177

Merged
merged 14 commits into from
Sep 9, 2024
5 changes: 5 additions & 0 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion Actions/AL-Go-TestRepoHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function Test-SettingsJson {
}
if ($type -eq 'Project') {
# GitHubRunner should not be in a project settings file (only read from repo or workflow settings)
aholstrup1 marked this conversation as resolved.
Show resolved Hide resolved
Test-Property -settingsDescription $settingsDescription -json $json -key 'githubRunner' -shouldnot
Test-Property -settingsDescription $settingsDescription -json $json -key 'bcContainerHelperVersion' -shouldnot
}
if ($type -eq 'Workflow') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -168,6 +170,8 @@ function CreateBuildDimensions {
project = $project
projectName = $projectSettings.projectName
buildMode = $buildMode
gitHubRunner = $gitHubRunner
githubRunnerShell = $githubRunnerShell
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Templates/AppSource App/.github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 2 additions & 4 deletions Templates/AppSource App/.github/workflows/Current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
6 changes: 2 additions & 4 deletions Templates/AppSource App/.github/workflows/NextMajor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
6 changes: 2 additions & 4 deletions Templates/AppSource App/.github/workflows/NextMinor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions Templates/Per Tenant Extension/.github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
Loading