[AAP-73135] Backport: Fix Segment event loss by enabling sync_mode (stable-0.7) #1829
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: "Pytest tests" | |
| on: | |
| push: | |
| branches: ['devel'] | |
| pull_request: | |
| jobs: | |
| pytest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout metrics-utility" | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v7 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: "Set up postgresql" | |
| run: | | |
| sudo apt install postgresql postgresql-client | |
| sudo systemctl start postgresql.service # ubuntu | |
| - name: "Wait for postgresql" | |
| timeout-minutes: 1 | |
| run: | | |
| until pg_isready; do | |
| sleep 4 | |
| done | |
| - name: "Import SQL dump" | |
| run: | | |
| cat tools/docker/{roles,latest,functions,conf_setting,main_hostmetric,main_instance,main_jobhostsummary,dab_feature_flags}.sql | sudo su - postgres -c psql | |
| - name: "Pull minio" | |
| run: | | |
| mkdir -p ~/.local/bin | |
| curl -fL https://github.com/minio/mc/releases/download/RELEASE.2025-08-13T08-35-41Z/mc.linux-amd64.RELEASE.2025-08-13T08-35-41Z -o ~/.local/bin/mc | |
| curl -fL https://dl.min.io/server/minio/release/linux-amd64/minio -o ~/.local/bin/minio | |
| chmod +x ~/.local/bin/{mc,minio} | |
| MC_CHECKSUM=`md5sum ~/.local/bin/mc | awk '{ print $1 }'` | |
| MINIO_CHECKSUM=`md5sum ~/.local/bin/minio | awk '{ print $1 }'` | |
| [ "$MC_CHECKSUM" = "4e57e038d26428190dd757cb47aae202" ] | |
| [ "$MINIO_CHECKSUM" = "88a11227cd67611d1a64f0c6d2bc13d8" ] | |
| - name: "Set up minio" | |
| env: | |
| MINIO_ROOT_USER: minioaccess | |
| MINIO_ROOT_PASSWORD: miniosecret | |
| run: | | |
| mkdir minio-data | |
| minio server ./minio-data --console-address ":9001" & | |
| - name: "Wait for minio" | |
| timeout-minutes: 1 | |
| env: | |
| MINIO_ROOT_USER: minioaccess | |
| MINIO_ROOT_PASSWORD: miniosecret | |
| run: | | |
| until mc alias set local http://localhost:9000 minioaccess miniosecret; do | |
| sleep 4 | |
| done | |
| - name: "Create minio user" | |
| env: | |
| MINIO_ROOT_USER: minioaccess | |
| MINIO_ROOT_PASSWORD: miniosecret | |
| run: | | |
| mc alias set local http://localhost:9000 minioaccess miniosecret | |
| mc mb --ignore-existing local/metricsutilitys3 | |
| mc admin user add local mynewuser mysecretpassword | |
| mc admin policy attach local readwrite --user=mynewuser | |
| mc admin accesskey create local mynewuser --access-key myuseraccesskey --secret-key myusersecretkey | |
| - name: "Patch mock_awx postgres config" | |
| run: | | |
| sed -i '/NAME/s/awx/postgres/' mock_awx/settings/__init__.py | |
| sed -i '/USER/s/myuser/awx/' mock_awx/settings/__init__.py | |
| sed -i '/PASSWORD/s/mypassword/awx/' mock_awx/settings/__init__.py | |
| - name: "Run pytest" | |
| env: | |
| METRICS_UTILITY_BUCKET_ACCESS_KEY: "myuseraccesskey" | |
| METRICS_UTILITY_BUCKET_ENDPOINT: "http://localhost:9000" | |
| METRICS_UTILITY_BUCKET_NAME: "metricsutilitys3" | |
| METRICS_UTILITY_BUCKET_REGION: "us-east-1" | |
| METRICS_UTILITY_BUCKET_SECRET_KEY: "myusersecretkey" | |
| METRICS_UTILITY_DB_HOST: "localhost" | |
| run: | | |
| uv run pytest -s -v --cov=. --cov-report=xml | |
| - name: "Upload code coverage report" | |
| if: ${{ github.base_ref }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| - name: "Save off PR number" | |
| if: github.event_name == 'pull_request' | |
| run: echo "PR ${{ github.event.pull_request.number }}" > pr_number.txt | |
| - name: "Upload PR number" | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pr_number | |
| path: pr_number.txt | |
| - name: "Send code coverage report to Sonar Cloud (on push)" | |
| uses: SonarSource/sonarqube-scan-action@v7 | |
| if: ${{ ! github.base_ref }} | |
| env: | |
| SONAR_HOST_URL: https://sonarcloud.io | |
| SONAR_ORGANIZATION: ansible | |
| SONAR_PROJECT_KEY: ansible_metrics-utility | |
| SONAR_TOKEN: ${{ secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT }} | |
| with: | |
| projectBaseDir: . | |
| args: > | |
| -Dsonar.host.url=https://sonarcloud.io | |
| -Dsonar.organization=ansible | |
| -Dsonar.projectKey=ansible_metrics-utility | |
| -Dsonar.python.coverage.reportPaths=coverage.xml |