Skip to content

Commit

Permalink
BAU: Use the latest shared GitHub Actions
Browse files Browse the repository at this point in the history
Use the SAM build cache instead of the artifact to improve performance.

Only archive SonarCloud test coverage report file

Add a deploy script to integration-tests
  • Loading branch information
CharlesIC committed Dec 14, 2023
1 parent 06b468e commit 5a9cbc9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
cancel-in-progress: true
steps:
- name: Run pre-commit
uses: govuk-one-login/github-actions/code-quality/run-pre-commit@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/code-quality/run-pre-commit@cd7d35dde348251237efbbaee5345e95adef0321
with:
all-files: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clean-up-deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
aws-region: eu-west-2

- name: Get stale preview stacks
uses: govuk-one-login/github-actions/sam/get-stale-stacks@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/sam/get-stale-stacks@cd7d35dde348251237efbbaee5345e95adef0321
with:
threshold-days: 14
stack-name-filter: preview-kbv-hmrc-api
Expand All @@ -38,7 +38,7 @@ jobs:

- name: Delete stacks
if: ${{ env.STACKS != null }}
uses: govuk-one-login/github-actions/sam/delete-stacks@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/sam/delete-stacks@cd7d35dde348251237efbbaee5345e95adef0321
with:
stack-names: ${{ env.STACKS }}
verbose: true
4 changes: 2 additions & 2 deletions .github/workflows/delete-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Get stack name
uses: govuk-one-login/github-actions/beautify-branch-name@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/beautify-branch-name@cd7d35dde348251237efbbaee5345e95adef0321
id: get-stack-name
with:
usage: Stack name
Expand All @@ -29,7 +29,7 @@ jobs:
verbose: false

- name: Delete stack
uses: govuk-one-login/github-actions/sam/delete-stacks@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/sam/delete-stacks@cd7d35dde348251237efbbaee5345e95adef0321
with:
stack-names: ${{ steps.get-stack-name.outputs.pretty-branch-name }}
aws-role-arn: ${{ vars.DEPLOYMENT_ROLE_ARN }}
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/deploy-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ jobs:
name: Build SAM app
runs-on: ubuntu-latest
permissions: {}
outputs:
artifact-name: ${{ steps.build.outputs.artifact-name }}
steps:
- name: Build SAM application
uses: govuk-one-login/github-actions/sam/build-application@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/sam/build-application@cd7d35dde348251237efbbaee5345e95adef0321
id: build
with:
template: infrastructure/template.yaml
artifact-name: kbv-hmrc-api
cache-key: kbv-hmrc-api
pull-repository: true

Expand All @@ -47,17 +44,16 @@ jobs:
stack-name: ${{ steps.deploy.outputs.stack-name }}
steps:
- name: Deploy stack
uses: govuk-one-login/github-actions/sam/deploy-stack@d233e5a687f5c816b19bb25991d5709658b29ebc
uses: govuk-one-login/github-actions/sam/deploy-stack@cd7d35dde348251237efbbaee5345e95adef0321
id: deploy
with:
sam-deployment-bucket: ${{ vars.DEPLOYMENT_ARTIFACTS_BUCKET }}
aws-role-arn: ${{ vars.DEPLOYMENT_ROLE_ARN }}
stack-name-prefix: preview-kbv-hmrc-api
cache-key: kbv-hmrc-api
s3-prefix: preview
pull-repository: true
delete-failed-stack: true
artifact-path: .aws-sam/build
artifact-name: ${{ needs.build.outputs.artifact-name }}
tags: |
cri:component=ipv-cri-kbv-hmrc-api
cri:stack-type=preview
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
with:
name: ${{ inputs.coverage-artifact }}
retention-days: 3
path: coverage
path: coverage/lcov.info
8 changes: 4 additions & 4 deletions .github/workflows/scan-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
needs: unit-tests
runs-on: ubuntu-latest
steps:
- name: Run a SonarCloud scan
uses: govuk-one-login/github-actions/code-quality/sonarcloud@d233e5a687f5c816b19bb25991d5709658b29ebc
- name: Run SonarCloud scan
uses: govuk-one-login/github-actions/code-quality/sonarcloud@cd7d35dde348251237efbbaee5345e95adef0321
with:
coverage-artifact: ${{ needs.unit-tests.outputs.coverage-artifact }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,7 +39,7 @@ jobs:
permissions:
security-events: write
steps:
- name: Run a CodeQL scan
uses: govuk-one-login/github-actions/code-quality/codeql@d233e5a687f5c816b19bb25991d5709658b29ebc
- name: Run CodeQL scan
uses: govuk-one-login/github-actions/code-quality/codeql@cd7d35dde348251237efbbaee5345e95adef0321
with:
languages: javascript-typescript
1 change: 1 addition & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:all": "npm run unit:all --",
"test:aws": "npm run unit:aws --",
"test:mocked": "npm run unit:mocked --",
"deploy": "../deploy.sh",
"compile": "tsc"
},
"author": "alphagov",
Expand Down

0 comments on commit 5a9cbc9

Please sign in to comment.