runs E2E tests #310
This file contains 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: runs E2E tests | |
on: | |
workflow_run: | |
workflows: [Get info on PR] | |
types: | |
- completed | |
jobs: | |
setup_matrix: | |
name: Setup E2E Matrix | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.head.repo.id == 21975579 || contains(github.event.pull_request.labels.*.name, 'build-fork') | |
outputs: | |
psh_url: ${{ steps.retrieve-url.outputs.psh_url }} | |
up_url: ${{ steps.retrieve-url.outputs.up_url }} | |
steps: | |
- name: Download info on PR | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: get-pr-info.yaml | |
workflow_conclusion: completed | |
name: pr-info | |
- name: retrieve url | |
id: retrieve-url | |
run: | | |
PSH_URL=$(cat environment_url.txt) | |
echo "PSH URL is $PSH_URL" | |
UP_URL="https://docs.upsun.com.${PSH_URL:8}" | |
echo "UP URL is ${UP_URL}" | |
echo "psh_url=$PSH_URL" >> $GITHUB_OUTPUT | |
echo "up_url=$UP_URL" >> $GITHUB_OUTPUT | |
run_test: | |
runs-on: ubuntu-latest | |
name: Run E2E tests (${{ matrix.site }}) | |
needs: setup_matrix | |
strategy: | |
matrix: | |
include: | |
- site: platformsh | |
url: ${{ needs.setup_matrix.outputs.psh_url }} | |
- site: upsun | |
url: ${{ needs.setup_matrix.outputs.up_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cypress-io/github-action@v6 | |
with: | |
wait-on: ${{ matrix.url }} | |
record: true | |
env: | |
CYPRESS_baseUrl: ${{ matrix.url }} | |
CYPRESS_environment: github | |
CYPRESS_site: ${{ matrix.site }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run_all_tests: | |
name: Report E2E tests for all sites | |
runs-on: ubuntu-latest | |
needs: run_test | |
if: ${{ always() }} | |
steps: | |
- name: Report matrix status | |
run: | | |
result="${{ needs.run_test.result }}" | |
if [[ $result == "success" || $result == "skipped" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi |