Use ReadSettings from agolution/AL-Go-Actions #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: '_Build AL-Go project' | ||
| run-name: 'Build ${{ inputs.project }}' | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| shell: | ||
| description: Shell in which you want to run the action (powershell or pwsh) | ||
| required: false | ||
| default: powershell | ||
| type: string | ||
| runsOn: | ||
| description: JSON-formatted string of the types of machine to run the build job on | ||
| required: true | ||
| type: string | ||
| checkoutRef: | ||
| description: Ref to checkout | ||
| required: false | ||
| default: ${{ github.sha }} | ||
| type: string | ||
| project: | ||
| description: Name of the built project | ||
| required: true | ||
| type: string | ||
| projectName: | ||
| description: Friendly name of the built project | ||
| required: true | ||
| type: string | ||
| skippedProjectsJson: | ||
| description: An array of AL-Go projects to skip in compressed JSON format | ||
| required: false | ||
| default: '[]' | ||
| type: string | ||
| projectDependenciesJson: | ||
| description: Dependencies of the built project in compressed Json format | ||
| required: false | ||
| default: '{}' | ||
| type: string | ||
| buildMode: | ||
| description: Build mode used when building the artifacts | ||
| required: true | ||
| type: string | ||
| baselineWorkflowRunId: | ||
| description: ID of the baseline workflow run, from where to download the current project dependencies, in case they are not built in the current workflow run | ||
| required: false | ||
| default: '0' | ||
| type: string | ||
| baselineWorkflowSHA: | ||
| description: SHA of the baseline workflow run | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| secrets: | ||
| description: A comma-separated string with the names of the secrets, required for the workflow. | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| artifactsRetentionDays: | ||
| description: Number of days to keep the artifacts | ||
| type: number | ||
| default: 0 | ||
| artifactsNameSuffix: | ||
| description: Suffix to add to the artifacts names | ||
| required: false | ||
| default: '' | ||
| type: string | ||
| signArtifacts: | ||
| description: Flag indicating whether the apps should be signed | ||
| type: boolean | ||
| default: false | ||
| useArtifactCache: | ||
| description: Flag determining whether to use the Artifacts Cache | ||
| type: boolean | ||
| default: false | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| id-token: write | ||
| env: | ||
| ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} | ||
| ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} | ||
| jobs: | ||
| BuildALGoProject: | ||
| needs: [ ] | ||
| runs-on: ${{ fromJson(inputs.runsOn) }} | ||
| defaults: | ||
| run: | ||
| shell: ${{ inputs.shell }} | ||
| name: ${{ inputs.projectName }} (${{ inputs.buildMode }}) | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.checkoutRef }} | ||
| lfs: true | ||
| - name: Read settings | ||
| uses: agolution/AL-Go-Actions/ReadSettings@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| buildMode: ${{ inputs.buildMode }} | ||
| get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,doNotRunBcptTests,doNotRunpageScriptingTests,artifact,generateDependencyArtifact,trustedSigning,useGitSubmodules | ||
| - name: Determine whether to build project | ||
| id: DetermineBuildProject | ||
| uses: microsoft/AL-Go-Actions/DetermineBuildProject@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| skippedProjectsJson: ${{ inputs.skippedProjectsJson }} | ||
| project: ${{ inputs.project }} | ||
| baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }} | ||
| - name: Read secrets | ||
| id: ReadSecrets | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && github.event_name != 'pull_request' | ||
| uses: microsoft/AL-Go-Actions/ReadSecrets@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| gitHubSecrets: ${{ toJson(secrets) }} | ||
| getSecrets: '${{ inputs.secrets }},appDependencySecrets,AZURE_CREDENTIALS,-gitSubmodulesToken' | ||
| - name: Checkout Submodules | ||
| if: env.useGitSubmodules != 'false' && env.useGitSubmodules != '' | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.checkoutRef }} | ||
| lfs: true | ||
| submodules: ${{ env.useGitSubmodules }} | ||
| token: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).gitSubmodulesToken }}' | ||
| - name: Determine ArtifactUrl | ||
| id: determineArtifactUrl | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' | ||
| uses: microsoft/AL-Go-Actions/DetermineArtifactUrl@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| - name: Cache Business Central Artifacts | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.artifactCacheKey | ||
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | ||
| with: | ||
| path: ${{ runner.temp }}/.artifactcache | ||
| key: ${{ env.artifactCacheKey }} | ||
| - name: Download Project Dependencies | ||
| id: DownloadProjectDependencies | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' | ||
| uses: microsoft/AL-Go-Actions/DownloadProjectDependencies@v7.1 | ||
| env: | ||
| Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| buildMode: ${{ inputs.buildMode }} | ||
| projectDependenciesJson: ${{ inputs.projectDependenciesJson }} | ||
| baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }} | ||
| - name: Build | ||
| uses: microsoft/AL-Go-Actions/RunPipeline@v7.1 | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' | ||
| env: | ||
| Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' | ||
| BuildMode: ${{ inputs.buildMode }} | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| artifact: ${{ env.artifact }} | ||
| project: ${{ inputs.project }} | ||
| buildMode: ${{ inputs.buildMode }} | ||
| installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }} | ||
| installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }} | ||
| baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }} | ||
| baselineWorkflowSHA: ${{ inputs.baselineWorkflowSHA }} | ||
| - name: Sign | ||
| id: sign | ||
| if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && inputs.signArtifacts && env.doNotSignApps == 'False' && (env.keyVaultCodesignCertificateName != '' || (fromJson(env.trustedSigning).Endpoint != '' && fromJson(env.trustedSigning).Account != '' && fromJson(env.trustedSigning).CertificateProfile != '')) | ||
| uses: microsoft/AL-Go-Actions/Sign@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}' | ||
| pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app' | ||
| - name: Calculate Artifact names | ||
| id: calculateArtifactsNames | ||
| uses: microsoft/AL-Go-Actions/CalculateArtifactNames@v7.1 | ||
| if: success() || failure() | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| buildMode: ${{ inputs.buildMode }} | ||
| suffix: ${{ inputs.artifactsNameSuffix }} | ||
| - name: Publish artifacts - apps | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: inputs.artifactsRetentionDays >= 0 && (hashFiles(format('{0}/.buildartifacts/Apps/*',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/Apps/' | ||
| if-no-files-found: ignore | ||
| retention-days: ${{ inputs.artifactsRetentionDays }} | ||
| - name: Publish artifacts - dependencies | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: inputs.artifactsRetentionDays >= 0 && env.generateDependencyArtifact == 'True' && (hashFiles(format('{0}/.buildartifacts/Dependencies/*',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/Dependencies/' | ||
| if-no-files-found: ignore | ||
| retention-days: ${{ inputs.artifactsRetentionDays }} | ||
| - name: Publish artifacts - test apps | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: inputs.artifactsRetentionDays >= 0 && (hashFiles(format('{0}/.buildartifacts/TestApps/*',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/TestApps/' | ||
| if-no-files-found: ignore | ||
| retention-days: ${{ inputs.artifactsRetentionDays }} | ||
| - name: Publish artifacts - build output | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }} | ||
| path: '${{ inputs.project }}/BuildOutput.txt' | ||
| if-no-files-found: ignore | ||
| - name: Publish artifacts - container event log | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }} | ||
| path: '${{ inputs.project }}/ContainerEventLog.evtx' | ||
| if-no-files-found: ignore | ||
| - name: Publish artifacts - test results | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/TestResults.xml',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/TestResults.xml' | ||
| if-no-files-found: ignore | ||
| - name: Publish artifacts - bcpt test results | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/bcptTestResults.json',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/bcptTestResults.json' | ||
| if-no-files-found: ignore | ||
| - name: Publish artifacts - page scripting test results | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/PageScriptingTestResults.xml',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.PageScriptingTestResultsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/PageScriptingTestResults.xml' | ||
| if-no-files-found: ignore | ||
| - name: Publish artifacts - page scripting test result details | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/PageScriptingTestResultDetails/*',inputs.project)) != '') | ||
| with: | ||
| name: ${{ steps.calculateArtifactsNames.outputs.PageScriptingTestResultDetailsArtifactsName }} | ||
| path: '${{ inputs.project }}/.buildartifacts/PageScriptingTestResultDetails/' | ||
| if-no-files-found: ignore | ||
| - name: Analyze Test Results | ||
| id: analyzeTestResults | ||
| if: (success() || failure()) && env.doNotRunTests == 'False' && ((hashFiles(format('{0}/.buildartifacts/TestResults.xml',inputs.project)) != '') || (hashFiles(format('{0}/.buildartifacts/bcptTestResults.json',inputs.project)) != '')) | ||
| uses: microsoft/AL-Go-Actions/AnalyzeTests@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| testType: "normal" | ||
| - name: Analyze BCPT Test Results | ||
| id: analyzeTestResultsBCPT | ||
| if: (success() || failure()) && env.doNotRunBcptTests == 'False' | ||
| uses: microsoft/AL-Go-Actions/AnalyzeTests@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| testType: "bcpt" | ||
| - name: Analyze Page Scripting Test Results | ||
| id: analyzeTestResultsPageScripting | ||
| if: (success() || failure()) && env.doNotRunpageScriptingTests == 'False' | ||
| uses: microsoft/AL-Go-Actions/AnalyzeTests@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||
| testType: "pageScripting" | ||
| - name: Cleanup | ||
| if: always() && steps.DetermineBuildProject.outputs.BuildIt == 'True' | ||
| uses: microsoft/AL-Go-Actions/PipelineCleanup@v7.1 | ||
| with: | ||
| shell: ${{ inputs.shell }} | ||
| project: ${{ inputs.project }} | ||