Run integration tests in parallel again (#616) #1061
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: Pipeline [test -> build -> deploy] | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| inputs: | |
| additional_docker_tag: | |
| description: Additional docker tag that can be used to specify stable or testing tags | |
| required: false | |
| default: '' | |
| type: string | |
| push: | |
| description: Push docker image to registry flag | |
| required: true | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| concurrency: | |
| # Only cancel in progress when on a branch - use SHA on main to ensure uniqueness. | |
| # This will allow multiple pipelines to run at the same time on main. | |
| # Note that two pipelines running within a few minutes of each other will cause issues with helm deploying to | |
| # a namespace, as the second one will not be able to get a lock as a deploy will be in progress. | |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| node_build: | |
| name: node build | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_build.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| with: | |
| install_command: 'npm run setup' | |
| node_unit_tests: | |
| name: node unit tests | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_unit_tests.yml@v2 # WORKFLOW_VERSION | |
| needs: node_build | |
| secrets: inherit | |
| node_integration_tests: | |
| name: node integration tests | |
| uses: ./.github/workflows/parallel_integration_tests.yml | |
| needs: node_build | |
| secrets: inherit | |
| helm_lint: | |
| strategy: | |
| matrix: | |
| environments: ['dev', 'preprod', 'prod'] | |
| name: helm lint | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| with: | |
| environment: ${{ matrix.environments }} | |
| build: | |
| name: Build docker image from hmpps-github-actions | |
| if: github.ref == 'refs/heads/main' | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| needs: | |
| - node_integration_tests | |
| - node_unit_tests | |
| with: | |
| docker_registry: 'ghcr.io' | |
| registry_org: 'ministryofjustice' | |
| additional_docker_tag: ${{ inputs.additional_docker_tag }} | |
| push: ${{ inputs.push || true }} | |
| docker_multiplatform: false | |
| generate_sbom: true | |
| attach_sbom_to_registry: true | |
| sign_image: true | |
| additional_docker_build_args: --secret id=sentry,env=SENTRY_AUTH_TOKEN | |
| deploy_dev: | |
| name: Deploy to the dev environment | |
| if: github.ref == 'refs/heads/main' | |
| needs: | |
| - build | |
| - helm_lint | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| with: | |
| environment: 'dev' | |
| app_version: '${{ needs.build.outputs.app_version }}' | |
| helm_timeout: '5m' | |
| deploy_preprod: | |
| name: Deploy to the preprod environment | |
| if: github.ref == 'refs/heads/main' | |
| needs: | |
| - build | |
| - helm_lint | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| with: | |
| environment: 'preprod' | |
| app_version: '${{ needs.build.outputs.app_version }}' | |
| helm_timeout: '5m' | |
| deploy_prod: | |
| name: Deploy to the prod environment | |
| needs: | |
| - build | |
| - helm_lint | |
| - deploy_preprod | |
| uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION | |
| secrets: inherit | |
| with: | |
| environment: 'prod' | |
| app_version: '${{ needs.build.outputs.app_version }}' | |
| show_changelog: false | |
| helm_timeout: '5m' |