Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 63 additions & 1 deletion .github/actions/TestObjectIdsAndManifests/action.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Import-Module "$PSScriptRoot\..\..\..\build\scripts\AppObjectValidation.psm1" -Force
Import-Module "$PSScriptRoot\..\..\..\build\scripts\BuildOptimization.psm1" -Force
Import-Module "$PSScriptRoot\..\..\..\build\scripts\EnlistmentHelperFunctions.psm1" -DisableNameChecking

$sourceCodeFolder = Join-Path (Get-BaseFolder) "src" -Resolve
Expand All @@ -10,12 +11,28 @@ $w1Apps = @(Join-Path $sourceCodeFolder "Apps\W1")
$w1Layers = @(Join-Path $sourceCodeFolder "Layers\W1")
# All Folders (For Apps)
$allApps = @(Join-Path $sourceCodeFolder "Apps")
# The 'Layers' folder only exists on main and on release branches from 29.0 onwards.
# Guard the Get-ChildItem call so it does not fail when the folder is missing.
$layersFolder = Join-Path $sourceCodeFolder 'Layers'
$allBaseApps = @(
if (Test-Path -Path $layersFolder) {
Get-ChildItem -Path $layersFolder -Directory |
ForEach-Object { Join-Path $_.FullName 'BaseApp' } |
Where-Object { Test-Path -Path $_ }
}
)

# Build path sets for different validations
# Some folders (e.g. Layers) only exist on main and not on release branches, so filter out
# any paths that do not exist to avoid Get-ChildItem failing on missing directories.
[string[]] $w1OnlyPaths = @($baseFolders + $w1Apps + $w1Layers | Where-Object { Test-Path -Path $_ })
[string[]] $allPaths = @($baseFolders + $allApps + $w1Layers | Where-Object { Test-Path -Path $_ })
[string[]] $objectIdValidationPaths = @(
$allBaseApps
(Join-Path $sourceCodeFolder 'Business Foundation\App')
(Join-Path $sourceCodeFolder 'System Application\App')
$allApps
) | Where-Object { Test-Path -Path $_ }

