Skip to content

Trigger external apps test #37171

Trigger external apps test

Trigger external apps test #37171

Workflow file for this run

name: Test
env:
# This is to make sure Maven don't timeout fetching dependencies. See: https://github.com/actions/virtual-environments/issues/1499
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=125
on:
workflow_dispatch:
push:
branches:
- master
- trigger-external-apps-test
pull_request:
release:
types: [created]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Test core # NOTE: dhis-2/pom.xml needs to be installed as built artifacts are needed by dhis-web
run: mvn clean install --threads 2C --batch-mode --no-transfer-progress --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-web-apps
timeout-minutes: 30
- name: Report coverage to codecov
uses: codecov/codecov-action@v3
with:
directory: ./dhis-2
flags: unit
fail_ci_if_error: false
verbose: true
# delete the next 2 steps once we are confident in the coverage setup
- name: Tar jacoco coverage report to debug
run: tar -cvf coverage.tar dhis-2/dhis-test-coverage/target/site/jacoco-aggregate
- uses: actions/upload-artifact@v4
name: Upload jacoco coverage report to debug
with:
name: unit-test-coverage
path: coverage.tar
retention-days: 5
- name: Generate surefire aggregate report
run: mvn surefire-report:report-only -Daggregate=true --batch-mode --no-transfer-progress -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-test-coverage,-dhis-web-apps
# tar due to https://github.com/actions/upload-artifact/blob/3cea5372237819ed00197afe530f5a7ea3e805c8/README.md?plain=1#L254
- name: Tar surefire individual reports
run: find . -name "surefire-reports" -type d -exec find {} -type f -name "*.xml" -printf '%p\0' \; | tar --null --files-from=- -cvf surefire_reports.tar
- name: Archive surefire reports
uses: actions/upload-artifact@v4
with:
name: unit-test-surefire-reports
path: |
dhis-2/target/site/surefire-report.html
surefire_reports.tar
retention-days: 5
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Run integration tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -Pintegration --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-web-apps
timeout-minutes: 30
- uses: actions/upload-artifact@v4
name: Upload test logs on failure
if: failure()
with:
name: integration-test-logs
path: "**/target/test.log"
if-no-files-found: error # check our logging configuration if that happens
retention-days: 3
- name: Report coverage to codecov
uses: codecov/codecov-action@v3
with:
directory: ./dhis-2
flags: integration
fail_ci_if_error: false
verbose: true
# delete the next 2 steps once we are confident in the coverage setup
- name: Tar jacoco coverage report to debug
run: tar -cvf coverage.tar dhis-2/dhis-test-coverage/target/site/jacoco-aggregate
- uses: actions/upload-artifact@v4
name: Upload jacoco coverage report to debug
with:
name: integration-test-coverage
path: coverage.tar
retention-days: 5
- name: Generate surefire aggregate report
run: mvn surefire-report:report-only -Daggregate=true --batch-mode --no-transfer-progress -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-test-coverage,-dhis-web-apps
# tar due to https://github.com/actions/upload-artifact/blob/3cea5372237819ed00197afe530f5a7ea3e805c8/README.md?plain=1#L254
- name: Tar surefire individual reports
run: find . -name "surefire-reports" -type d -exec find {} -type f -name "*.xml" -printf '%p\0' \; | tar --null --files-from=- -cvf surefire_reports.tar
- name: Archive surefire reports
uses: actions/upload-artifact@v4
with:
name: integration-test-surefire-reports
path: |
dhis-2/target/site/surefire-report.html
surefire_reports.tar
retention-days: 5
integration-h2-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Run integration h2 tests
run: mvn clean verify --threads 2C --batch-mode --no-transfer-progress -PintegrationH2 --update-snapshots -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-web-apps
timeout-minutes: 30
- uses: actions/upload-artifact@v4
name: Upload test logs on failure
if: failure()
with:
name: integration-h2-test-logs
path: "**/target/test.log"
if-no-files-found: error # check our logging configuration if that happens
retention-days: 3
- name: Report coverage to codecov
uses: codecov/codecov-action@v3
with:
directory: ./dhis-2
flags: integration-h2
fail_ci_if_error: false
verbose: true
# delete the next 2 steps once we are confident in the coverage setup
- name: Tar jacoco coverage report to debug
run: tar -cvf coverage.tar dhis-2/dhis-test-coverage/target/site/jacoco-aggregate
- uses: actions/upload-artifact@v4
name: Upload jacoco coverage report to debug
with:
name: integration-h2-test-coverage
path: coverage.tar
retention-days: 5
- name: Generate surefire aggregate report
run: mvn surefire-report:report-only -Daggregate=true --batch-mode --no-transfer-progress -f ./dhis-2/pom.xml -pl -dhis-web-server,-dhis-test-coverage,-dhis-web-apps
# tar due to https://github.com/actions/upload-artifact/blob/3cea5372237819ed00197afe530f5a7ea3e805c8/README.md?plain=1#L254
- name: Tar surefire individual reports
run: find . -name "surefire-reports" -type d -exec find {} -type f -name "*.xml" -printf '%p\0' \; | tar --null --files-from=- -cvf surefire_reports.tar
- name: Archive surefire reports
uses: actions/upload-artifact@v4
with:
name: integration-h2-test-surefire-reports
path: |
dhis-2/target/site/surefire-report.html
surefire_reports.tar
retention-days: 5
send-slack-message:
runs-on: ubuntu-latest
if: |
always() &&
contains(needs.*.result, 'failure') &&
github.ref == 'refs/heads/master'
needs: [ unit-test, integration-test, integration-h2-test ]
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BACKEND_WEBHOOK }}
SLACK_CHANNEL: 'team-backend'
SLACK_MESSAGE: "Latest test run on master failed and needs investigation :detective-duck:. \n Commit message: ${{ github.event.head_commit.message }}"
SLACK_COLOR: '#ff0000'
trigger-cypress-tests:
needs: [unit-test, integration-test, integration-h2-test]
runs-on: ubuntu-latest
if: success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/trigger-external-apps-test' || github.event_name == 'release')
env:
DEFAULT_DHIS2_VERSION: "2.40"
steps:
- name: Determine DHIS2 Version
id: set-version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "Setting DHIS2_VERSION from release tag"
echo "::set-output name=VERSION::${{ github.event.release.tag_name }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Setting DHIS2_VERSION from workflow dispatch input"
echo "::set-output name=VERSION::${{ github.event.inputs.dhis2_version }}"
else
echo "Defaulting DHIS2_VERSION"
echo "::set-output name=VERSION::${{ env.DEFAULT_DHIS2_VERSION }}"
fi
- name: Trigger Cypress Tests in line-listing-app
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT_DISPATCH_TOKEN }}
repository: dhis2/line-listing-app
event-type: cypress-test-trigger
client-payload: '{"dhis2_version": "${{ steps.set-version.outputs.VERSION }}"}'