Analytics API: Add Options aggregation and disaggregation #21681
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: 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.6" | |
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 container image | |
run: | | |
# only build image for running api tests in this workflow | |
mvn clean package --threads 2C --batch-mode --no-transfer-progress \ | |
-DskipTests -Dmaven.test.skip=true --update-snapshots --file dhis-2/pom.xml \ | |
--projects dhis-web-server --also-make --activate-profiles jibDockerBuild \ | |
-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: 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" |