# Define exceptions
$AllowedDuplicateObjects = @(
Expand Down Expand Up @@ -81,4 +98,49 @@ $expectedPlatformVersionPrevious = "$($currentMajor - 1).0.0.0"
Test-ApplicationManifests -Path $allPaths -ExpectedAppVersion "$($currentMajorMinor).0.0" -ExpectedPlatformVersions @($expectedPlatformVersionCurrent, $expectedPlatformVersionPrevious)

# Test that we are not adding new uncategorized tests (W1 only) - Disabled for now
# Test-ApplicationTestTypes -SourceCodePaths $w1OnlyPaths -Exceptions $allowedUncategorizedTests
# Test-ApplicationTestTypes -SourceCodePaths $w1OnlyPaths -Exceptions $allowedUncategorizedTests

# Test object IDs declared in newly added production AL files.
$AllowedObjectIdRanges = @(
[PSCustomObject]@{ From = 1; To = 49999 },
[PSCustomObject]@{ From = 2000000; To = 2000059 },
[PSCustomObject]@{ From = 3005000; To = 3011499 },
[PSCustomObject]@{ From = 5000000; To = 5000099 },
[PSCustomObject]@{ From = 5000250; To = 5055999 },
[PSCustomObject]@{ From = 5001900; To = 5001999 },
[PSCustomObject]@{ From = 5005100; To = 5005399 },
[PSCustomObject]@{ From = 7000000; To = 7000099 },
[PSCustomObject]@{ From = 11000000; To = 11000499 },
[PSCustomObject]@{ From = 15000000; To = 15000499 },
[PSCustomObject]@{ From = 31000000; To = 31000099 },
[PSCustomObject]@{ From = 32000000; To = 32000199 },
[PSCustomObject]@{ From = 99000750; To = 99001048 }
)

# '@($null)' has a Count of 1, so filter empties to make the guard below work.
$addedFiles = @(Get-ChangedFilesForCI -DiffFilter 'A' -CompareFromMergeBase -RequireChangeDetection | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
if ($addedFiles.Count -eq 0) {
Write-Host "No newly added files were found; skipping the production object ID range validation."
}
else {
$repositoryRoot = (Resolve-Path -Path (Get-BaseFolder)).Path
$addedFilePaths = @($addedFiles | ForEach-Object { Join-Path -Path $repositoryRoot -ChildPath $_ })

# 'build\projects.json' is absent on some branches; pass it only when present.
$projectsJsonPath = Join-Path -Path $repositoryRoot -ChildPath 'build\projects.json'
$getALGoTestFoldersParams = @{
ProjectsPath = Join-Path -Path $repositoryRoot -ChildPath 'build\projects'
RepositoryRoot = $repositoryRoot
}
if (Test-Path -LiteralPath $projectsJsonPath) {
$getALGoTestFoldersParams['ProjectsJsonPath'] = $projectsJsonPath
}
else {
Write-Host "No 'build\projects.json' found at '$projectsJsonPath'; deriving test folders from project settings only."
}
$testFolderPaths = Get-ALGoTestFolders @getALGoTestFoldersParams
$allowedRangesText = ($AllowedObjectIdRanges | ForEach-Object { "$($_.From)..$($_.To)" }) -join ', '
Write-Host "Validating object IDs in newly added production AL files (allowed ranges: $allowedRangesText)."

Test-ObjectIDsInAddedALFilesAreInAllowedRange -FilePaths $addedFilePaths -SourceCodePaths $objectIdValidationPaths -TestFolderPaths $testFolderPaths -AllowedRanges $AllowedObjectIdRanges
}
18 changes: 14 additions & 4 deletions .github/workflows/AddUnstableTestsFromRun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,33 @@ jobs:
- name: Build branch filter
id: filter
shell: pwsh
env:
BRANCH_FILTER: ${{ inputs.branch }}
run: |
# Convert the comma-separated branch filter into the JSON array that GetGitBranches expects.
$patterns = '${{ inputs.branch }}'.Split(',') | ForEach-Object { $_.Trim() } | Where-Object { $_ }
$patterns = $env:BRANCH_FILTER.Split(',') | ForEach-Object { $_.Trim() } | Where-Object { $_ }
$json = ConvertTo-Json @($patterns) -Compress
Write-Host "Branch filter: $json"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "includeJson=$json"

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: ${{ steps.filter.outputs.includeJson }}

- name: Ensure JSON array
id: ensureArray
shell: pwsh
env:
BRANCHES_JSON: ${{ steps.getOfficialBranches.outputs.branchesJson }}
run: |
# PowerShell's ConvertTo-Json emits a bare string for single-element arrays.
# Wrap it in an array if needed so the matrix strategy always receives a JSON array.
$raw = '${{ steps.getOfficialBranches.outputs.branchesJson }}'
$raw = $env:BRANCHES_JSON
$parsed = $raw | ConvertFrom-Json
if ($parsed -is [string]) { $parsed = @($parsed) }
$json = ConvertTo-Json @($parsed) -Compress
Expand All @@ -73,8 +80,11 @@ jobs:
branch: ${{ fromJson(needs.GetBranches.outputs.updateBranches) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Add unstable tests from run
uses: microsoft/BCApps/.github/actions/UpdateUnstableTests@main
uses: ./.github/actions/UpdateUnstableTests
with:
branch: ${{ matrix.branch }}
run-id: ${{ inputs.runId }}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/PullRequestHandler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,20 @@ jobs:
if: (!failure() && !cancelled())
runs-on: windows-latest
name: Verify App Changes
# Runs actions from the PR checkout, so only grant read access (no id-token or other write permissions)
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
fetch-depth: 0

- uses: microsoft/BCApps/.github/actions/TestPreprocessorSymbols@main
- uses: ./.github/actions/TestPreprocessorSymbols

- uses: microsoft/BCApps/.github/actions/TestObjectIdsAndManifests@main
- uses: ./.github/actions/TestObjectIdsAndManifests

- uses: microsoft/BCApps/.github/actions/VerifyMiappSync@main
- uses: ./.github/actions/VerifyMiappSync

- uses: microsoft/BCApps/.github/actions/ValidateCountryProjects@main
- uses: ./.github/actions/ValidateCountryProjects
10 changes: 8 additions & 2 deletions .github/workflows/SubmitStabilityJobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ jobs:
outputs:
officialBranches: ${{ steps.getOfficialBranches.outputs.branchesJson }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: "['main', 'releases/*']"

Expand All @@ -38,10 +41,13 @@ jobs:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Submit Stability Job
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
uses: microsoft/BCApps/.github/actions/RunAutomation@main
uses: ./.github/actions/RunAutomation
with:
automations: SubmitStabilityJob
targetBranch: ${{ matrix.branch }}
15 changes: 13 additions & 2 deletions .github/workflows/UpdateALGoProjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ jobs:
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: "['main', 'releases/*']"

Expand Down Expand Up @@ -54,10 +57,18 @@ jobs:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout actions
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: _actions
sparse-checkout: |
.github/actions
build/scripts

- name: Update AL-Go Project Dependencies
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
uses: microsoft/BCApps/.github/actions/RunAutomation@main
uses: ./_actions/.github/actions/RunAutomation
with:
automations: UpdateUseProjectDependencies
targetBranch: ${{ matrix.branch }}
2 changes: 1 addition & 1 deletion .github/workflows/UpdateALGoSupportedBranches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Update AL-Go Supported Branches
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
uses: microsoft/BCApps/.github/actions/RunAutomation@main
uses: ./.github/actions/RunAutomation
Comment thread
mazhelez marked this conversation as resolved.
Resolved
with:
automations: UpdateSystemFilesSchedule
targetBranch: main
15 changes: 13 additions & 2 deletions .github/workflows/UpdateBCArtifactVersion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ jobs:
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: "['main', 'releases/*']"

Expand Down Expand Up @@ -54,10 +57,18 @@ jobs:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout actions
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: _actions
sparse-checkout: |
.github/actions
build/scripts

- name: Update BC Artifact Version
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
uses: microsoft/BCApps/.github/actions/RunAutomation@main
uses: ./_actions/.github/actions/RunAutomation

with:
automations: UpdateBCArtifact,UpdatePlatformVersion
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/UpdatePackageVersions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ jobs:
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: "['main', 'releases/*']"

Expand Down Expand Up @@ -54,10 +57,18 @@ jobs:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout actions
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: _actions
sparse-checkout: |
.github/actions
build/scripts

- name: Update Package Versions
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
uses: microsoft/BCApps/.github/actions/RunAutomation@main
uses: ./_actions/.github/actions/RunAutomation
with:
automations: UpdateAppBaselines,UpdateAppTranslations
targetBranch: ${{ matrix.branch }}
7 changes: 5 additions & 2 deletions .github/workflows/UpdateUnstableTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ jobs:
outputs:
updateBranches: ${{ steps.ensureArray.outputs.branchesJson }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Get Official Branches
id: getOfficialBranches
uses: microsoft/BCApps/.github/actions/GetGitBranches@main
uses: ./.github/actions/GetGitBranches
with:
include: "['main', 'releases/*']"

Expand Down Expand Up @@ -101,7 +104,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Update unstable tests
uses: microsoft/BCApps/.github/actions/UpdateUnstableTestsCombined@main
uses: ./.github/actions/UpdateUnstableTestsCombined
with:
branch: ${{ matrix.branch }}
run-limit: ${{ inputs.runLimit || 3 }}
Expand Down
Loading
Loading