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

Incremental Builds #1304

Draft
wants to merge 217 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 196 commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
cd0d861
write json
freddydk Nov 9, 2024
5277c11
use sha
freddydk Nov 10, 2024
b008537
syntax
freddydk Nov 10, 2024
d1f9900
use pr sha
freddydk Nov 10, 2024
aaeaa3d
dumps
freddydk Nov 10, 2024
794d1a9
use baseline
freddydk Nov 10, 2024
49b0710
pull
freddydk Nov 10, 2024
a047541
pull
freddydk Nov 10, 2024
2d1bc93
remove empty
freddydk Nov 10, 2024
4e9fe58
add sha
freddydk Nov 10, 2024
e8421a2
branch
freddydk Nov 10, 2024
973b91e
dump
freddydk Nov 10, 2024
6f5275e
dump
freddydk Nov 10, 2024
6455d85
dumps
freddydk Nov 10, 2024
8eb6807
fetch
freddydk Nov 10, 2024
d85db5d
fetch unshallow
freddydk Nov 10, 2024
d9288d0
fetch origin
freddydk Nov 10, 2024
1fc4c54
fetch
freddydk Nov 10, 2024
1cf1db3
add baseline
freddydk Nov 10, 2024
fd92f2b
headp
freddydk Nov 10, 2024
91ad0d5
dispatch
freddydk Nov 10, 2024
2af02e1
branch
freddydk Nov 10, 2024
faf913f
add
freddydk Nov 10, 2024
382fba1
sha
freddydk Nov 10, 2024
bc29279
eq
freddydk Nov 10, 2024
ce1abbb
transfer skipped
freddydk Nov 11, 2024
dc3ebc4
remove syntax err
freddydk Nov 11, 2024
c8f4593
include skipped
freddydk Nov 11, 2024
53e2e78
dump
freddydk Nov 11, 2024
d82a4e4
buildIt
freddydk Nov 11, 2024
0a7ad8f
use action
freddydk Nov 11, 2024
2eef1ce
add env
freddydk Nov 11, 2024
9a17928
)
freddydk Nov 11, 2024
ce85f89
read sett
freddydk Nov 11, 2024
6d5c2ee
rename
freddydk Nov 11, 2024
e9279be
recall getprojects
freddydk Nov 11, 2024
a007fa1
err
freddydk Nov 11, 2024
8833217
add token
freddydk Nov 11, 2024
78c2047
download artifacts
freddydk Nov 11, 2024
5781265
correct folder
freddydk Nov 11, 2024
987c7a7
download and unpack
freddydk Nov 11, 2024
24dc50d
try exists
freddydk Nov 11, 2024
3e7f0d5
use hash
freddydk Nov 11, 2024
c300bbf
add concurrency
freddydk Nov 11, 2024
7e85650
use format
freddydk Nov 11, 2024
3fbef9d
check for artifacts
freddydk Nov 11, 2024
2f5970a
conditional analyze
freddydk Nov 11, 2024
1591d40
set token
freddydk Nov 11, 2024
5a83ef8
ps 5 trick
freddydk Nov 11, 2024
38ef283
check errlevel
freddydk Nov 11, 2024
2775342
use pwsh
freddydk Nov 11, 2024
293d4b7
use ghtoken
freddydk Nov 11, 2024
232ff01
ignore
freddydk Nov 11, 2024
32120fc
use try
freddydk Nov 11, 2024
c5b3dcd
get modified
freddydk Nov 11, 2024
173aaef
arr
freddydk Nov 11, 2024
b5af39a
)
freddydk Nov 11, 2024
34b94b4
find folders
freddydk Nov 12, 2024
8f4dab5
use full path
freddydk Nov 12, 2024
1451f4b
dump
freddydk Nov 12, 2024
9cd8e28
dont join
freddydk Nov 12, 2024
c3d0daf
syntax
freddydk Nov 12, 2024
2694ea5
syntax
freddydk Nov 12, 2024
a294a9e
remove ./
freddydk Nov 12, 2024
cff8a34
test
freddydk Nov 12, 2024
702e818
add runid
freddydk Nov 12, 2024
742c41b
rename
freddydk Nov 12, 2024
ddc3d07
ignore cancelled
freddydk Nov 12, 2024
2e304a5
use projectname
freddydk Nov 12, 2024
aa316d5
use repo name
freddydk Nov 12, 2024
e74238c
use repo
freddydk Nov 12, 2024
90a1255
dump
freddydk Nov 12, 2024
64290ca
create tempfolder
freddydk Nov 12, 2024
c217a7e
download
freddydk Nov 12, 2024
3ef3aae
do not set
freddydk Nov 12, 2024
768d052
s
freddydk Nov 12, 2024
9840475
err
freddydk Nov 12, 2024
9309ae2
use this
freddydk Nov 12, 2024
507ea1e
include project
freddydk Nov 12, 2024
c07156c
buildall
freddydk Nov 12, 2024
a1b2ee4
call
freddydk Nov 12, 2024
95f92d5
parm
freddydk Nov 12, 2024
76880c2
+
freddydk Nov 12, 2024
e6969a6
Merge branch 'main' into partial
freddydk Nov 12, 2024
b104f8f
remove download all
freddydk Nov 13, 2024
e8e9031
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Nov 13, 2024
cc4f7f5
avoid warning
freddydk Nov 13, 2024
5a62b54
fix precommit
freddydk Nov 13, 2024
604c1fe
only download thisbuild
freddydk Nov 13, 2024
ff99ecd
b
freddydk Nov 13, 2024
b7360be
no double downloads
freddydk Nov 13, 2024
e80fe8d
dump
freddydk Nov 13, 2024
2640c11
remove ()
freddydk Nov 13, 2024
23baf93
add dumps
freddydk Nov 13, 2024
145df8e
fix
freddydk Nov 13, 2024
47c558c
remove dumps
freddydk Nov 13, 2024
a5e9fc9
remove dump
freddydk Nov 13, 2024
cc0bad9
do not issue warnings if donotbuild is set
freddydk Nov 13, 2024
422315a
resolve path
freddydk Nov 13, 2024
4f90bfd
use relative
freddydk Nov 13, 2024
391b53e
use filesystem
freddydk Nov 13, 2024
f138883
use dirsep
freddydk Nov 13, 2024
08171ea
output
freddydk Nov 13, 2024
b4b0f86
-(
freddydk Nov 13, 2024
b58819e
Merge branch 'main' into partial
freddydk Nov 13, 2024
9ad517a
MOVE
freddydk Nov 13, 2024
07286b7
check all folders
freddydk Nov 13, 2024
674e4e3
dump
freddydk Nov 13, 2024
8bdae86
save time
freddydk Nov 13, 2024
ff59a9b
settings
freddydk Nov 13, 2024
2b641ba
always all
freddydk Nov 13, 2024
3d4e8b2
remove dump
freddydk Nov 13, 2024
eb1c5c8
use special
freddydk Nov 13, 2024
0c7e42b
buildmode
freddydk Nov 14, 2024
d84bfa7
rename to incrementalBuilds
freddydk Nov 14, 2024
f19cdc7
set modifiedfiles
freddydk Nov 15, 2024
ef088b0
exit0
freddydk Nov 15, 2024
d1236b5
setshouldexit
freddydk Nov 15, 2024
596edd8
head
freddydk Nov 15, 2024
263235a
using pr head
freddydk Nov 15, 2024
631624c
use artifacts cache
freddydk Nov 15, 2024
db3a07d
move
freddydk Nov 15, 2024
fa8e388
check duplicate
freddydk Nov 16, 2024
f6aa3cc
allowprerel
freddydk Nov 16, 2024
057e5be
()
freddydk Nov 16, 2024
86c28cc
exact
freddydk Nov 16, 2024
748a501
version
freddydk Nov 16, 2024
5c49073
find - not download
freddydk Nov 16, 2024
2692a96
use appjson.version
freddydk Nov 16, 2024
8f261c2
Merge branch 'main' into partial
freddydk Nov 22, 2024
abf4f59
space
freddydk Nov 22, 2024
0613613
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Nov 22, 2024
1d668d8
review
freddydk Nov 22, 2024
c565875
remove buildPP from appsource template
freddydk Nov 22, 2024
07cd036
precommit
freddydk Nov 22, 2024
eb7d483
Merge branch 'main' into partial
freddydk Nov 22, 2024
f52120c
Merge branch 'main' into partial
freddydk Nov 28, 2024
8bec033
no incremental
freddydk Dec 9, 2024
0642e8b
spell
freddydk Dec 10, 2024
4e8572f
Merge branch 'main' into partial
freddydk Dec 10, 2024
a371a9b
change parameter name
freddydk Dec 10, 2024
0d2ae93
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Dec 10, 2024
72ccf70
enable
freddydk Dec 12, 2024
83cb87c
fix tests
freddydk Dec 12, 2024
a4b46f6
remove dumps
freddydk Dec 12, 2024
e3e59f7
precommit
freddydk Dec 12, 2024
3d883ee
use preview
freddydk Dec 12, 2024
8e09a7a
ped
freddydk Dec 13, 2024
2aa69e7
add unknown
freddydk Dec 13, 2024
4b50bd8
add knownApps
freddydk Dec 13, 2024
aae75b7
arr
freddydk Dec 13, 2024
7e1178e
add project
freddydk Dec 13, 2024
faf8f90
all folders
freddydk Dec 14, 2024
1f2a607
add project
freddydk Dec 14, 2024
665e84f
dump
freddydk Dec 14, 2024
f9303e3
sub 2
freddydk Dec 14, 2024
39547d9
add end 2 end test
freddydk Dec 15, 2024
60f0b2f
review
freddydk Dec 15, 2024
0f934ff
-bash
freddydk Dec 15, 2024
61a6a77
-linux
freddydk Dec 15, 2024
23bb87f
release notes and settings
freddydk Dec 15, 2024
020dfa5
Merge branch 'main' into partial
freddydk Dec 15, 2024
796ccdb
remove mode
freddydk Dec 16, 2024
dfb42b8
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Dec 16, 2024
0b68f06
add cancelinprogress setting
freddydk Dec 16, 2024
ab06358
bool
freddydk Dec 16, 2024
c334581
replace
freddydk Dec 16, 2024
4516ae9
concurrency setting
freddydk Dec 16, 2024
8e578b5
move
freddydk Dec 16, 2024
c6be36e
default allowed
freddydk Dec 16, 2024
dd1dee0
update docs
freddydk Dec 16, 2024
53c2414
fix e2e test
freddydk Dec 16, 2024
ca1b3b7
precommit
freddydk Dec 16, 2024
e6f2eea
doc
freddydk Dec 16, 2024
619c5b4
Merge branch 'main' into partial
freddydk Dec 16, 2024
6dc589b
Merge branch 'main' into partial
freddydk Dec 18, 2024
be1253c
move
freddydk Dec 18, 2024
17e571a
move2
freddydk Dec 18, 2024
9596353
Merge branch 'main' into partial
freddydk Dec 18, 2024
6ce0007
Merge branch 'main' into partial
freddydk Dec 18, 2024
5b0c838
Merge branch 'main' into partial
freddydk Dec 30, 2024
932ab42
Merge branch 'main' into partial
freddydk Dec 30, 2024
466f671
Merge branch 'main' into partial
freddydk Jan 9, 2025
8a8bc7c
Merge branch 'main' into partial
freddydk Jan 10, 2025
360d6db
fix
freddydk Jan 10, 2025
3f61918
Merge branch 'partial' of https://github.com/freddydk/AL-Go into partial
freddydk Jan 10, 2025
274aacd
Update e2eTests/scenarios/IncrementalBuilds/runtest.ps1
freddydk Jan 10, 2025
b84b4d1
Update Actions/DetermineProjectsToBuild/action.yaml
freddydk Jan 10, 2025
ca7cdbe
review
freddydk Jan 10, 2025
99745be
incremental
freddydk Jan 10, 2025
cfd9e87
doc
freddydk Jan 10, 2025
6252d0d
remove concurrency
freddydk Jan 10, 2025
f053d67
lines
freddydk Jan 10, 2025
fbcd0e2
space
freddydk Jan 10, 2025
8d88d67
Merge branch 'main' into partial
freddydk Jan 14, 2025
1fa094c
Merge branch 'main' into partial
freddydk Jan 14, 2025
7c1a37e
Merge branch 'main' into partial
freddydk Jan 16, 2025
fdbef48
Merge branch 'main' into partial
freddydk Jan 16, 2025
332e2cc
review
freddydk Jan 16, 2025
a068ef1
new modification of yaml
freddydk Jan 18, 2025
46a1fae
loop
freddydk Jan 19, 2025
43b0770
prop
freddydk Jan 19, 2025
0b73f18
dump
freddydk Jan 19, 2025
0a2a2f1
buildmode ''
freddydk Jan 19, 2025
6d26d7e
add branchsha
freddydk Jan 19, 2025
469bd0c
7
freddydk Jan 19, 2025
50fa2d2
add deprecation
freddydk Jan 19, 2025
79543b8
add deorecations to troubleshooting
freddydk Jan 20, 2025
890dbf3
add deprecation tests
freddydk Jan 20, 2025
1910274
add err
freddydk Jan 20, 2025
fb7002a
test
freddydk Jan 21, 2025
90a752b
fix
freddydk Jan 21, 2025
aa3fdde
use preview
freddydk Jan 21, 2025
8f431aa
Merge branch 'main' into partial
freddydk Jan 25, 2025
3bd5805
rename parameter
freddydk Jan 25, 2025
f259633
full build on schedule
freddydk Jan 27, 2025
61ee3f1
thisbuild artifacts no longer exists
freddydk Jan 27, 2025
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/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ updates:
directories:
- ".github/workflows/"
- "/Templates/**/.github/workflows/"
- "/Actions/**/"
groups:
External-Dependencies:
applies-to: version-updates
Expand Down
75 changes: 61 additions & 14 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ function Copy-HashTable() {
}
}

