Skip to content

Chore(deps): Bump jwt from 2.8.2 to 2.9.0 #3175

Chore(deps): Bump jwt from 2.8.2 to 2.9.0

Chore(deps): Bump jwt from 2.8.2 to 2.9.0 #3175

name: CI and CD
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
env:
RACK_ENV: test
RAILS_ENV: test
DATABASE_URL: "postgresql://postgres:postgres@127.0.0.1/laa-assure-hmrc-data-test"
services:
postgres:
image: postgres:14.5-alpine
env:
POSTGRES_DB: laa-assure-hmrc-data-test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
clamav:
image: ghcr.io/ministryofjustice/hmpps-clamav:latest
ports:
- 3310:3310
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Find yarn cache location
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: JS package cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages with yarn
run: yarn install --frozen-lockfile
- name: Precompile assets
run: bin/rails assets:precompile
- name: Setup test database
run: bin/rails db:prepare
- name: Run linters
run: |
bundle exec rubocop
bundle exec rake erblint
yarn run standardjs
yarn run stylelint
- name: Install clamav client
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clamdscan
- name: Run tests
run: bundle exec rspec
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage
retention-days: 7
build:
if: github.actor != 'dependabot[bot]'
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
id: build_and_push
uses: ./.github/actions/build_and_push
with:
ecr-region: ${{ vars.ECR_REGION }}
ecr-role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
ecr-repository: ${{ vars.ECR_REPOSITORY }}
deploy-uat:
runs-on: ubuntu-latest
needs: build
environment: uat
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy UAT branch
id: deploy_uat_branch
uses: ./.github/actions/deploy_branch
with:
ecr-region: ${{ vars.ECR_REGION }}
ecr-role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
ecr-repository: ${{ vars.ECR_REPOSITORY }}
kube-cert: ${{ secrets.KUBE_UAT_CERT }}
kube-token: ${{ secrets.KUBE_UAT_TOKEN }}
kube-cluster: ${{ secrets.KUBE_UAT_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_UAT_NAMESPACE }}
app-environment: uat
deploy-staging:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
environment: staging
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy staging
id: deploy_staging
uses: ./.github/actions/deploy
with:
ecr-region: ${{ vars.ECR_REGION }}
ecr-role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
ecr-repository: ${{ vars.ECR_REPOSITORY }}
kube-cert: ${{ secrets.KUBE_STAGING_CERT }}
kube-token: ${{ secrets.KUBE_STAGING_TOKEN }}
kube-cluster: ${{ secrets.KUBE_STAGING_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_STAGING_NAMESPACE }}
app-environment: staging
deploy-production:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: deploy-staging
environment: production
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy production
id: deploy_staging
uses: ./.github/actions/deploy
with:
ecr-region: ${{ vars.ECR_REGION }}
ecr-role-to-assume: ${{ secrets.ECR_ROLE_TO_ASSUME }}
ecr-repository: ${{ vars.ECR_REPOSITORY }}
kube-cert: ${{ secrets.KUBE_PRODUCTION_CERT }}
kube-token: ${{ secrets.KUBE_PRODUCTION_TOKEN }}
kube-cluster: ${{ secrets.KUBE_PRODUCTION_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_PRODUCTION_NAMESPACE }}
app-environment: production