NBS scheduled assurance #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "NBS scheduled assurance" | |
| on: | |
| schedule: | |
| - cron: '50 6 * * MON-FRI' # Aiming to run between 7:00-7:30 UTC, compensating for GithubActions cron delays | |
| workflow_dispatch: {} | |
| jobs: | |
| metadata: | |
| name: "Set CI/CD metadata" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| outputs: | |
| nodejs_version: ${{ steps.variables.outputs.nodejs_version }} | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v6 | |
| - name: "Set CI/CD variables" | |
| id: variables | |
| run: | | |
| echo "nodejs_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT | |
| run-elid-api-tests: | |
| # Only call the tests for preprod environment | |
| # - ensures EliD's database is loaded with expected test scenarios | |
| # - ensures E2E tests aren't unnecessarily run if these tests fail | |
| name: "EliD API tests (preprod)" | |
| concurrency: | |
| group: "preprod-env" | |
| cancel-in-progress: false | |
| uses: NHSDigital/eligibility-signposting-api-regression-tests/.github/workflows/my-vaccs-int-tests.yml@main | |
| secrets: | |
| ELID_PREPROD_AWS_ACCOUNT_ID: ${{ secrets.ELID_PREPROD_AWS_ACCOUNT_ID }} | |
| ################################################################# | |
| # Main branch deployment and assurance (e2e+snapshots+contract) | |
| ################################################################# | |
| run-nbs-tests-main: | |
| name: "NBS Assurance Main Branch" | |
| runs-on: "ubuntu-latest" | |
| timeout-minutes: 30 | |
| concurrency: | |
| group: "preprod-env" | |
| cancel-in-progress: false | |
| permissions: | |
| id-token: write | |
| contents: read | |
| environment: | |
| name: "preprod" | |
| needs: [ metadata, run-elid-api-tests ] | |
| if: ${{ !cancelled() }} | |
| steps: | |
| - name: "Checkout main branch" | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: "main" | |
| - name: "Get latest tag name on main branch" | |
| id: get-latest-tag-name | |
| run: | | |
| echo "value=$(git describe --tags --abbrev=0 --first-parent)" | tee -a $GITHUB_OUTPUT | |
| echo "Latest tag name on main branch is : ${value}" | |
| - name: "Checkout code" | |
| uses: actions/checkout@v6 | |
| - name: "Setup nodejs ${{ needs.metadata.outputs.nodejs_version }}" | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ needs.metadata.outputs.nodejs_version }} | |
| - name: "Deploy version ${{ steps.get-latest-tag-name.outputs.value }} to (preprod)" | |
| timeout-minutes: 10 | |
| uses: ./.github/actions/deploy | |
| with: | |
| environment: "preprod" | |
| tag_or_sha_to_deploy: ${{ steps.get-latest-tag-name.outputs.value }} | |
| secret_aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }} | |
| secret_aws_iam_role: ${{ secrets.IAM_ROLE }} | |
| secret_aws_slack_channel_id: ${{ secrets.ALARMS_SLACK_CHANNEL_ID }} | |
| - name: "Run NBS E2E tests on ${{ steps.get-latest-tag-name.outputs.value }} (preprod)" | |
| timeout-minutes: 20 | |
| uses: ./.github/actions/run-nbs-e2e-tests | |
| with: | |
| checkout_ref: ${{ steps.get-latest-tag-name.outputs.value }} | |
| env: | |
| 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_NBS_APP_USERNAME: ${{ secrets.TEST_NBS_APP_USERNAME }} | |
| TEST_NBS_APP_PASSWORD: ${{ secrets.TEST_NBS_APP_PASSWORD }} | |
| TEST_APP_URL: ${{ vars.TEST_APP_URL_MAIN }} | |
| NHS_APP_REDIRECT_LOGIN_URL: ${{ secrets.NHS_APP_REDIRECT_LOGIN_URL }} | |
| VITA_TEST_USER_PATTERN: ${{ secrets.VITA_TEST_USER_PATTERN }} | |
| DEPLOY_ENVIRONMENT: "preprod" |