# Convert SecureString to plain text
function Get-PlainText {
freddydk marked this conversation as resolved.
Show resolved Hide resolved
Param(
[parameter(ValueFromPipeline, Mandatory = $true)]
[System.Security.SecureString] $SecureString
)
Process {
$bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString);
try {
return [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr);
}
finally {
[Runtime.InteropServices.Marshal]::FreeBSTR($bstr);
}
}
}

function IsPropertySecret {
param (
[string] $propertyName
Expand Down Expand Up @@ -406,7 +423,7 @@ function DownloadAndImportBcContainerHelper([string] $baseFolder = $ENV:GITHUB_W
# Read Repository Settings file (without applying organization variables, repository variables or project settings files)
# Override default BcContainerHelper version from AL-Go-Helper only if new version is specifically specified in repo settings file
$repoSettings = Get-Content $repoSettingsPath -Encoding UTF8 | ConvertFrom-Json | ConvertTo-HashTable
if ($repoSettings.Keys -contains "BcContainerHelperVersion") {
if ($repoSettings.Keys -contains "BcContainerHelperVersion" -and $defaultBcContainerHelperVersion -notlike 'https://*') {
$bcContainerHelperVersion = $repoSettings.BcContainerHelperVersion
Write-Host "Using BcContainerHelper $bcContainerHelperVersion version"
if ($bcContainerHelperVersion -like "https://*") {
Expand Down Expand Up @@ -647,6 +664,13 @@ function ReadSettings {
"cacheImageName" = "my"
"cacheKeepDays" = 3
"alwaysBuildAllProjects" = $false
"incrementalBuilds" = [ordered]@{
"enable" = $false
"retentionDays" = 30
"mode" = "modifiedApps" # modifiedProjects, modifiedApps
freddydk marked this conversation as resolved.
Show resolved Hide resolved
}
"cicdConcurrency" = "Allowed"
"createReleaseConcurrency" = "Wait"
"microsoftTelemetryConnectionString" = "InstrumentationKey=cd2cc63e-0f37-4968-b99a-532411a314b8;IngestionEndpoint=https://northeurope-2.in.applicationinsights.azure.com/"
"partnerTelemetryConnectionString" = ""
"sendExtendedTelemetryToMicrosoft" = $false
Expand Down Expand Up @@ -926,11 +950,6 @@ function AnalyzeRepo {
)

$settings = $settings | Copy-HashTable

if (!$runningLocal) {
Write-Host "::group::Analyzing repository"
}

$projectPath = Join-Path $baseFolder $project -Resolve

# Check applicationDependency
Expand Down Expand Up @@ -1124,17 +1143,12 @@ function AnalyzeRepo {
if ($performanceToolkitApps.Contains($dep.id)) { $settings.installPerformanceToolkit = $true }
}
}

if (!$runningLocal) {
Write-Host "::endgroup::"
}

if (!$settings.doNotRunBcptTests -and -not $settings.bcptTestFolders) {
Write-Host "No performance test apps found in bcptTestFolders in $ALGoSettingsFile"
if (!$settings.doNotBuildTests) { Write-Host "No performance test apps found in bcptTestFolders in $ALGoSettingsFile" }
$settings.doNotRunBcptTests = $true
}
if (!$settings.doNotRunTests -and -not $settings.testFolders) {
if (!$doNotIssueWarnings) { OutputWarning -message "No test apps found in testFolders in $ALGoSettingsFile" }
if (!$doNotIssueWarnings -and !$settings.doNotBuildTests) { OutputWarning -message "No test apps found in testFolders in $ALGoSettingsFile" }
freddydk marked this conversation as resolved.
Show resolved Hide resolved
$settings.doNotRunTests = $true
}
if (-not $settings.appFolders) {
Expand Down Expand Up @@ -2118,7 +2132,7 @@ Function AnalyzeProjectDependencies {
Pop-Location
}

Write-Host "Folders containing apps are $($folders -join ',' )"
OutputMessageAndArray -Message "Folders containing apps" -arrayOfStrings $folders

$unknownDependencies = @()
$apps = @()
Expand Down Expand Up @@ -2369,6 +2383,7 @@ function RetryCommand {
try {
Invoke-Command $Command -ArgumentList $argumentList
if ($LASTEXITCODE -ne 0) {
$host.SetShouldExit(0);
throw "Command failed with exit code $LASTEXITCODE"
}
break
Expand Down Expand Up @@ -2424,6 +2439,22 @@ function GetProjectsFromRepository {
return @(GetMatchingProjects -projects $projects -selectProjects $selectProjects)
}

function GetFoldersFromAllProjects {
Param(
[string] $baseFolder
)

$settings = ReadSettings -baseFolder $baseFolder
$projects = GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects
$folders = @()
foreach($project in $projects) {
$projectSettings = ReadSettings -project $project -baseFolder $baseFolder
ResolveProjectFolders -baseFolder $baseFolder -project $project -projectSettings ([ref] $projectSettings)
$folders += @( @($projectSettings.appFolders) + @($projectSettings.testFolders) + @($projectSettings.bcptTestFolders) | ForEach-Object { Join-Path $project "$_".Substring(2) } )
}
return $folders
}

function GetPackageVersion($packageName) {
$alGoPackages = Get-Content -Path "$PSScriptRoot\Packages.json" | ConvertFrom-Json

Expand Down Expand Up @@ -2507,3 +2538,19 @@ function ConnectAz {
throw "Error trying to authenticate to Azure. Error was $($_.Exception.Message)"
}
}

function OutputMessageAndArray {
Param(
[string] $message,
[string[]] $arrayOfStrings
)
Write-Host "$($message):"
if (!$arrayOfStrings) {
Write-Host "- None"
}
else {
$arrayOfStrings | ForEach-Object {
Write-Host "- $_"
}
}
}
33 changes: 33 additions & 0 deletions Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function GetWorkflowContentWithChangesFromSettings {
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($srcFile)
$yaml = [Yaml]::Load($srcFile)
$workflowScheduleKey = "$($baseName)Schedule"
$workflowConcurrencyKey = "$($baseName)Concurrency"

# Any workflow (except for the PullRequestHandler and reusable workflows (_*)) can have a RepoSetting called <workflowname>Schedule, which will be used to set the schedule for the workflow
if ($baseName -ne "PullRequestHandler" -and $baseName -notlike '_*') {
Expand All @@ -302,6 +303,38 @@ function GetWorkflowContentWithChangesFromSettings {
$yamlOn = $yaml.Get('on:/')
$yaml.Replace('on:/', $yamlOn.content+@('schedule:', " - cron: '$($repoSettings."$workflowScheduleKey")'"))
}
$concurrency = 'allowed'
if ($repoSettings.Keys -contains $workflowConcurrencyKey) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall quite well if there was an agreement about these settings that are dynamically determined.
But my opinion is that we should try to avoid them, as we cannot include them in a JSON schema, for example.

Why not have a workflowConcurrency setting that could be set either on workflow-level or maybe as a conditional setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will consider how to change this with the other workflow base-name settings in mind

$concurrency = $repoSettings."$workflowConcurrencyKey"
}
$start = 0
$count = 0
if ($yaml.Find('concurrency:/', [ref] $start, [ref] $count)) {
Write-Host "$start $count"
freddydk marked this conversation as resolved.
Show resolved Hide resolved
$yaml.Remove($start-1, $count+1)
}
if ($concurrency -ne 'allowed') {
if ($start -eq 0) {
if (-not $yaml.Find('on:', [ref] $start, [ref] $count)) { throw "Internal error, cannot find the on: key in the workflow" }
}
switch ($concurrency) {
'WaitRef' {
$yaml.Insert($start-1, @("concurrency:", " group: `${{ github.workflow }}-`${{ github.ref }}"))
}
'Wait' {
$yaml.Insert($start-1, @("concurrency:", " group: `${{ github.workflow }}"))
}
'CancelRef' {
$yaml.Insert($start-1, @("concurrency:", " group: `${{ github.workflow }}-`${{ github.ref }}", " cancel-in-progress: true"))
}
'Cancel' {
$yaml.Insert($start-1, @("concurrency:", " group: `${{ github.workflow }}", " cancel-in-progress: true"))
}
defult: {
throw "Unknown concurrency setting: $concurrency"
}
}
}
}

if ($baseName -eq "CICD") {
Expand Down
17 changes: 11 additions & 6 deletions Actions/Deliver/Deliver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,18 @@ foreach ($thisProject in $projectList) {
}
elseif ($folder.Count -eq 1) {
Get-Item -Path (Join-Path $folder[0] "*.app") | ForEach-Object {
$parameters = @{
"gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
"preReleaseTag" = $preReleaseTag
"appFile" = $_.FullName
$appJson = Get-AppJsonFromAppFile -appFile $_.FullName
$packageName = Get-BcNuGetPackageId -publisher $appJson.publisher -name $appJson.name -id $appJson.id -version $appJson.version
$feed, $packageId, $packageVersion = Find-BcNugetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $packageName -version $appJson.version -select Exact -allowPrerelease
if (-not $feed) {
$parameters = @{
"gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
"preReleaseTag" = $preReleaseTag
"appFile" = $_.FullName
}
$package = New-BcNuGetPackage @parameters
Push-BcNuGetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -bcNuGetPackage $package
}
$package = New-BcNuGetPackage @parameters
Push-BcNuGetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -bcNuGetPackage $package
}
}
}
Expand Down
51 changes: 51 additions & 0 deletions Actions/DetermineBuildProject/DetermineBuildProject.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Param(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add tests for the new action?

[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
[Parameter(HelpMessage = "Compressed JSON string containing the list of projects that should be skipped", Mandatory = $true)]
[string] $skippedProjectsJson,
[Parameter(HelpMessage = "Name of the project to build", Mandatory = $true)]
[string] $project,
[Parameter(HelpMessage = "Id of the baseline workflow run, from which to download artifacts if build is skipped", Mandatory = $false)]
[string] $baselineWorkflowRunId
)

. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)

$settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable -recurse
$baseFolder = $ENV:GITHUB_WORKSPACE
$projectPath = Join-Path $baseFolder $project
$buildArtifactFolder = Join-Path $projectPath ".buildartifacts"
$skippedProjects = $skippedProjectsJson | ConvertFrom-Json
$buildIt = $skippedProjects -notcontains $project
if (!$buildIt) {
# Download the artifacts from the baseline workflow run
# Set buildIt to true if the download isn't successful
New-Item $buildArtifactFolder -ItemType Directory | Out-Null
$buildIt = $true
foreach($mask in @('Apps','TestApps','Dependencies','PowerPlatformSolution')) {
Write-Host "test $mask"
freddydk marked this conversation as resolved.
Show resolved Hide resolved
Write-Host "GetArtifactsFromWorkflowRun -workflowRun '$baselineWorkflowRunId' -token '$token' -api_url $env:GITHUB_API_URL -repository $env:GITHUB_REPOSITORY -mask '$mask' -projects '$project'"
$artifact = GetArtifactsFromWorkflowRun -workflowRun $baselineWorkflowRunId -token $token -api_url $env:GITHUB_API_URL -repository $env:GITHUB_REPOSITORY -mask $mask -projects $project
if ($artifact) {
Write-Host "Artifact found for mask $mask"
if ($artifact -is [Array]) {
throw "Multiple artifacts found with mask $mask for project $project"
}
$file = DownloadArtifact -path $buildArtifactFolder -token $token -artifact $artifact
if ($file) {
Write-Host "Artifact downloaded for mask $mask"
$thisArtifactFolder = Join-Path $buildArtifactFolder $mask
Expand-Archive -Path $file -DestinationPath $thisArtifactFolder -Force
Remove-Item -Path $file -Force
$buildIt = $false
Fixed Show fixed Hide fixed
}
}
}
if ($buildIt) {
# No downloads succeeded - remove the build artifact folder and build the project
Remove-Item -Path $buildArtifactFolder -Recurse -Force
}
}

Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildIt=$buildIt"
Write-Host "BuildIt=$buildIt"
33 changes: 33 additions & 0 deletions Actions/DetermineBuildProject/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Determine whether to build project

Determine whether to build project

## INPUT

### ENV variables

| Name | Description |
| :-- | :-- |
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| token | | The GitHub token running the action | github.token |
| skippedProjectsJson | Yes | Compressed JSON string containing the list of projects that should be skipped | |
| project | Yes | Name of the project to build | |
| baselineWorkflowRunId | Yes | Id of the baseline workflow run, from which to download artifacts if build is skipped | |

## OUTPUT

### ENV variables

none

### OUTPUT variables

| Name | Description |
| :-- | :-- |
| BuildIt | True if the project should be built |
42 changes: 42 additions & 0 deletions Actions/DetermineBuildProject/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Determine whether to Build Project
author: Microsoft Corporation
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
token:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
skippedProjectsJson:
description: Compressed JSON string containing the list of projects that should be skipped
required: true
project:
description: Name of the project to build
required: true
baselineWorkflowRunId:
description: Id of the baseline workflow run, from which to download artifacts if build is skipped
required: true
outputs:
BuildIt:
description: Determines whether the project needs to be built
value: ${{ steps.determineBuildProject.outputs.BuildIt }}
runs:
using: composite
steps:
- name: run
shell: ${{ inputs.shell }}
id: determineBuildProject
env:
_token: ${{ inputs.token }}
_skippedProjectsJson: ${{ inputs.skippedProjectsJson }}
_project: ${{ inputs.project }}
_baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}
run: |
${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DetermineBuildProject" -Action {
${{ github.action_path }}/DetermineBuildProject.ps1 -token $env:_token -skippedProjectsJson $env:_skippedProjectsJson -project $env:_project -baselineWorkflowRunId $env:_baselineWorkflowRunId
}
branding:
icon: terminal
color: blue
Loading
Loading