Skip to content

Commit

Permalink
Release/3.6 (#91)
Browse files Browse the repository at this point in the history
* TMI2-253: Add pre-commit check and update .gitignore to include application-local.properties and .env.local

* Added conditional logic to display department on user page (#72)

* GAP-2129 remove call to email findagrant for posting application form to grant advert (#66)

* GAP-2129 | remove instruction to email findagrant for adding application form to grant advert

* GAP-2129|make changes to copy as per GDS styling

* Changed copy to be consistent with the description shown to applicants for file upload.

* GAP-2230: frontend times out when requesting many submissions (#90)

* GAP-2230: Removing await so it calls the backend to start sending messages to SQS and doesnt wait for its response

* Cache dependencies on failure

* Separating out pipelines to admin/applicant/gap-web-ui (#100)

### Continuous Integration

- Separating out feature workflow into each package
- Triggering on paths related to the specific package plus some others, e.g. for the admin app:
 ```      
      - "packages/admin/**"
      - ".github/workflows/admin-feature.yml"
      - "package.json"
      - "yarn.lock"
```
- This results in if you only ever change the admin app during a PR, then only this pipeline runs.
- If you also e.g. change the applicant app mid way through, both workflows must pass
- Caching dependencies using node-setup@v3
- Separating out Snyk as a new workflow

### Continuous Deployment

- Separated into multiple workflows and triggering with the same path changes as before, but with the addition of any changes to gap-web-ui i.e:
```
      - "packages/admin/**"
      - "packages/gap-web-ui/**"
      - ".github/workflows/admin-pushImage.yml"
      - "package.json"
      - "yarn.lock"

---------

Co-authored-by: Iain Cooper <[email protected]>
Co-authored-by: iaincooper-tco <[email protected]>
Co-authored-by: ryan-tco <[email protected]>
Co-authored-by: ConorFayleTCO <[email protected]>
Co-authored-by: conor <[email protected]>
Co-authored-by: john-tco <[email protected]>
Co-authored-by: jgunnCO <[email protected]>
Co-authored-by: paul-lawlor-tco <[email protected]>
Co-authored-by: JamieGunnCO <[email protected]>
Co-authored-by: a-lor-cab <[email protected]>
  • Loading branch information
11 people authored Oct 17, 2023
1 parent 783ec7d commit 217bdf8
Show file tree
Hide file tree
Showing 32 changed files with 933 additions and 451 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/admin-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Admin CI

on:
pull_request:
branches:
- develop
paths:
- "packages/admin/**"
- ".github/workflows/admin-feature.yml"
- "package.json"
- "yarn.lock"

jobs:
build:
name: Test app

runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Generate .env files
run: |
cp packages/admin/.env.example packages/admin/.env
sed -i -e '/TINYMCE_API_KEY=/s/$/${{ secrets.TINYMCE_API_KEY }}/g' packages/admin/.env
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: 'yarn'

- name: Install dependencies
run: |
yarn install --immutable
- name: Lint files
run: |
yarn workspace admin lint
- name: Build application
run: |
yarn workspace gap-web-ui build
- name: Units Tests
run: |
yarn workspace admin coverage
- name: Build application
run: |
yarn workspace admin build
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Promote to Prod Workflow
name: Admin Promote to Prod Workflow

on:
push:
branches:
- main
paths-ignore:
- "*.md"
paths:
- "packages/admin/**"
- "packages/gap-web-ui/**"
- ".github/workflows/admin-promoteToProd.yml"
- "package.json"
- "yarn.lock"

env:
AWS_REGION: eu-west-2
Expand All @@ -15,10 +19,6 @@ jobs:
environment: AWS
runs-on: ubuntu-latest

strategy:
matrix:
app_name: ["applicant", "admin"]

steps:
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
Expand All @@ -34,5 +34,5 @@ jobs:
- name: Add prod tag to existing qa image
# Based on steps described here - https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-retag.html
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name gap-apply-${{ matrix.app_name }}-web --image-ids imageTag=qa --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name gap-apply-${{ matrix.app_name }}-web --image-tag prod --image-manifest "$MANIFEST"
MANIFEST=$(aws ecr batch-get-image --repository-name gap-apply-admin-web --image-ids imageTag=qa --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name gap-apply-admin-web --image-tag prod --image-manifest "$MANIFEST"
121 changes: 121 additions & 0 deletions .github/workflows/admin-pushImage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Admin CD

on:
push:
branches:
- release/**
- develop
paths:
- "packages/admin/**"
- "packages/gap-web-ui/**"
- ".github/workflows/admin-pushImage.yml"
- "package.json"
- "yarn.lock"

env:
AWS_REGION: eu-west-2

jobs:
build:
name: Test app

runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Generate .env files
run: |
cp packages/admin/.env.example packages/admin/.env
sed -i -e '/TINYMCE_API_KEY=/s/$/${{ secrets.TINYMCE_API_KEY }}/g' packages/admin/.env
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: 'yarn'

- name: Install dependencies
run: |
yarn install --immutable
- name: Build gap-web-ui
run: |
yarn workspace gap-web-ui build
- name: Build application
run: |
yarn workspace admin build
- name: Lint files
run: |
yarn workspace admin lint
- name: Units tests
run: |
yarn workspace admin coverage
- name: Gap-web-ui units tests
run: |
yarn workspace gap-web-ui coverage
imageBuild:
needs: build

environment: AWS
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
# Fetch all commits since we use the total commit count to determine the build version
fetch-depth: 0

- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Determine & set BUILD_VERSION
run: |
GIT_COUNT=$(git rev-list $GITHUB_SHA --count)
echo "BUILD_VERSION=b_$GIT_COUNT" >> $GITHUB_ENV
echo BUILD_VERSION is ${{ env.BUILD_VERSION }}
- name: Build, tag and push Docker image to AWS ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build --build-arg APP_NAME=admin -t $ECR_REGISTRY/gap-apply-admin-web:${{ env.BUILD_VERSION }} .
docker push $ECR_REGISTRY/gap-apply-admin-web:${{ env.BUILD_VERSION }}
- name: Create env tag
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
ENV_TAG=${{ (github.ref == 'refs/heads/develop' && 'develop') || (startsWith(github.ref, 'refs/heads/release') && 'qa') }}
docker tag $ECR_REGISTRY/gap-apply-admin-web:${{ env.BUILD_VERSION }} $ECR_REGISTRY/gap-apply-admin-web:$ENV_TAG
docker push $ECR_REGISTRY/gap-apply-admin-web:$ENV_TAG
- name: Create release tag - if we are committing to a release branch
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
RELEASE_VERSION=V_${GITHUB_REF##*/}
docker tag $ECR_REGISTRY/gap-apply-admin-web:${{ env.BUILD_VERSION }} $ECR_REGISTRY/gap-apply-admin-web:$RELEASE_VERSION
docker push $ECR_REGISTRY/gap-apply-admin-web:$RELEASE_VERSION
58 changes: 58 additions & 0 deletions .github/workflows/applicant-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Applicant CI

on:
pull_request:
branches:
- develop
paths:
- "packages/applicant/**"
- ".github/workflows/applicant-feature.yml"
- "package.json"
- "yarn.lock"

jobs:
build:
name: Test app

runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Generate .env files
run: |
cp packages/applicant/.env.example packages/applicant/.env
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: 'yarn'

- name: Install dependencies
run: |
yarn install --immutable
- name: Lint files
run: |
yarn workspace applicant lint
- name: Build application
run: |
yarn workspace gap-web-ui build
- name: Units Tests
run: |
yarn workspace applicant coverage
- name: Build application
run: |
yarn workspace applicant build
38 changes: 38 additions & 0 deletions .github/workflows/applicant-promoteToProd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Applicant Promote to Prod Workflow

on:
push:
branches:
- main
paths:
- "packages/applicant/**"
- "packages/gap-web-ui/**"
- ".github/workflows/applicant-promoteToProd.yml"
- "package.json"
- "yarn.lock"

env:
AWS_REGION: eu-west-2

jobs:
promoteToProd:
environment: AWS
runs-on: ubuntu-latest

steps:
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Add prod tag to existing qa image
# Based on steps described here - https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-retag.html
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name gap-apply-applicant-web --image-ids imageTag=qa --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name gap-apply-applicant-web --image-tag prod --image-manifest "$MANIFEST"
Loading

0 comments on commit 217bdf8

Please sign in to comment.