-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: configure continuous delivery workflows (#2254)
There are 4 workflows: verify PR (dhis2-verify-app.yml) -- build, lint, test, e2e-prod verify commit to dev (dhis2-verify-app.yml) -- build, lint, test, e2e-prod, report-failure-to-slack verify commit to master (dhis2-verify-app.yml) -- build, lint, test, e2e-prod, release, report-failure-to-slack nightly (nightly.yml) -- e2e-dev, report-failure In addition: * e2e-prod and e2e-dev are reusable workflows and are called from dhis2-verify-app and nightly. * removed uses: c-hive/gha-yarn-cache@v1 since it is deprecated and setup-node handles that work. * updated action versions and node versions * cypress test version tagging for features and bugs has been added (copied from line-list)
- Loading branch information
1 parent
e01815f
commit 24d6692
Showing
2 changed files
with
133 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: 'e2e-prod' | ||
|
||
# Requirements: | ||
# | ||
# - Customize environment variables: | ||
# BASE_URL_INSTANCES: Set the base url for the instances, e.g. https://test.e2e.dhis2.org | ||
# NAME_PATTERN_PROD_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 e2e-prod 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: | ||
workflow_call: | ||
secrets: | ||
baseurl: | ||
required: true | ||
username: | ||
required: true | ||
password: | ||
required: true | ||
recordkey: | ||
required: true | ||
|
||
env: | ||
BASE_URL_INSTANCES: https://test.e2e.dhis2.org | ||
NAME_PATTERN_PROD_INSTANCES: 'analytics-{version}' | ||
NAME_PATTERN_DEV_INSTANCE: analytics-dev | ||
|
||
concurrency: | ||
group: e2e-prod-${{ github.workflow}}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
compute-prod-versions: | ||
if: "!github.event.push.repository.fork && (github.event.pull_request.draft == false || github.action == 'workflow_dispatch')" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
versions: ${{ steps.prod-versions.outputs.versions }} | ||
steps: | ||
- name: Compute dev 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 | ||
|
||
- name: Output prod version urls | ||
id: prod-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.username }} | ||
password: ${{ secrets.password }} | ||
|
||
e2e-prod: | ||
needs: compute-prod-versions | ||
runs-on: ubuntu-latest | ||
container: | ||
image: cypress/browsers:node16.17.0-chrome106 | ||
options: --user 1001 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
versions: ${{ fromJSON(needs.compute-prod-versions.outputs.versions) }} | ||
containers: [1, 2, 3, 4] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Compute prod instance url | ||
id: instance-url | ||
run: | | ||
url=${BASE_URL_INSTANCES%/}/${NAME_PATTERN_PROD_INSTANCES/"{version}"/$version} | ||
echo "url=$url" >> $GITHUB_OUTPUT | ||
echo "url: $url" | ||
env: | ||
version: ${{ matrix.versions }} | ||
|
||
- name: Run e2e tests | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
start: yarn d2-app-scripts start | ||
wait-on: 'http://localhost:3000' | ||
wait-on-timeout: 300 | ||
record: true | ||
parallel: true | ||
browser: chrome | ||
group: e2e-chrome-parallel-${{ matrix.versions }} | ||
env: | ||
CI: true | ||
BROWSER: none | ||
CYPRESS_RECORD_KEY: ${{ secrets.recordkey }} | ||
CYPRESS_dhis2BaseUrl: ${{ steps.instance-url.outputs.url }} | ||
CYPRESS_dhis2InstanceVersion: ${{matrix.versions}} | ||
CYPRESS_dhis2Username: ${{ secrets.username }} | ||
CYPRESS_dhis2Password: ${{ secrets.password }} | ||
CYPRESS_networkMode: live | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
e2e-tests-success: | ||
needs: e2e-prod | ||
if: ${{ success() || failure() }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: if [ $result != 'success' ]; then exit 1; fi; | ||
env: | ||
result: ${{ needs.e2e-prod.result }} |
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