-
Notifications
You must be signed in to change notification settings - Fork 5
ci(e2e-tests): add e2e-tests workflow for CD apps #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
JoakimSM
wants to merge
8
commits into
master
Choose a base branch
from
e2eTests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ff8bb30
ci(e2e-tests): add e2e-tests workflow for CD apps
JoakimSM 7063a48
chore: use pattern for instance names
JoakimSM 6b85324
chore: use pr ready instead of labels to trigger
JoakimSM 9c280be
chore: reorganize steps
JoakimSM 7d51c48
chore: use CYPRESS_RECORD_KEY secret
JoakimSM 1883008
ci: skip for fork PRs
JoakimSM 10b9805
ci: use node 16 and chrome 106
JoakimSM 1473ea3
ci: remove unnecessary step
JoakimSM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: 'dhis2: e2e tests' | ||
|
|
||
| # Requirements: | ||
| # | ||
| # - Secrets: | ||
| # GITHUB_TOKEN | ||
| # CYPRESS_RECORD_KEY | ||
| # CYPRESS_DHIS2_USERNAME | ||
| # CYPRESS_DHIS2_PASSWORD | ||
| # | ||
| # - Customize environment variables: | ||
| # BASE_URL_INSTANCES: Set the base url for the instances, e.g. https://test.e2e.dhis2.org | ||
| # NAME_PATTERN_LEGACY_INSTANCES: Set the name pattern for your instances. {version} will be replaced by "[majorVersion].[minorVersion]" | ||
| # NAME_PATTERN_DEV_INSTANCE: Set the name pattern for your dev instance. {version} will be replaced by "dev" | ||
| # | ||
| # - Other optional customizations: | ||
| # containers: Set the matrix containers array for the cypress job. The number of parallel Cypress instances running for each backend version will equal the array length. | ||
| # | ||
| # - Set status check as required: | ||
| # We recommend setting "e2e-tests-success" as a required step in your workflow. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| env: | ||
| BASE_URL_INSTANCES: https://test.e2e.dhis2.org | ||
| NAME_PATTERN_LEGACY_INSTANCES: '{version}dev' | ||
| NAME_PATTERN_DEV_INSTANCE: dev | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow}}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| compute-versions: | ||
| if: '!github.event.pull_request.draft && !github.event.pull_request.head.repo.fork' | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.legacy-versions.outputs.versions }} | ||
| steps: | ||
| - name: compute-instance-url | ||
| id: instance-url | ||
| run: | | ||
| url=${BASE_URL_INSTANCES%/}/${NAME_PATTERN_DEV_INSTANCE/"{version}"/dev} | ||
| echo "url=$url" >> $GITHUB_OUTPUT | ||
| echo "url: $url" | ||
|
|
||
| - uses: actions/checkout@v3 | ||
|
|
||
| - id: legacy-versions | ||
| uses: dhis2/action-supported-legacy-versions@v1 | ||
| with: | ||
| instance-url-latest: ${{ steps.instance-url.outputs.url }} # can be removed if maxDHIS2Version has been specified | ||
| username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} # can be removed if maxDHIS2Version has been specified | ||
| password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} # can be removed if maxDHIS2Version has been specified | ||
|
|
||
| cypress: | ||
| needs: compute-versions | ||
| runs-on: ubuntu-latest | ||
| container: cypress/browsers:node16.17.0-chrome106 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| versions: ${{ fromJSON(needs.compute-versions.outputs.versions) }} | ||
| containers: [1, 2, 3, 4, 5, 6] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: compute-instance-url | ||
| id: instance-url | ||
| run: | | ||
| url=${BASE_URL_INSTANCES%/}/${NAME_PATTERN_LEGACY_INSTANCES/"{version}"/$version} | ||
| echo "url=$url" >> $GITHUB_OUTPUT | ||
| echo "url: $url" | ||
| env: | ||
| version: ${{ matrix.versions }} | ||
|
|
||
| - name: Cypress run | ||
| uses: cypress-io/github-action@v4 | ||
| with: | ||
| record: true | ||
| parallel: true | ||
| group: e2e-chrome-parallel-${{ matrix.versions }} | ||
| browser: chrome | ||
| start: yarn d2-app-scripts start | ||
| wait-on: http://localhost:3000 | ||
| wait-on-timeout: 300 | ||
| env: | ||
| CI: true | ||
| CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| CYPRESS_dhis2BaseUrl: ${{ steps.instance-url.outputs.url }} | ||
| CYPRESS_dhis2InstanceVersion: ${{matrix.versions}} | ||
| CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} | ||
| CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} | ||
|
|
||
| e2e-tests-success: | ||
| needs: cypress | ||
| if: ${{ success() || failure() }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: if [ $result != 'success' ]; then exit 1; fi; | ||
| env: | ||
| result: ${{ needs.cypress.result }} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.