-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional options for running the standardised build process (#50)
- New reusable workflow that runs the standardised build process using a single job - New composite action that encapsulates the standardised build process
- Loading branch information
1 parent
14c18cc
commit b2f903e
Showing
8 changed files
with
525 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: ci-compositie-action | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/ci-composite-action.yml | ||
- actions/** | ||
workflow_dispatch: | ||
inputs: | ||
forcePublish: | ||
description: When true the Publish stage will always be run, otherwise it only runs for tagged versions. | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
actions: write # enable cache clean-up | ||
checks: write # enable test result annotations | ||
contents: write # enable creating releases | ||
issues: read | ||
packages: write # enable publishing packages | ||
pull-requests: write # enable test result annotations | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
semver: ${{ steps.run_build.outputs.semver }} | ||
major: ${{ steps.run_build.outputs.major }} | ||
majorMinor: ${{ steps.run_build.outputs.majorMinor }} | ||
preReleaseTag: ${{ steps.run_build.outputs.preReleaseTag }} | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./actions/prepare-env-vars-and-secrets | ||
id: prepareEnvVarsAndSecrets | ||
with: | ||
environmentVariablesYaml: | | ||
BUILDVAR_NuGetPublishSource: "${{ startsWith(github.ref, 'refs/tags/') && 'https://api.nuget.org/v3/index.json' || 'https://nuget.pkg.github.com/endjin/index.json' }}" | ||
secretsYaml: | | ||
NUGET_API_KEY: "${{ startsWith(github.ref, 'refs/tags/') && secrets.ENDJIN_NUGET_APIKEY || secrets.ENDJIN_GITHUB_PUBLISHER_PAT }}" | ||
SBOM_ANALYSIS_RELEASE_READER_PAT: "${{ secrets.ENDJIN_GITHUB_READER_PAT }}" | ||
- uses: ./actions/run-build-process | ||
id: run_build | ||
with: | ||
netSdkVersion: '8.x' | ||
# workflow_dispatch inputs are always strings, the type property is just for the UI | ||
forcePublish: ${{ github.event.inputs.forcePublish == 'true' }} | ||
sbomOutputStorageAccountName: ${{ vars.SBOM_OUTPUT_STORAGE_ACCOUNT_NAME }} | ||
sbomOutputStorageContainerName: ${{ vars.SBOM_OUTPUT_STORAGE_CONTAINER_NAME }} | ||
buildEnv: ${{ steps.prepareEnvVarsAndSecrets.outputs.environmentVariablesYamlBase64}} | ||
buildSecrets: ${{ steps.prepareEnvVarsAndSecrets.outputs.secretsYamlBase64 }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: ci-single-job | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/ci-single-job.yml | ||
- .github/workflows/scripted-build-single-job-pipeline.yml | ||
- actions/** | ||
workflow_dispatch: | ||
inputs: | ||
forcePublish: | ||
description: When true the Publish stage will always be run, otherwise it only runs for tagged versions. | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
actions: write # enable cache clean-up | ||
checks: write # enable test result annotations | ||
contents: write # enable creating releases | ||
issues: read | ||
packages: write # enable publishing packages | ||
pull-requests: write # enable test result annotations | ||
|
||
jobs: | ||
prepareConfig: | ||
name: Prepare Configuration | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RESOLVED_ENV_VARS: ${{ steps.prepareEnvVarsAndSecrets.outputs.environmentVariablesYamlBase64 }} | ||
RESOLVED_SECRETS: ${{ steps.prepareEnvVarsAndSecrets.outputs.secretsYamlBase64 }} | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Declare any environment variables and/or secrets that need to be available inside the build process | ||
- uses: ./actions/prepare-env-vars-and-secrets | ||
id: prepareEnvVarsAndSecrets | ||
with: | ||
environmentVariablesYaml: | | ||
BUILDVAR_NuGetPublishSource: "${{ startsWith(github.ref, 'refs/tags/') && 'https://api.nuget.org/v3/index.json' || 'https://nuget.pkg.github.com/endjin/index.json' }}" | ||
secretsYaml: | | ||
NUGET_API_KEY: "${{ startsWith(github.ref, 'refs/tags/') && secrets.ENDJIN_NUGET_APIKEY || secrets.ENDJIN_GITHUB_PUBLISHER_PAT }}" | ||
SBOM_ANALYSIS_RELEASE_READER_PAT: "${{ secrets.ENDJIN_GITHUB_READER_PAT }}" | ||
build: | ||
needs: prepareConfig | ||
uses: ./.github/workflows/scripted-build-single-job-pipeline.yml | ||
with: | ||
netSdkVersion: '8.x' | ||
# workflow_dispatch inputs are always strings, the type property is just for the UI | ||
forcePublish: ${{ github.event.inputs.forcePublish == 'true' }} | ||
buildEnv: ${{ needs.prepareConfig.outputs.RESOLVED_ENV_VARS }} | ||
secrets: | ||
buildAzureCredentials: ${{ secrets.ENDJIN_PROD_ACR_READER_CREDENTIALS }} | ||
buildSecrets: ${{ needs.prepareConfig.outputs.RESOLVED_SECRETS }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
netSdkVersion: | ||
description: The primary .NET SDK version required for the build process, as per the syntax required by the 'setup-dotnet' action. | ||
required: true | ||
type: string | ||
default: '8.0.x' | ||
additionalNetSdkVersion: | ||
description: An additional .NET SDK version required for the build process, as per the syntax required by the 'setup-dotnet' action. | ||
required: false | ||
type: string | ||
pythonVersion: | ||
description: Specify an additional Python version required for the build process | ||
required: false | ||
type: string | ||
configuration: | ||
description: The target build configuration. | ||
required: false | ||
default: 'Release' | ||
type: string | ||
buildEnv: | ||
description: A JSON object representing the environment variables required when running the build script. | ||
required: false | ||
type: string | ||
buildArtifactName: | ||
description: If set, during the test phase, uploads a GitHub artifact with the provided name (path must be specified in `artifactPath`) | ||
required: false | ||
type: string | ||
buildArtifactPath: | ||
description: If set, during the test phase, uploads a GitHub artifact with the provided path (name must be specified in `artifactName`). The path can be a file, directory or wildcard pattern; multiple paths can be specified using newline demiliter. | ||
required: false | ||
type: string | ||
forcePublish: | ||
description: When true, the Publish stage will be run regardless of the current branch or tag. | ||
required: false | ||
default: false | ||
type: boolean | ||
buildScriptPath: | ||
description: The path to the build script to run. | ||
required: false | ||
default: ./build.ps1 | ||
type: string | ||
buildTasks: | ||
description: The tasks that need to be run as part of the build process, formatted as a comma-delimited string (e.g. 'FullBuild' or 'Build,Test'). | ||
required: false | ||
default: '' | ||
type: string | ||
runsOn: | ||
description: The operating system to run all stages of this workflow. | ||
required: false | ||
default: ubuntu-latest | ||
type: string | ||
|
||
secrets: | ||
buildAzureCredentials: | ||
required: false | ||
buildSecrets: | ||
description: A YAML string representing a dictionary of secrets required when running the 'compile' stage of this workflow. | ||
required: false | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ${{ inputs.runsOn }} | ||
outputs: | ||
semver: ${{ steps.run_build.outputs.semver }} | ||
major: ${{ steps.run_build.outputs.major }} | ||
majorMinor: ${{ steps.run_build.outputs.majorMinor }} | ||
preReleaseTag: ${{ steps.run_build.outputs.preReleaseTag }} | ||
|
||
steps: | ||
- uses: endjin/Endjin.RecommendedPractices.GitHubActions/actions/run-build-process@main | ||
id: run_build | ||
with: | ||
netSdkVersion: ${{ inputs.netSdkVersion }} | ||
additionalNetSdkVersion: ${{ inputs.additionalNetSdkVersion }} | ||
buildArtifactName: ${{ inputs.buildArtifactName }} | ||
buildArtifactPath: ${{ inputs.buildArtifactPath }} | ||
buildScriptPath: ${{ inputs.buildScriptPath }} | ||
buildTasks: ${{ inputs.buildTasks }} | ||
codeCoverageSummaryDir: ${{ vars.CODE_COVERAGE_SUMMARY_DIR || '_codeCoverage' }} | ||
codeCoverageSummaryFile: ${{ vars.CODE_COVERAGE_SUMMARY_FILE || 'SummaryGithub.md' }} | ||
configuration: ${{ inputs.configuration }} | ||
pythonVersion: ${{ inputs.pythonVersion }} | ||
runsOn: ${{ inputs.runsOn }} | ||
# workflow_dispatch inputs are always strings, the type property is just for the UI | ||
forcePublish: ${{ github.event.inputs.forcePublish == 'true' }} | ||
sbomOutputStorageAccountName: ${{ vars.SBOM_OUTPUT_STORAGE_ACCOUNT_NAME }} | ||
sbomOutputStorageContainerName: ${{ vars.SBOM_OUTPUT_STORAGE_CONTAINER_NAME }} | ||
buildEnv: ${{ inputs.buildEnv }} | ||
buildSecrets: ${{ secrets.buildSecrets }} | ||
buildAzureCredentials: ${{ secrets.buildAzureCredentials }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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
Oops, something went wrong.