fix: avoid OptionSet.getOptions() N+1 in analytics metadata resolution [DHIS2-21975] #2297
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
| name: Run analytics api tests [ClickHouse] | |
| 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 | |
| # PR → quiet (unless ci-verbose label), push/schedule → info, workflow_dispatch → user choice | |
| MAVEN_ARGS: ${{ (inputs.maven_log == 'debug' && '-X') || (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci-verbose') && '-q') || (inputs.maven_log == 'quiet' && '-q') || '' }} | |
| on: | |
| pull_request: | |
| types: [opened, labeled, synchronize] | |
| schedule: | |
| - cron: "26 1 * * *" # Run at 01:36 AM | |
| workflow_dispatch: | |
| inputs: | |
| maven_log: | |
| description: "Maven log verbosity" | |
| required: false | |
| default: "quiet" | |
| type: choice | |
| options: | |
| - quiet | |
| - info | |
| - debug | |
| concurrency: | |
| group: ${{ github.workflow}}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| api-analytics-test-clickhouse: | |
| 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" | |
| GITHUB_TOKEN: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }} | |
| SSH_SIGNING_KEY: ${{ secrets.DHIS2_BOT_SSH_SIGNING_KEY }} | |
| SSH_SIGNING_PASSPHRASE: ${{ secrets.DHIS2_BOT_SSH_SIGNING_PASSPHRASE }} | |
| runs-on: ubuntu-22.04 | |
| if: contains(github.event.pull_request.labels.*.name, 'run-api-analytics-tests-clickhouse') || (github.event_name == 'workflow_dispatch') | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - 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@v5 | |
| 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@v6 | |
| 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 | |
| source setup_clickhouse_links | |
| DHIS2_IMAGE="$CORE_IMAGE_NAME" \ | |
| DHIS2_E2E_TEST_DUMP_PATH="$SIERRA_LEONE_DB_PATH" \ | |
| CLICKHOUSE_VERSION=24.8 \ | |
| docker compose -f docker-compose.yml -f docker-compose.clickhouse.yml -f docker-compose.e2e.yml \ | |
| -f docker-compose.e2e-analytics.yml -f docker-compose.clickhouse-analytics.yml \ | |
| up --attach test --remove-orphans --exit-code-from test | |
| # - name: Push surefire reports to repository | |
| # if: always() | |
| # run: | | |
| # cd dhis-2/dhis-test-e2e | |
| # DHIS2_IMAGE="$CORE_IMAGE_NAME" \ | |
| # DHIS2_E2E_TEST_DUMP_PATH="$SIERRA_LEONE_DB_PATH" \ | |
| # CLICKHOUSE_VERSION=24.8 \ | |
| # TEST_TYPE=e2e-analytics \ | |
| # DB_TYPE=clickhouse \ | |
| # docker compose -f docker-compose.yml -f docker-compose.clickhouse.yml -f docker-compose.e2e.yml -f docker-compose.e2e-analytics.yml -f docker-compose.clickhouse-analytics.yml --profile reports run reports-processor | |
| # - name: Add a comment to the pull request | |
| # if: always() | |
| # uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 | |
| # with: | |
| # issue-number: ${{ github.event.pull_request.number }} | |
| # body: | | |
| # Surefire reports for analytics API tests against ClickHouse have been pushed to the repository. [View reports](https://dhis2.github.io/dhis2-test-reports/reports/?component=core&testType=e2e-analytics) | |
| - name: Upload logs | |
| if: failure() | |
| run: | | |
| cd dhis-2/dhis-test-e2e | |
| docker compose logs web > ~/logs.txt | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: "tomcat_logs" | |
| path: "~/logs.txt" | |
| send-slack-message: | |
| runs-on: ubuntu-22.04 | |
| if: | | |
| always() && | |
| contains(needs.*.result, 'failure') && | |
| github.ref == 'refs/heads/master' | |
| needs: [api-analytics-test-clickhouse] | |
| 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 against ClickHouse on master failed and needs investigation :detective-duck:. \n Commit message: ${{ github.event.head_commit.message }}" | |
| SLACK_COLOR: "#ff0000" |