Skip to content

Allow Wildcards and Filter on Test Codeunit Name #818

Allow Wildcards and Filter on Test Codeunit Name

Allow Wildcards and Filter on Test Codeunit Name #818

name: 'Pull Request Build'
on:
pull_request_target:
paths-ignore:
- '**.md'
branches: [ 'main' ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
defaults:
run:
shell: powershell
permissions:
contents: read
actions: read
pull-requests: read
env:
workflowDepth: 2
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
PregateCheck:
if: github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
runs-on: [ windows-latest ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- uses: microsoft/AL-Go-Actions/VerifyPRChanges@preview
with:
baseSHA: ${{ github.event.pull_request.base.sha }}
headSHA: ${{ github.event.pull_request.head.sha }}
prbaseRepository: ${{ github.event.pull_request.base.repo.full_name }}
Initialization:
needs: [ PregateCheck ]
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settings: ${{ steps.ReadSettings.outputs.SettingsJson }}
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 }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@preview
with:
shell: powershell
eventId: "DO0104"
- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go-Actions/ReadSettings@preview
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
getEnvironments: '*'
- name: Determine Projects To Build
id: determineProjectsToBuild
uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@preview
with:
shell: powershell
maxBuildDepth: ${{ env.workflowDepth }}
Build1:
needs: [ Initialization ]
if: (!failure()) && (!cancelled()) && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
defaults:
run:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
strategy:
matrix:
include: ${{ fromJson(needs.Initialization.outputs.buildOrderJson)[0].buildDimensions }}
fail-fast: false
name: Build ${{ matrix.project }} - ${{ matrix.buildMode }}
outputs:
AppsArtifactsName: ${{ steps.calculateArtifactNames.outputs.AppsArtifactsName }}
TestAppsArtifactsName: ${{ steps.calculateArtifactNames.outputs.TestAppsArtifactsName }}
TestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.TestResultsArtifactsName }}
BcptTestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.BcptTestResultsArtifactsName }}
BuildOutputArtifactsName: ${{ steps.calculateArtifactNames.outputs.BuildOutputArtifactsName }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Download thisbuild artifacts
if: env.workflowDepth > 1
uses: actions/download-artifact@v3
with:
path: '.dependencies'
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
- name: Read secrets
uses: microsoft/AL-Go-Actions/ReadSecrets@preview
env:
secrets: ${{ toJson(secrets) }}
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
settingsJson: ${{ env.Settings }}
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext'
- name: Run pipeline
id: RunPipeline
uses: microsoft/AL-Go-Actions/RunPipeline@preview
env:
BuildMode: ${{ matrix.buildMode }}
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
settingsJson: ${{ env.Settings }}
secretsJson: ${{ env.RepoSecrets }}
buildMode: ${{ matrix.buildMode }}
- name: Calculate Artifact names
id: calculateArtifactsNames
uses: microsoft/AL-Go-Actions/CalculateArtifactNames@preview
if: success() || failure()
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
settingsJson: ${{ env.Settings }}
project: ${{ matrix.project }}
buildMode: ${{ matrix.buildMode }}
branchName: ${{ github.ref_name }}
- name: Upload thisbuild artifacts - apps
if: env.workflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
path: '${{ matrix.project }}/.buildartifacts/Apps/'
if-no-files-found: ignore
retention-days: 1
- name: Upload thisbuild artifacts - test apps
if: env.workflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
path: '${{ matrix.project }}/.buildartifacts/TestApps/'
if-no-files-found: ignore
retention-days: 1
- name: Publish artifacts - build output
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',matrix.project)) != '')
with:
name: ${{ env.BuildOutputArtifactsName }}
path: '${{ matrix.project }}/BuildOutput.txt'
if-no-files-found: ignore
- name: Publish artifacts - container event log
uses: actions/upload-artifact@v3
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',matrix.project)) != '')
with:
name: ${{ env.ContainerEventLogArtifactsName }}
path: '${{ matrix.project }}/ContainerEventLog.evtx'
if-no-files-found: ignore
- name: Publish artifacts - test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',matrix.project)) != '')
with:
name: ${{ env.TestResultsArtifactsName }}
path: '${{ matrix.project }}/TestResults.xml'
if-no-files-found: ignore
- name: Publish artifacts - bcpt test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',matrix.project)) != '')
with:
name: ${{ env.BcptTestResultsArtifactsName }}
path: '${{ matrix.project }}/bcptTestResults.json'
if-no-files-found: ignore
- name: Analyze Test Results
id: analyzeTestResults
if: success() || failure()
uses: microsoft/AL-Go-Actions/AnalyzeTests@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
- name: Cleanup
if: always()
uses: microsoft/AL-Go-Actions/PipelineCleanup@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
Build:
needs: [ Initialization, Build1 ]
if: (!failure()) && (!cancelled()) && (needs.Build1.result == 'success' || needs.Build1.result == 'skipped') && fromJson(needs.Initialization.outputs.buildOrderJson)[1].projectsCount > 0
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
defaults:
run:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
strategy:
matrix:
include: ${{ fromJson(needs.Initialization.outputs.buildOrderJson)[1].buildDimensions }}
fail-fast: false
name: Build ${{ matrix.project }} - ${{ matrix.buildMode }}
outputs:
AppsArtifactsName: ${{ steps.calculateArtifactNames.outputs.AppsArtifactsName }}
TestAppsArtifactsName: ${{ steps.calculateArtifactNames.outputs.TestAppsArtifactsName }}
TestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.TestResultsArtifactsName }}
BcptTestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.BcptTestResultsArtifactsName }}
BuildOutputArtifactsName: ${{ steps.calculateArtifactNames.outputs.BuildOutputArtifactsName }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Download thisbuild artifacts
if: env.workflowDepth > 1
uses: actions/download-artifact@v3
with:
path: '.dependencies'
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
- name: Read secrets
uses: microsoft/AL-Go-Actions/ReadSecrets@preview
env:
secrets: ${{ toJson(secrets) }}
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
settingsJson: ${{ env.Settings }}
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext'
- name: Run pipeline
id: RunPipeline
uses: microsoft/AL-Go-Actions/RunPipeline@preview
env:
BuildMode: ${{ matrix.buildMode }}
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
settingsJson: ${{ env.Settings }}
secretsJson: ${{ env.RepoSecrets }}
buildMode: ${{ matrix.buildMode }}
- name: Calculate Artifact names
id: calculateArtifactsNames
uses: microsoft/AL-Go-Actions/CalculateArtifactNames@preview
if: success() || failure()
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
settingsJson: ${{ env.Settings }}
project: ${{ matrix.project }}
buildMode: ${{ matrix.buildMode }}
branchName: ${{ github.ref_name }}
- name: Upload thisbuild artifacts - apps
if: env.workflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
path: '${{ matrix.project }}/.buildartifacts/Apps/'
if-no-files-found: ignore
retention-days: 1
- name: Upload thisbuild artifacts - test apps
if: env.workflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
path: '${{ matrix.project }}/.buildartifacts/TestApps/'
if-no-files-found: ignore
retention-days: 1
- name: Publish artifacts - build output
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',matrix.project)) != '')
with:
name: ${{ env.BuildOutputArtifactsName }}
path: '${{ matrix.project }}/BuildOutput.txt'
if-no-files-found: ignore
- name: Publish artifacts - container event log
uses: actions/upload-artifact@v3
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',matrix.project)) != '')
with:
name: ${{ env.ContainerEventLogArtifactsName }}
path: '${{ matrix.project }}/ContainerEventLog.evtx'
if-no-files-found: ignore
- name: Publish artifacts - test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',matrix.project)) != '')
with:
name: ${{ env.TestResultsArtifactsName }}
path: '${{ matrix.project }}/TestResults.xml'
if-no-files-found: ignore
- name: Publish artifacts - bcpt test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',matrix.project)) != '')
with:
name: ${{ env.BcptTestResultsArtifactsName }}
path: '${{ matrix.project }}/bcptTestResults.json'
if-no-files-found: ignore
- name: Analyze Test Results
id: analyzeTestResults
if: success() || failure()
uses: microsoft/AL-Go-Actions/AnalyzeTests@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
- name: Cleanup
if: always()
uses: microsoft/AL-Go-Actions/PipelineCleanup@preview
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
PostProcess:
runs-on: [ windows-latest ]
needs: [ Initialization, Build ]
if: (!cancelled())
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@preview
with:
shell: powershell
eventId: "DO0104"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}