Skip to content

MAN-227 - update pipeline that previously worked #22

MAN-227 - update pipeline that previously worked

MAN-227 - update pipeline that previously worked #22

Workflow file for this run

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
#concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
## This will cancel all running build/test/release pipelines that are not on the main branch
## If this pipeline is on the main branch, it will wait until existing runs complete
# cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
# main node build workflow
# node_build:
# name: node build
# uses: ./.github/workflows/node_build.yml # WORKFLOW_VERSION
# secrets: inherit
node-build:
name: Run the node build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ inputs.node_version_file }}
uses: actions/setup-node@v4
with:
node-version-file: ${{ inputs.node_version_file }}
- name: update npm
shell: bash
run: |
sudo npm install -g npm@latest
- name: restore cache
id: restore-cache
uses: actions/cache/restore@v4
env:
cache-name: node-modules
with:
path: |
./node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
shell: bash
run: |
npm ci --no-audit
- name: build npm
shell: bash
run: |
npm run build
- name: Linter check # Run linter after build because the integration test code depend on compiled typescript...
shell: bash
run: |
npm run lint
- name: upload the artifacts
uses: actions/upload-artifact@v4
with:
name: npm_build_artifacts
path: |
build/
dist/
assets/stylesheets/
- name: save cache
id: save-cache
uses: actions/cache/save@v4
env:
cache-name: node-modules
with:
path: |
./node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# generic node unit tests - feel free to override with local tests if required
node_unit_tests:
name: node unit tests
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_unit_tests.yml@v2 # WORKFLOW_VERSION
needs: [node_build]

Check failure on line 94 in .github/workflows/pipeline.yml

View workflow run for this annotation

GitHub Actions / Pipeline [test -> build -> deploy]

Invalid workflow file

The workflow is not valid. .github/workflows/pipeline.yml (Line: 94, Col: 13): Job 'node_unit_tests' depends on unknown job 'node_build'. .github/workflows/pipeline.yml (Line: 100, Col: 13): Job 'node_integration_tests' depends on unknown job 'node_build'.
secrets: inherit
# generic node integration tests using wiremock - feel free to override with local tests if required
node_integration_tests:
name: node integration tests
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_integration_tests.yml@v2 # WORKFLOW_VERSION
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
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: true
deploy_dev:
name: Deploy to the development environment
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 }}'
# deploy_preprod:
# name: Deploy to pre-production environment
# needs:
# - build
# - deploy_dev
# 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 }}'
# deploy_prod:
# name: Deploy to production environment
# needs:
# - build
# - 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 }}'