diff --git a/.github/workflows/build-production-deploy-s3.yml b/.github/workflows/build-production-deploy-s3.yml index 6e42127d..821e3f25 100644 --- a/.github/workflows/build-production-deploy-s3.yml +++ b/.github/workflows/build-production-deploy-s3.yml @@ -4,6 +4,22 @@ on: branches: - main jobs: + trigger-cypress-tests: + uses: ./.github/workflows/run-cypress-tests.yml + with: + environment: 'production' + grep: '' + grepTags: '@essential' + CYPRESS_ADMIN_EN_EMAIL: ${{ vars.CYPRESS_ADMIN_EN_EMAIL }} + CYPRESS_ADMIN_FR_EMAIL: ${{ vars.CYPRESS_ADMIN_FR_EMAIL }} + CYPRESS_GUEST_EN_EMAIL: ${{ vars.CYPRESS_GUEST_EN_EMAIL }} + CYPRESS_GUEST_FR_EMAIL: ${{ vars.CYPRESS_GUEST_FR_EMAIL }} + secrets: + DOCKER_PAT: ${{ secrets.DOCKER_PAT }} + CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + build-and-deploy: env: AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} diff --git a/.github/workflows/build-staging-deploy-s3.yml b/.github/workflows/build-staging-deploy-s3.yml index 44a9562a..abfe5247 100644 --- a/.github/workflows/build-staging-deploy-s3.yml +++ b/.github/workflows/build-staging-deploy-s3.yml @@ -4,7 +4,24 @@ on: branches: - develop jobs: + trigger-cypress-tests: + uses: ./.github/workflows/run-cypress-tests.yml + with: + environment: 'staging' + grep: '' + grepTags: '@general' + CYPRESS_ADMIN_EN_EMAIL: ${{ vars.CYPRESS_ADMIN_EN_EMAIL }} + CYPRESS_ADMIN_FR_EMAIL: ${{ vars.CYPRESS_ADMIN_FR_EMAIL }} + CYPRESS_GUEST_EN_EMAIL: ${{ vars.CYPRESS_GUEST_EN_EMAIL }} + CYPRESS_GUEST_FR_EMAIL: ${{ vars.CYPRESS_GUEST_FR_EMAIL }} + secrets: + DOCKER_PAT: ${{ secrets.DOCKER_PAT }} + CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} + S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + build-and-deploy: + needs: trigger-cypress-tests env: AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/run-cypress-tests-develop.yml b/.github/workflows/run-cypress-tests-develop.yml deleted file mode 100644 index 4fc76f97..00000000 --- a/.github/workflows/run-cypress-tests-develop.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Trigger Cypress Tests on Develop Branch - -on: - pull_request: - branches: - - develop - workflow_dispatch: - -jobs: - trigger-end-to-end-tests: - uses: ./.github/workflows/run-cypress-tests.yml - with: - environment: 'staging' - grep: '' - grepTags: '@general' - secrets: - DOCKER_PAT: ${{ secrets.DOCKER_PAT }} - CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} - S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} - S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/run-cypress-tests-main.yml b/.github/workflows/run-cypress-tests-main.yml deleted file mode 100644 index 0813cd56..00000000 --- a/.github/workflows/run-cypress-tests-main.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Trigger Cypress Tests on Main Branch - -on: - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - trigger-end-to-end-tests: - uses: ./.github/workflows/run-cypress-tests.yml - with: - environment: 'production' - grep: '' - grepTags: '@essential' - secrets: - DOCKER_PAT: ${{ secrets.DOCKER_PAT }} - CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} - S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} - S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/run-cypress-tests.yml b/.github/workflows/run-cypress-tests.yml index 03e7e5f7..85afef7e 100644 --- a/.github/workflows/run-cypress-tests.yml +++ b/.github/workflows/run-cypress-tests.yml @@ -15,6 +15,22 @@ on: description: 'Grep tags for selecting tests' required: false default: '@essential' + CYPRESS_ADMIN_EN_EMAIL: + description: 'Admin email for English tests' + required: true + type: string + CYPRESS_ADMIN_FR_EMAIL: + description: 'Admin email for French tests' + required: true + type: string + CYPRESS_GUEST_EN_EMAIL: + description: 'Guest email for English tests' + required: true + type: string + CYPRESS_GUEST_FR_EMAIL: + description: 'Guest email for French tests' + required: true + type: string workflow_call: inputs: @@ -31,6 +47,22 @@ on: required: false type: string default: '@essential' + CYPRESS_ADMIN_EN_EMAIL: + description: 'Admin email for English tests' + required: true + type: string + CYPRESS_ADMIN_FR_EMAIL: + description: 'Admin email for French tests' + required: true + type: string + CYPRESS_GUEST_EN_EMAIL: + description: 'Guest email for English tests' + required: true + type: string + CYPRESS_GUEST_FR_EMAIL: + description: 'Guest email for French tests' + required: true + type: string secrets: DOCKER_PAT: @@ -150,31 +182,6 @@ jobs: run: | base_url="http://test.footlight.app:3000/" - - # grep_value="${{ inputs.grep }}" - # echo "Original grep_value: '$grep_value'" - # grep_value_clean=$(echo "$grep_value" | tr -d '\n\r') - # echo "Cleaned grep_value: '$grep_value_clean'" - - # if [ -z "$grep_value_clean" ]; then - # grep_value_json='""' - # else - # grep_value_json=$(printf '%s' "$grep_value_clean" | sed 's/"/\\"/g; s/.*/"&"/') - # fi - - # echo "JSON grep_value: '$grep_value_json'" - - # # Properly format the --env argument for Cypress - # env_json="{\"grepTags\":\"${{ inputs.grepTags }}\",\"grep\":${grep_value_json}}" - # echo "Formatted env JSON: $env_json" - - # # Simulate the Cypress --env argument - # env_arg=$(printf '%s' "$env_json") - # echo "Simulated --env argument for Cypress: $env_arg" - - # # Validate JSON formatting - # echo "$env_json" | jq . # Validate JSON formatting - # Run Cypress tests with the formatted --env argument docker run \ @@ -182,10 +189,10 @@ jobs: -e DEBUG="" \ -e XDG_RUNTIME_DIR=/tmp/runtime \ -e CYPRESS_BASE_URL=$base_url \ - -e CYPRESS_ADMIN_EN_EMAIL="${{ vars.CYPRESS_ADMIN_EN_EMAIL }}" \ - -e CYPRESS_ADMIN_FR_EMAIL="${{ vars.CYPRESS_ADMIN_FR_EMAIL }}" \ - -e CYPRESS_GUEST_EN_EMAIL="${{ vars.CYPRESS_GUEST_EN_EMAIL }}" \ - -e CYPRESS_GUEST_FR_EMAIL="${{ vars.CYPRESS_GUEST_FR_EMAIL }}" \ + -e CYPRESS_ADMIN_EN_EMAIL="${{ inputs.CYPRESS_ADMIN_EN_EMAIL }}" \ + -e CYPRESS_ADMIN_FR_EMAIL="${{ inputs.CYPRESS_ADMIN_FR_EMAIL }}" \ + -e CYPRESS_GUEST_EN_EMAIL="${{ inputs.CYPRESS_GUEST_EN_EMAIL }}" \ + -e CYPRESS_GUEST_FR_EMAIL="${{ inputs.CYPRESS_GUEST_FR_EMAIL }}" \ -e CYPRESS_ADMIN_EN_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \ -e CYPRESS_ADMIN_FR_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \ -e CYPRESS_GUEST_EN_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \