diff --git a/.github/workflows/automatic-trigger.yml b/.github/workflows/automatic-trigger.yml index 065eff9a..dc92f89e 100644 --- a/.github/workflows/automatic-trigger.yml +++ b/.github/workflows/automatic-trigger.yml @@ -14,60 +14,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Clean up previous report - uses: cypress-io/github-action@v5 - with: - command: npm run pretest - - - name: Cypress run - uses: cypress-io/github-action@v5 - env: - CYPRESS_BRB: ${{ secrets.CYPRESS_BRB }} - CYPRESS_NBC: ${{ secrets.CYPRESS_NBC }} - CYPRESS_DEFAULT: ${{ secrets.CYPRESS_DEFAULT }} - CYPRESS_TEACHER_1_EMAIL: ${{ secrets.CYPRESS_TEACHER_1_EMAIL }} - CYPRESS_TEACHER_1_PASSWORD: ${{ secrets.CYPRESS_TEACHER_1_PASSWORD }} - CYPRESS_TEACHER_2_EMAIL: ${{ secrets.CYPRESS_TEACHER_2_EMAIL }} - CYPRESS_TEACHER_2_PASSWORD: ${{ secrets.CYPRESS_TEACHER_2_PASSWORD }} - CYPRESS_STUDENT_1_EMAIL: ${{ secrets.CYPRESS_STUDENT_1_EMAIL }} - CYPRESS_STUDENT_1_PASSWORD: ${{ secrets.CYPRESS_STUDENT_1_PASSWORD }} - CYPRESS_STUDENT_2_EMAIL: ${{ secrets.CYPRESS_STUDENT_2_EMAIL }} - CYPRESS_STUDENT_2_PASSWORD: ${{ secrets.CYPRESS_STUDENT_2_PASSWORD }} - CYPRESS_ADMIN_1_EMAIL: ${{ secrets.CYPRESS_ADMIN_1_EMAIL }} - CYPRESS_ADMIN_1_PASSWORD: ${{ secrets.CYPRESS_ADMIN_1_PASSWORD }} - CYPRESS_EXPERT_1_EMAIL: ${{ secrets.CYPRESS_EXPERT_1_EMAIL }} - CYPRESS_EXPERT_1_PASSWORD: ${{ secrets.CYPRESS_EXPERT_1_PASSWORD }} - CYPRESS_STUDENT_EXTERN: ${{ secrets.CYPRESS_STUDENT_EXTERN }} - CYPRESS_STUDENT_EXTERN_PASSWORD: ${{ secrets.CYPRESS_STUDENT_EXTERN_PASSWORD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL }} - CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD }} - CYPRESS_TEACHER_1_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_1_FIRST_NAME }} - CYPRESS_TEACHER_1_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_1_LAST_NAME }} - CYPRESS_TEACHER_2_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_2_FIRST_NAME }} - CYPRESS_TEACHER_2_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_2_LAST_NAME }} - DEBUG: '@cypress/github-action' - with: - command: npm run tag:stable - browser: chrome - - - name: Generate Report - uses: cypress-io/github-action@v5 - if: always() - with: - command: npm run generate:report - - - name: Upload Report - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-report - path: ${{ github.workspace }}/reports - - - name: Upload Video Artifact - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-video-artifact - path: ${{ github.workspace }}/cypress/videos/ - retention-days: 3 + configuring-loading-secrets-running-tests: + needs: e2e-system-tests + uses: ./.github/workflows/main.yml + secrets: + service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..07a9211b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,158 @@ +name: configure, load secrets, run Cypress tests, generate and upload reports +on: + workflow_call: + secrets: + service-account-token: + required: true + inputs: + cypress_brb: + description: "brb url from remote workflow" + type: string + cypress_nbc: + description: "nbc url from remote workflow" + type: string + cypress_default: + description: "default url from remote workflow" + type: string + +jobs: + configure-load-secrets-and-run_tests: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.setting_url.outputs.TAG }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + repository: hpi-schul-cloud/e2e-system-tests + path: e2e-system-tests + + - name: Configure 1Password Service Account + uses: 1password/load-secrets-action/configure@v1 + with: + service-account-token: ${{ secrets.service-account-token }} + + - name: Setting URL's + id: setting_url + run: | + workflow_name="${{ github.workflow }}" + if [[ $workflow_name == *"manual"* ]]; then + echo "This is a manual workflow" + echo "CYPRESS_BRB=${{ github.event.inputs.instance1 }}" >> $GITHUB_ENV + echo "$CYPRESS_BRB" + echo "CYPRESS_NBC=${{ github.event.inputs.instance2 }}" >> $GITHUB_ENV + echo "$CYPRESS_NBC" + echo "CYPRESS_DEFAULT=${{ github.event.inputs.instance3 }}" >> $GITHUB_ENV + echo "$CYPRESS_DEFAULT" + echo "TAG=tag:stable" >> $GITHUB_OUTPUT + echo "$TAG" + elif [[ $workflow_name == *"automatic"* || $workflow_name == *"scheduled"* ]]; then + echo "This is an automatic or scheduled workflow" + echo "CYPRESS_BRB=op://cy-dev-brb/cypress/CYPRESS_BRB" >> $GITHUB_ENV + echo "$CYPRESS_BRB" + echo "CYPRESS_NBC=op://cy-dev-nbc/cypress/CYPRESS_NBC" >> $GITHUB_ENV + echo "$CYPRESS_NBC" + echo "CYPRESS_DEFAULT=op://cy-dev-dbc/cypress/CYPRESS_DEFAULT" >> $GITHUB_ENV + echo "$CYPRESS_DEFAULT" + echo "TAG=tag:stable" >> $GITHUB_OUTPUT + echo "$TAG" + else + echo "This is an remote workflow" + echo "CYPRESS_BRB=${{ inputs.cypress_brb }}" >> $GITHUB_ENV + echo "$CYPRESS_BRB" + echo "CYPRESS_NBC=${{ inputs.cypress_nbc }}" >> $GITHUB_ENV + echo "$CYPRESS_NBC" + echo "CYPRESS_DEFAULT=${{ inputs.cypress_default }}" >> $GITHUB_ENV + echo "$CYPRESS_DEFAULT" + echo "TAG=tag:stable:pr" >> $GITHUB_OUTPUT + echo "$TAG" + fi + + - name: Load secret + id: op-load-secret + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + CYPRESS_TEACHER_1_EMAIL: op://cy-dev-brb/cypress/CYPRESS_TEACHER_1_EMAIL + CYPRESS_TEACHER_1_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_TEACHER_1_PASSWORD + CYPRESS_TEACHER_2_EMAIL: op://cy-dev-brb/cypress/CYPRESS_TEACHER_2_EMAIL + CYPRESS_TEACHER_2_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_TEACHER_2_PASSWORD + CYPRESS_STUDENT_1_EMAIL: op://cy-dev-brb/cypress/CYPRESS_STUDENT_1_EMAIL + CYPRESS_STUDENT_1_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_STUDENT_1_PASSWORD + CYPRESS_STUDENT_2_EMAIL: op://cy-dev-brb/cypress/CYPRESS_STUDENT_2_EMAIL + CYPRESS_STUDENT_2_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_STUDENT_2_PASSWORD + CYPRESS_ADMIN_1_EMAIL: op://cy-dev-brb/cypress/CYPRESS_ADMIN_1_EMAIL + CYPRESS_ADMIN_1_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_ADMIN_1_PASSWORD + CYPRESS_EXPERT_1_EMAIL: op://cy-dev-brb/cypress/CYPRESS_EXPERT_1_EMAIL + CYPRESS_EXPERT_1_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_EXPERT_1_PASSWORD + CYPRESS_STUDENT_EXTERN: op://cy-dev-brb/cypress/CYPRESS_STUDENT_EXTERN + CYPRESS_STUDENT_EXTERN_PASSWORD: op://cy-dev-brb/cypress/CYPRESS_STUDENT_EXTERN_PASSWORD + CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: op://cy-dev-brb/cypress/CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL + CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: op://cy-dev-brb/cypress/CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD + CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: op://cy-dev-brb/cypress/CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD + CYPRESS_TEACHER_1_FIRST_NAME: op://cy-dev-brb/cypress/CYPRESS_TEACHER_1_FIRST_NAME + CYPRESS_TEACHER_1_LAST_NAME: op://cy-dev-brb/cypress/CYPRESS_TEACHER_1_LAST_NAME + CYPRESS_TEACHER_2_FIRST_NAME: op://cy-dev-brb/cypress/CYPRESS_TEACHER_2_FIRST_NAME + CYPRESS_TEACHER_2_LAST_NAME: op://cy-dev-brb/cypress/CYPRESS_TEACHER_2_LAST_NAME + + - name: Clean up previous report + uses: cypress-io/github-action@v5 + with: + working-directory: e2e-system-tests + command: npm run pretest + + - name: Cypress run + uses: cypress-io/github-action@v5 + with: + working-directory: e2e-system-tests + command: npm run ${{ steps.setting_url.outputs.tag }} + browser: chrome + env: + CYPRESS_BRB: ${{ env.CYPRESS_BRB }} + CYPRESS_NBC: ${{ env.CYPRESS_NBC }} + CYPRESS_DEFAULT: ${{ env.CYPRESS_DEFAULT }} + CYPRESS_TEACHER_1_EMAIL: ${{ env.CYPRESS_TEACHER_1_EMAIL }} + CYPRESS_TEACHER_1_PASSWORD: ${{ env.CYPRESS_TEACHER_1_PASSWORD }} + CYPRESS_TEACHER_2_EMAIL: ${{ env.CYPRESS_TEACHER_2_EMAIL }} + CYPRESS_TEACHER_2_PASSWORD: ${{ env.CYPRESS_TEACHER_2_PASSWORD }} + CYPRESS_STUDENT_1_EMAIL: ${{ env.CYPRESS_STUDENT_1_EMAIL }} + CYPRESS_STUDENT_1_PASSWORD: ${{ env.CYPRESS_STUDENT_1_PASSWORD }} + CYPRESS_STUDENT_2_EMAIL: ${{ env.CYPRESS_STUDENT_2_EMAIL }} + CYPRESS_STUDENT_2_PASSWORD: ${{ env.CYPRESS_STUDENT_2_PASSWORD }} + CYPRESS_ADMIN_1_EMAIL: ${{ env.CYPRESS_ADMIN_1_EMAIL }} + CYPRESS_ADMIN_1_PASSWORD: ${{ env.CYPRESS_ADMIN_1_PASSWORD }} + CYPRESS_EXPERT_1_EMAIL: ${{ env.CYPRESS_EXPERT_1_EMAIL }} + CYPRESS_EXPERT_1_PASSWORD: ${{ env.CYPRESS_EXPERT_1_PASSWORD }} + CYPRESS_STUDENT_EXTERN: ${{ env.CYPRESS_STUDENT_EXTERN }} + CYPRESS_STUDENT_EXTERN_PASSWORD: ${{ env.CYPRESS_STUDENT_EXTERN_PASSWORD }} + CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: ${{ env.CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL }} + CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: ${{ env.CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD }} + CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: ${{ env.CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD }} + CYPRESS_TEACHER_1_FIRST_NAME: ${{ env.CYPRESS_TEACHER_1_FIRST_NAME }} + CYPRESS_TEACHER_1_LAST_NAME: ${{ env.CYPRESS_TEACHER_1_LAST_NAME }} + CYPRESS_TEACHER_2_FIRST_NAME: ${{ env.CYPRESS_TEACHER_2_FIRST_NAME }} + CYPRESS_TEACHER_2_LAST_NAME: ${{ env.CYPRESS_TEACHER_2_LAST_NAME }} + DEBUG: "@cypress/github-action" + + - name: Generate Report + if: always() + working-directory: e2e-system-tests + run: | + npm run generate:report + + - name: Upload Report + uses: actions/upload-artifact@v3 + if: always() + with: + name: my-report + path: ${{ github.workspace }}/e2e-system-tests/reports/ + + - name: Upload Video Artifact + uses: actions/upload-artifact@v3 + if: always() + with: + name: my-video-artifact + path: ${{ github.workspace }}/e2e-system-tests/cypress/videos/ + retention-days: 3 diff --git a/.github/workflows/manual-trigger.yml b/.github/workflows/manual-trigger.yml index 8ff2bab4..378fed21 100644 --- a/.github/workflows/manual-trigger.yml +++ b/.github/workflows/manual-trigger.yml @@ -3,16 +3,16 @@ on: workflow_dispatch: inputs: instance1: - description: 'Please enter a valid BRB instance URL to run the tests on' - default: 'https://brb-main.cd.dbildungscloud.dev' + description: "Please enter a valid BRB instance URL to run the tests on" + default: "https://brb-main.cd.dbildungscloud.dev" required: true instance2: - description: 'Please enter a valid NBC instance URL to run the tests on' - default: 'https://nbc-main.cd.dbildungscloud.dev' + description: "Please enter a valid NBC instance URL to run the tests on" + default: "https://nbc-main.cd.dbildungscloud.dev" required: true instance3: - description: 'Please enter a valid DEFAULT instance URL to run the tests on' - default: 'https://default-main.cd.dbildungscloud.dev' + description: "Please enter a valid DEFAULT instance URL to run the tests on" + default: "https://default-main.cd.dbildungscloud.dev" required: true jobs: @@ -28,67 +28,17 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Clean up previous report - uses: cypress-io/github-action@v5 - with: - command: npm run pretest - - - name: Cypress run - uses: cypress-io/github-action@v5 - env: - CYPRESS_BRB: ${{ github.event.inputs.instance1 }} - CYPRESS_NBC: ${{ github.event.inputs.instance2 }} - CYPRESS_DEFAULT: ${{ github.event.inputs.instance3 }} - CYPRESS_TEACHER_1_EMAIL: ${{ secrets.CYPRESS_TEACHER_1_EMAIL }} - CYPRESS_TEACHER_1_PASSWORD: ${{ secrets.CYPRESS_TEACHER_1_PASSWORD }} - CYPRESS_TEACHER_2_EMAIL: ${{ secrets.CYPRESS_TEACHER_2_EMAIL }} - CYPRESS_TEACHER_2_PASSWORD: ${{ secrets.CYPRESS_TEACHER_2_PASSWORD }} - CYPRESS_STUDENT_1_EMAIL: ${{ secrets.CYPRESS_STUDENT_1_EMAIL }} - CYPRESS_STUDENT_1_PASSWORD: ${{ secrets.CYPRESS_STUDENT_1_PASSWORD }} - CYPRESS_STUDENT_2_EMAIL: ${{ secrets.CYPRESS_STUDENT_2_EMAIL }} - CYPRESS_STUDENT_2_PASSWORD: ${{ secrets.CYPRESS_STUDENT_2_PASSWORD }} - CYPRESS_ADMIN_1_EMAIL: ${{ secrets.CYPRESS_ADMIN_1_EMAIL }} - CYPRESS_ADMIN_1_PASSWORD: ${{ secrets.CYPRESS_ADMIN_1_PASSWORD }} - CYPRESS_EXPERT_1_EMAIL: ${{ secrets.CYPRESS_EXPERT_1_EMAIL }} - CYPRESS_EXPERT_1_PASSWORD": ${{ secrets.CYPRESS_EXPERT_1_PASSWORD }} - CYPRESS_STUDENT_EXTERN: ${{ secrets.CYPRESS_STUDENT_EXTERN }} - CYPRESS_STUDENT_EXTERN_PASSWORD: ${{ secrets.CYPRESS_STUDENT_EXTERN_PASSWORD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL }} - CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD }} - CYPRESS_TEACHER_1_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_1_FIRST_NAME }} - CYPRESS_TEACHER_1_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_1_LAST_NAME }} - CYPRESS_TEACHER_2_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_2_FIRST_NAME }} - CYPRESS_TEACHER_2_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_2_LAST_NAME }} - DEBUG: '@cypress/github-action' - with: - command: npm run tag:stable - browser: chrome - - - name: Generate Report - uses: cypress-io/github-action@v5 - if: always() - with: - command: npm run generate:report - - - name: Upload Report - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-report - path: ${{ github.workspace }}/reports - - - name: Upload Video Artifact - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-video-artifact - path: ${{ github.workspace }}/cypress/videos/ - retention-days: 3 + configuring-loading-secrets-running-tests: + needs: e2e-system-tests + uses: ./.github/workflows/main.yml + secrets: + service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} notify_RC: runs-on: ubuntu-latest - needs: [e2e-system-tests] + needs: + - e2e-system-tests + - configuring-loading-secrets-running-tests if: | always() @@ -99,6 +49,6 @@ jobs: uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@1.1.1 with: type: ${{ env.WORKFLOW_CONCLUSION }} - job_name: 'Cypress Tests' + job_name: "Cypress Tests" url: ${{ secrets.RC_WEBHOOK_URL }} username: Manual Trigger Test Run diff --git a/.github/workflows/remote-trigger.yml b/.github/workflows/remote-trigger.yml index fe5a3c9e..74a64906 100644 --- a/.github/workflows/remote-trigger.yml +++ b/.github/workflows/remote-trigger.yml @@ -5,10 +5,17 @@ on: ref: required: true type: string + secrets: + service-account-token: + required: true jobs: e2e-system-tests: runs-on: ubuntu-latest + outputs: + cypress_brb: ${{ steps.set_target.outputs.CYPRESS_BRB }} + cypress_nbc: ${{ steps.set_target.outputs.CYPRESS_NBC }} + cypress_default: ${{ steps.set_target.outputs.CYPRESS_DEFAULT }} steps: - name: Setup Node @@ -42,24 +49,25 @@ jobs: path: e2e-system-tests - name: Set target + id: set_target shell: bash run: | branch_name=${{ inputs.ref }} echo "input branch name: $branch_name" - # This cleaning of the branch name needs to be done the same way as in deployment. + # This cleaning of the branch name needs to be done the same way as in deployment. # Currently done in https://github.com/hpi-schul-cloud/dof_app_deploy/blob/main/.github/workflows/clean_workflow.yml cleaned_branch_name=$(echo $branch_name | sed 's@.*/@@' | tr [A-Z] [a-z] | tr _ - | tr \. -) echo "cleaned branch name: $cleaned_branch_name" - echo "CYPRESS_BRB=https://brb-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_ENV + echo "CYPRESS_BRB=https://brb-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_OUTPUT echo "Set CYPRESS_BRB=https://brb-${cleaned_branch_name}.cd.dbildungscloud.dev" - echo "CYPRESS_NBC=https://nbc-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_ENV + echo "CYPRESS_NBC=https://nbc-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_OUTPUT echo "Set CYPRESS_NBC=https://nbc-${cleaned_branch_name}.cd.dbildungscloud.dev" - echo "CYPRESS_DEFAULT=https://default-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_ENV - echo "Set CYPRESS_DEFAULT=https://default-${cleaned_branch_name}.cd.dbildungscloud.dev" + echo "CYPRESS_DEFAULT=https://default-${cleaned_branch_name}.cd.dbildungscloud.dev" >> $GITHUB_OUTPUT + echo "Set CYPRESS_DEFAULT=https://default-${cleaned_branch_name}.cd.dbildungscloud.dev" - name: Check if all apps are running shell: bash @@ -74,7 +82,7 @@ jobs: tries=$((tries+1)) sleep $delay done - + if [ $tries -ge $max_tries ]; then echo "Terminated checking $1 after $tries tries without success." echo "Exit job." @@ -83,58 +91,17 @@ jobs: echo "$1 says apps are running." fi } - - check_availability $CYPRESS_BRB/version - check_availability $CYPRESS_NBC/version - check_availability $CYPRESS_DEFAULT/version - - name: Cypress run - uses: cypress-io/github-action@v5 - with: - working-directory: e2e-system-tests - command: npm run tag:stable:pr - env: - CYPRESS_TEACHER_1_EMAIL: ${{ secrets.CYPRESS_TEACHER_1_EMAIL }} - CYPRESS_TEACHER_1_PASSWORD: ${{ secrets.CYPRESS_TEACHER_1_PASSWORD }} - CYPRESS_TEACHER_2_EMAIL: ${{ secrets.CYPRESS_TEACHER_2_EMAIL }} - CYPRESS_TEACHER_2_PASSWORD: ${{ secrets.CYPRESS_TEACHER_2_PASSWORD }} - CYPRESS_STUDENT_1_EMAIL: ${{ secrets.CYPRESS_STUDENT_1_EMAIL }} - CYPRESS_STUDENT_1_PASSWORD: ${{ secrets.CYPRESS_STUDENT_1_PASSWORD }} - CYPRESS_STUDENT_2_EMAIL: ${{ secrets.CYPRESS_STUDENT_2_EMAIL }} - CYPRESS_STUDENT_2_PASSWORD: ${{ secrets.CYPRESS_STUDENT_2_PASSWORD }} - CYPRESS_ADMIN_1_EMAIL: ${{ secrets.CYPRESS_ADMIN_1_EMAIL }} - CYPRESS_ADMIN_1_PASSWORD: ${{ secrets.CYPRESS_ADMIN_1_PASSWORD }} - CYPRESS_EXPERT_1_EMAIL: ${{ secrets.CYPRESS_EXPERT_1_EMAIL }} - CYPRESS_EXPERT_1_PASSWORD": ${{ secrets.CYPRESS_EXPERT_1_PASSWORD }} - CYPRESS_STUDENT_EXTERN: ${{ secrets.CYPRESS_STUDENT_EXTERN }} - CYPRESS_STUDENT_EXTERN_PASSWORD: ${{ secrets.CYPRESS_STUDENT_EXTERN_PASSWORD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL }} - CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD }} - CYPRESS_TEACHER_1_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_1_FIRST_NAME }} - CYPRESS_TEACHER_1_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_1_LAST_NAME }} - CYPRESS_TEACHER_2_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_2_FIRST_NAME }} - CYPRESS_TEACHER_2_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_2_LAST_NAME }} - DEBUG: '@cypress/github-action' - - - name: Generate Report - uses: cypress-io/github-action@v5 - if: always() - with: - working-directory: e2e-system-tests - command: npm run generate:report - - - name: Upload Report - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-report - path: e2e-system-tests/reports - - - name: Upload Video Artifact - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-video-artifact - path: e2e-system-tests/cypress/videos/ - retention-days: 3 \ No newline at end of file + check_availability ${{ steps.set_target.outputs.cypress_brb }}/version + check_availability ${{ steps.set_target.outputs.cypress_nbc }}/version + check_availability ${{ steps.set_target.outputs.cypress_default }}/version + + configuring-loading-secrets-running-tests: + needs: e2e-system-tests + uses: ./.github/workflows/main.yml + secrets: + service-account-token: ${{ secrets.service-account-token }} + with: + cypress_brb: ${{ needs.e2e-system-tests.outputs.cypress_brb }} + cypress_nbc: ${{ needs.e2e-system-tests.outputs.cypress_nbc }} + cypress_default: ${{ needs.e2e-system-tests.outputs.cypress_default }} diff --git a/.github/workflows/scheduled-trigger.yml b/.github/workflows/scheduled-trigger.yml index eafb4ce5..7c8d591f 100644 --- a/.github/workflows/scheduled-trigger.yml +++ b/.github/workflows/scheduled-trigger.yml @@ -1,7 +1,7 @@ name: e2e-scheduled-trigger-tests on: schedule: - - cron: '0 1 * * *' + - cron: "0 1 * * *" jobs: e2e-system-tests: runs-on: ubuntu-latest @@ -15,67 +15,17 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Clean up previous report - uses: cypress-io/github-action@v5 - with: - command: npm run pretest - - - name: Cypress run - uses: cypress-io/github-action@v5 - env: - CYPRESS_BRB: ${{ secrets.CYPRESS_BRB }} - CYPRESS_NBC: ${{ secrets.CYPRESS_NBC }} - CYPRESS_DEFAULT: ${{ secrets.CYPRESS_DEFAULT }} - CYPRESS_TEACHER_1_EMAIL: ${{ secrets.CYPRESS_TEACHER_1_EMAIL }} - CYPRESS_TEACHER_1_PASSWORD: ${{ secrets.CYPRESS_TEACHER_1_PASSWORD }} - CYPRESS_TEACHER_2_EMAIL: ${{ secrets.CYPRESS_TEACHER_2_EMAIL }} - CYPRESS_TEACHER_2_PASSWORD: ${{ secrets.CYPRESS_TEACHER_2_PASSWORD }} - CYPRESS_STUDENT_1_EMAIL: ${{ secrets.CYPRESS_STUDENT_1_EMAIL }} - CYPRESS_STUDENT_1_PASSWORD: ${{ secrets.CYPRESS_STUDENT_1_PASSWORD }} - CYPRESS_STUDENT_2_EMAIL: ${{ secrets.CYPRESS_STUDENT_2_EMAIL }} - CYPRESS_STUDENT_2_PASSWORD: ${{ secrets.CYPRESS_STUDENT_2_PASSWORD }} - CYPRESS_ADMIN_1_EMAIL: ${{ secrets.CYPRESS_ADMIN_1_EMAIL }} - CYPRESS_ADMIN_1_PASSWORD: ${{ secrets.CYPRESS_ADMIN_1_PASSWORD }} - CYPRESS_EXPERT_1_EMAIL: ${{ secrets.CYPRESS_EXPERT_1_EMAIL }} - CYPRESS_EXPERT_1_PASSWORD": ${{ secrets.CYPRESS_EXPERT_1_PASSWORD }} - CYPRESS_STUDENT_EXTERN: ${{ secrets.CYPRESS_STUDENT_EXTERN }} - CYPRESS_STUDENT_EXTERN_PASSWORD: ${{ secrets.CYPRESS_STUDENT_EXTERN_PASSWORD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_EMAIL }} - CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_OLD_PWD }} - CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD: ${{ secrets.CYPRESS_STUDENT_PASSWORD_CHANGE_NEW_PWD }} - CYPRESS_TEACHER_1_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_1_FIRST_NAME }} - CYPRESS_TEACHER_1_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_1_LAST_NAME }} - CYPRESS_TEACHER_2_FIRST_NAME: ${{ secrets.CYPRESS_TEACHER_2_FIRST_NAME }} - CYPRESS_TEACHER_2_LAST_NAME: ${{ secrets.CYPRESS_TEACHER_2_LAST_NAME }} - DEBUG: '@cypress/github-action' - with: - command: npm run tag:stable - browser: chrome - - - name: Generate Report - uses: cypress-io/github-action@v5 - if: always() - with: - command: npm run generate:report - - - name: Upload Report - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-report - path: ${{ github.workspace }}/reports - - - name: Upload Video Artifact - uses: actions/upload-artifact@v3 - if: always() - with: - name: my-video-artifact - path: ${{ github.workspace }}/cypress/videos/ - retention-days: 3 + configuring-loading-secrets-running-tests: + needs: e2e-system-tests + uses: ./.github/workflows/main.yml + secrets: + service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} notify_RC: runs-on: ubuntu-latest - needs: [e2e-system-tests] + needs: + - e2e-system-tests + - configuring-loading-secrets-running-tests if: | always() @@ -86,6 +36,6 @@ jobs: uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@1.1.1 with: type: ${{ env.WORKFLOW_CONCLUSION }} - job_name: 'Cypress Tests' + job_name: "Cypress Tests" url: ${{ secrets.RC_WEBHOOK_URL }} username: Scheduled Trigger Test Run