Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
robk-dluhc committed Feb 9, 2024
1 parent 727084f commit 36d7435
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 99 deletions.
129 changes: 50 additions & 79 deletions .github/workflows/just-run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,55 @@
name: Just Run Tests
name: List running service versions on ${{ inputs.environment }}

on:
# Only runs manually
workflow_dispatch:
inputs:
dev:
required: false
default: false
type: boolean
test:
required: false
default: false
type: boolean
uat:
required: false
default: false
type: boolean
run_performance_tests:
required: false
default: false
type: boolean
description: Run performance tests
run_e2e_tests_application:
required: false
default: true
type: boolean
description: Run e2e tests (application)
run_e2e_tests_assessment:
required: false
default: true
type: boolean
description: Run e2e tests (assessment)
environment:
description: Which AWS Account to use
type: choice
required: true
options:
- dev
- test
- uat
- prod

jobs:
run_shared_tests_dev:
if: ${{ always() && inputs.dev == true }}
uses: ./.github/workflows/run-shared-tests.yml
with:
perf_test_target_url_application_store: http://fsd-application-store:8080
perf_test_target_url_fund_store: https://fsd-fund-store:8080
perf_test_target_url_assessment_store: https://fsd-assessment-store:8080
e2e_tests_target_url_frontend: https://frontend.dev.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_authenticator: https://authenticator.dev.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_form_runner: https://forms.dev.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_assessment: https://assessment.dev.access-funding.test.levellingup.gov.uk
run_performance_tests: ${{inputs.run_performance_tests}}
run_e2e_tests_application: ${{inputs.run_e2e_tests_application}}
run_e2e_tests_assessment: ${{inputs.run_e2e_tests_assessment}}
secrets:
FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
list-versions:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Git clone the repository
uses: actions/checkout@v4

- name: Get current date
shell: bash
id: currentdatetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy
role-session-name: "${{ inputs.app_name }}_${{ inputs.environemnt }}_copilot_${{ steps.currentdatetime.outputs.datetime }}"
aws-region: eu-west-2

- name: Install AWS Copilot CLI
shell: bash
run: |
curl -Lo aws-copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x aws-copilot && sudo mv aws-copilot /usr/local/bin/copilot
- name: confirm copilot env
shell: bash
run: |
if [ $(copilot env ls) != "${{ inputs.environment }}" ]; then
echo $(copilot env ls)
exit 1
fi
run_shared_tests_test:
if: ${{ always() && inputs.test == true }}
uses: ./.github/workflows/run-shared-tests.yml
with:
perf_test_target_url_application_store: http://fsd-application-store:8080
perf_test_target_url_fund_store: https://fsd-fund-store:8080
perf_test_target_url_assessment_store: https://fsd-assessment-store:8080
e2e_tests_target_url_frontend: https://frontend.test.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_authenticator: https://authenticator.test.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_form_runner: https://forms.test.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_assessment: https://assessment.test.access-funding.test.levellingup.gov.uk
run_performance_tests: ${{inputs.run_performance_tests}}
run_e2e_tests_application: ${{inputs.run_e2e_tests_application}}
run_e2e_tests_assessment: ${{inputs.run_e2e_tests_assessment}}
secrets:
FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
run_shared_tests_uat:
if: ${{ always() && inputs.uat == true }}
uses: ./.github/workflows/run-shared-tests.yml
with:
perf_test_target_url_application_store: http://fsd-application-store:8080
perf_test_target_url_fund_store: https://fsd-fund-store:8080
perf_test_target_url_assessment_store: https://fsd-assessment-store:8080
e2e_tests_target_url_frontend: https://frontend.uat.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_authenticator: https://authenticator.uat.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_form_runner: https://forms.uat.access-funding.test.levellingup.gov.uk
e2e_tests_target_url_assessment: https://assessment.uat.access-funding.test.levellingup.gov.uk
run_performance_tests: ${{inputs.run_performance_tests}}
run_e2e_tests_application: ${{inputs.run_e2e_tests_application}}
run_e2e_tests_assessment: ${{inputs.run_e2e_tests_assessment}}
secrets:
FSD_GH_APP_ID: ${{ secrets.FSD_GH_APP_ID }}
FSD_GH_APP_KEY: ${{ secrets.FSD_GH_APP_KEY }}
- name: List running versions
run: |
scripts/list-versions.sh
9 changes: 3 additions & 6 deletions .github/workflows/list-versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: List running service versions on ${{ inputs.environment }}

on:
# Only runs manually
workflow_dispatch:
Expand Down Expand Up @@ -50,9 +52,4 @@ jobs:
- name: List running versions
run: |
cd apps/pre-award
copilot svc ls --json | yq -r '.services[] | select(.app=="pre-award").name' | grep -v exit | while read svc
do
sha=$(copilot svc show -n $svc --json | yq -r '.variables[] | select(.name=="GITHUB_SHA").value')
printf "%22s %s\n" $svc $sha
done
scripts/list-versions.sh
49 changes: 35 additions & 14 deletions .github/workflows/standard-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
name: List running service versions on ${{ inputs.environment }}

on:
# Only runs manually
workflow_dispatch:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_call:
inputs:
app_name:
required: false
type: string
environment:
description: Which AWS Account to use
type: choice
required: true
options:
- dev
- test
- uat
- prod
type: string
version:
required: true
type: string
db_name:
required: false
type: string
default: ''
secrets:
AWS_ACCOUNT:
required: true

jobs:
list-versions:
deploy:
concurrency:
group: 'fsd-preaward-${{ inputs.environment }}'
cancel-in-progress: false
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
Expand Down Expand Up @@ -50,6 +58,19 @@ jobs:
exit 1
fi
- name: List running versions
- name: Inject Git SHA into manifest
run: |
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/fsd-${{ inputs.app_name }}/manifest.yml
- name: Inject replacement image into manifest
run: |
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-${{ inputs.app_name }}:${{ inputs.version }}"' copilot/fsd-${{ inputs.app_name }}/manifest.yml
- name: Run database migrations
if: ${{ inputs.db_name != '' }}
run: scripts/migration-task-script.py ${{ inputs.environment }} ${{ inputs.db_name }}

- name: Copilot ${{ inputs.environment }} deploy
id: deploy_build
run: |
scripts/list-versions.sh
copilot svc deploy --env ${{ inputs.environment }} --app pre-award

0 comments on commit 36d7435

Please sign in to comment.