From 0526888300aaa3f0dd46715395b3a3257c9d0ab5 Mon Sep 17 00:00:00 2001 From: "Karol C. Gancarz" Date: Wed, 29 Nov 2023 11:17:15 +0000 Subject: [PATCH] WIP test artifact and S3 prefix --- .github/workflows/deploy-branch.yml | 5 ++- .../workflows/pre-merge-integration-test.yml | 44 ++++++++++++++++--- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-branch.yml b/.github/workflows/deploy-branch.yml index d93f1dba..8656eba5 100644 --- a/.github/workflows/deploy-branch.yml +++ b/.github/workflows/deploy-branch.yml @@ -48,15 +48,16 @@ jobs: url: ${{ steps.deploy.outputs.stack-url }} steps: - name: Deploy stack - uses: govuk-one-login/github-actions/sam/deploy-stack@b2b6fc5df355031fd08cef37fa13a93670a45899 + uses: govuk-one-login/github-actions/sam/deploy-stack@bau-sam-deploy-stack-artifact-path id: deploy with: aws-role-arn: ${{ secrets.DEV_PRE_MERGE_GH_ACTIONS_ROLE_ARN }} sam-deployment-bucket: ${{ secrets.DEV_PRE_MERGE_ARTIFACT_SOURCE_BUCKET_NAME }} artifact-name: ${{ needs.build.outputs.artifact-name }} + artifact-path: .aws-sam/build stack-name-prefix: preview-pdv-matching - delete-failed-stack: true s3-prefix: pdv-preview + delete-failed-stack: true pull-repository: true tags: | cri:component=check-hmrc-api diff --git a/.github/workflows/pre-merge-integration-test.yml b/.github/workflows/pre-merge-integration-test.yml index c5b61228..d7701de8 100644 --- a/.github/workflows/pre-merge-integration-test.yml +++ b/.github/workflows/pre-merge-integration-test.yml @@ -9,7 +9,24 @@ defaults: working-directory: integration-tests jobs: - test: + mocked-tests: + runs-on: ubuntu-latest + steps: + - name: Pull repository + uses: actions/checkout@v3 + + - name: Install Node + uses: actions/setup-node@v3 + with: + cache: npm + + - name: Install dependencies + run: npm ci --include-workspace-root + + - name: Run mocked tests + run: npm run test:mocked -- --config jest.config.ci.ts + + aws-test: runs-on: ubuntu-latest timeout-minutes: 15 env: @@ -20,10 +37,28 @@ jobs: id-token: write contents: read steps: - - name: Checkout code + - name: Build SAM application + uses: govuk-one-login/github-actions/sam/build-application@b2b6fc5df355031fd08cef37fa13a93670a45899 + with: + template: infrastructure/template.yaml + pull-repository: true + cache-key: int-tests + + - name: Deploy test stack + uses: govuk-one-login/github-actions/sam/deploy-stack@b2b6fc5df355031fd08cef37fa13a93670a45899 + with: + aws-role-arn: ${{ secrets.DEV_PRE_MERGE_GH_ACTIONS_ROLE_ARN }} + sam-deployment-bucket: ${{ secrets.DEV_PRE_MERGE_ARTIFACT_SOURCE_BUCKET_NAME }} + stack-name-prefix: preview-pdv-matching + delete-failed-stack: true + s3-prefix: pdv-preview + tags: + + + - name: Pull repository uses: actions/checkout@v3 - - name: Setup Node.js + - name: Install Node uses: actions/setup-node@v3 with: cache: npm @@ -31,9 +66,6 @@ jobs: - name: Install dependencies run: npm ci --include-workspace-root - - name: Run mocked tests - run: npm run test:mocked -- --config jest.config.ci.ts - - name: Assume temporary AWS role uses: aws-actions/configure-aws-credentials@v4 with: