Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/cicd-12-run-snapshot-tests-for-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
test_app_url: ${{ steps.variables.outputs.test_app_url }}
environment:
name: "preprod"
steps:
- name: "Set CI/CD variables"
id: variables
shell: bash
run: |
echo "nodejs_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
- name: "List variables"
run: |
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
make list-variables
if [[ "${{ inputs.release_tag }}" == v1.0.* ]]; then
TEST_APP_URL=${{ vars.TEST_APP_URL_R1 }}
else
TEST_APP_URL=${{ vars.TEST_APP_URL_MAIN }}
fi
echo "test_app_url=$TEST_APP_URL" | tee -a $GITHUB_OUTPUT

run-snapshot-tests:
name: "Snapshot tests"
Expand All @@ -48,16 +52,8 @@ jobs:
name: "preprod"

steps:
- name: "Checkout code"
- name: "Checkout code for metadata"
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: "refs/tags/${{ inputs.release_tag }}"

- name: "Setup nodejs ${{ needs.metadata.outputs.nodejs_version }}"
uses: actions/setup-node@v6
with:
node-version: ${{ needs.metadata.outputs.nodejs_version }}

- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v5
Expand All @@ -74,7 +70,7 @@ jobs:
APP_VERSION=$(aws lambda get-function-configuration --function-name gh-vita-${{ secrets.AWS_ACCOUNT_ID }}-server-function | jq -r '.Environment.Variables.APP_VERSION')
echo "value=$APP_VERSION" | tee -a $GITHUB_OUTPUT

- name: "Check deployed version is from main branch"
- name: "Check deployed version is expected tag"
shell: bash
run: |
if [[ "${{ steps.deployed-version-tag.outputs.value }}" != "${{ inputs.release_tag }}" ]]; then
Expand All @@ -92,6 +88,6 @@ jobs:
TEST_NHS_APP_URL: ${{ secrets.TEST_NHS_APP_URL }}
TEST_NHS_LOGIN_PASSWORD: ${{ secrets.TEST_NHS_LOGIN_PASSWORD }}
TEST_NHS_LOGIN_OTP: ${{ secrets.TEST_NHS_LOGIN_OTP }}
TEST_APP_URL: ${{ vars.TEST_APP_URL_MAIN }}
TEST_APP_URL: ${{ needs.metadata.outputs.test_app_url }}
VITA_TEST_USER_PATTERN: ${{ secrets.VITA_TEST_USER_PATTERN }}
AWS_S3_ARTEFACTS_BUCKET: vita-${{ secrets.AWS_ACCOUNT_ID }}-artefacts-preprod
Loading