Skip to content

Build & Unit Test

Build & Unit Test #284

name: Deploy to AWS
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Deploy to {0}', github.event.inputs.environment) || (github.ref == 'refs/heads/main' && 'Deploy to Test-UAT-Prod' || 'Build & Unit Test') }}
on:
workflow_dispatch:
inputs:
environment:
description: Which AWS Account to use
type: choice
required: true
options:
- dev
- test
- uat
push:
# Ignore README markdown and the docs folder
# Only automatically deploy when something in the app or tests folder has changed
paths:
- '!**/README.md'
- '!docs/**'
- 'app/**'
- 'config/**'
- 'tests/**'
- 'requirements-dev.in'
- 'requirements-dev.txt'
- 'requirements.in'
- 'requirements.txt'
jobs:
setup:
uses: communitiesuk/funding-service-design-workflows/.github/workflows/determine-jobs.yml@main
with:
environment: ${{ inputs.environment }}
pre_deploy_tests:
uses: communitiesuk/funding-service-design-workflows/.github/workflows/pre-deploy.yml@main
with:
postgres_unit_testing: true
db_name: fab_unit_test
paketo_build:
needs: [ setup ]
permissions:
packages: write
uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main
with:
version_to_build: sha-${{ github.sha }}
owner: ${{ github.repository_owner }}
application: funding-service-design-fund-application-builder
assets_required: true
dev_deploy:
needs: [ pre_deploy_tests, paketo_build, setup ]
if: ${{ contains(fromJSON(needs.setup.outputs.jobs_to_run), 'dev') }}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
with:
environment: dev
app_name: fund-application-builder
version: sha-${{ github.sha }}
db_name: fsd-fund-application-builder
# post_dev_deploy_tests:
# needs: dev_deploy
# concurrency:
# group: 'fsd-preaward-dev'
# cancel-in-progress: false
# secrets:
# FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
# FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
# uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
# with:
# run_performance_tests: ${{ inputs.run_performance_tests || true }}
# run_e2e_tests_assessment: ${{ inputs.run_e2e_tests_assessment || false }}
# run_e2e_tests_application: ${{ inputs.run_e2e_tests_application || false }}
# app_name: fund-application-builder
# environment: dev
test_deploy:
needs: [ dev_deploy, paketo_build, setup ]
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'test') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') )}}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
with:
environment: test
app_name: fund-application-builder
version: sha-${{ github.sha }}
db_name: fsd-fund-application-builder
# post_test_deploy_tests:
# needs: test_deploy
# if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'test') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') )}}
# concurrency:
# group: 'fsd-preaward-test'
# cancel-in-progress: false
# secrets:
# FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
# FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
# uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
# with:
# run_performance_tests: ${{ inputs.run_performance_tests || false }}
# run_e2e_tests_assessment: ${{ inputs.run_e2e_tests_assessment || false }}
# run_e2e_tests_application: ${{ inputs.run_e2e_tests_application || true }}
# app_name: fund-application-builder
# environment: test
uat_deploy:
needs: [ dev_deploy, test_deploy, paketo_build, setup ]
if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'uat') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') )}}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
with:
environment: uat
app_name: fund-application-builder
version: sha-${{ github.sha }}
db_name: fsd-fund-application-builder
# post_uat_deploy_tests:
# needs: uat_deploy
# if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'uat') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') )}}
# concurrency:
# group: 'fsd-preaward-uat'
# cancel-in-progress: false
# secrets:
# FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
# FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
# uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
# with:
# run_performance_tests: ${{ inputs.run_performance_tests || false }}
# run_e2e_tests_assessment: ${{ inputs.run_e2e_tests_assessment || false }}
# run_e2e_tests_application: ${{ inputs.run_e2e_tests_application || true }}
# app_name: fund-application-builder
# environment: uat
# prod_deploy:
# needs: [ dev_deploy, post_dev_deploy_tests, test_deploy, post_test_deploy_tests, uat_deploy, post_uat_deploy_tests, paketo_build, setup ]
# if: ${{ always() && contains(fromJSON(needs.setup.outputs.jobs_to_run), 'prod') && (! contains(needs.*.result, 'failure') ) && (! contains(needs.*.result, 'cancelled') )}}
# uses: communitiesuk/funding-service-design-workflows/.github/workflows/standard-deploy.yml@main
# secrets:
# AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
# with:
# environment: prod
# app_name: fund-application-builder
# version: sha-${{ github.sha }}
# db_name: fsd-fund-application-builder