Skip to content

refacfor: Boundary between incoming request and parsed params #15869

refacfor: Boundary between incoming request and parsed params

refacfor: Boundary between incoming request and parsed params #15869

name: Run analytics api tests
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:
pull_request:
types: [ opened, labeled, synchronize ]
schedule:
- cron: "16 1 * * *" # Run at 01:16 AM
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
api-analytics-test:
env:
CORE_IMAGE_NAME: "dhis2/core-dev:local"
PR_NUMBER: ${{ github.event.number }}
DOCKER_CHANNEL: "dhis2/core-pr"
SIERRA_LEONE_DB_PATH: "/tmp/db/sierra-leone"
SIERRA_LEONE_DB_VERSION: "2.39.0"
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'run-api-analytics-tests')"
steps:
- uses: actions/checkout@v4
- name: Free disk space on runner (Ubuntu)
shell: bash
run: |
# Remove Android and .NET libs (approx. 14GB)
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Build core image
run: |
mvn clean install --threads 2C --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true --update-snapshots -f dhis-2/pom.xml -pl -dhis-test-integration,-dhis-test-coverage,-dhis-web-server
mvn clean install -PjibDockerBuild -DactiveProfile=jibDockerBuild --batch-mode --no-transfer-progress -DskipTests -Dmaven.test.skip=true -f ./dhis-2/dhis-web-server/pom.xml -Djib.to.image=$CORE_IMAGE_NAME
- name: Get Sierra Leone DB from cache
uses: actions/cache@v4
id: cache-sierra-leone-db
with:
path: ${{ env.SIERRA_LEONE_DB_PATH }}
key: sierra-leone-db-analytics-${{ env.SIERRA_LEONE_DB_VERSION }}
- name: Download Sierra Leone DB
if: ${{ steps.cache-sierra-leone-db.outputs.cache-hit != 'true' }}
run: |
mkdir -p ${{ env.SIERRA_LEONE_DB_PATH }}
wget https://databases.dhis2.org/sierra-leone/${{ env.SIERRA_LEONE_DB_VERSION }}/analytics_be/dhis2-db-sierra-leone.sql.gz --no-clobber --directory-prefix ${{ env.SIERRA_LEONE_DB_PATH }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run tests
run: |
cd dhis-2/dhis-test-e2e
DHIS2_IMAGE="$CORE_IMAGE_NAME" \
DHIS2_E2E_TEST_DUMP_PATH="$SIERRA_LEONE_DB_PATH" \
docker compose -f docker-compose.yml -f docker-compose.e2e.yml -f docker-compose.e2e-analytics.yml \
up --remove-orphans --exit-code-from test
- name: Upload logs
if: failure()
run: |
cd dhis-2/dhis-test-e2e
docker-compose logs web > ~/logs.txt
- uses: actions/upload-artifact@v4
if: failure()
with:
name: "tomcat_logs"
path: '~/logs.txt'
send-slack-message:
runs-on: ubuntu-latest
if: |
always() &&
contains(needs.*.result, 'failure') &&
github.ref == 'refs/heads/master'
needs: [ api-analytics-test ]
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_BACKEND_WEBHOOK }}
SLACK_CHANNEL: 'team-backend'
SLACK_MESSAGE: "Latest analytics e2e test run on master failed and needs investigation :detective-duck:. \n Commit message: ${{ github.event.head_commit.message }}"
SLACK_COLOR: '#ff0000'