|
1 | 1 | name: Pyatlan Pull Request Build |
2 | 2 |
|
3 | 3 | # This workflow runs both sync and async integration tests intelligently: |
4 | | -# - Sync integration tests: Always run on every PR |
5 | | -# - Async integration tests: Only run when: |
6 | | -# 1. Changes detected in pyatlan/*/aio/ or tests/*/aio/ paths |
7 | | -# 2. PR has the "run-async-tests" label (manual trigger) |
8 | | -# This prevents adding 12+ minutes to every PR while ensuring async tests run when needed. |
| 4 | +# - Legacy sync integration tests: Always run on every PR with code changes |
| 5 | +# - Legacy async integration tests: Only run when AIO changes detected or "run-async-tests" label |
| 6 | +# - V9 unit tests: Always run on every PR with code changes |
| 7 | +# - V9 integration tests (sync + async): Only run when PR has the "run_pyatlan_v9_integration_tests" label |
9 | 8 |
|
10 | 9 | on: |
11 | 10 | pull_request: |
@@ -117,6 +116,28 @@ jobs: |
117 | 116 | echo "βοΈ No AIO changes detected and no manual trigger label found" |
118 | 117 | fi |
119 | 118 |
|
| 119 | + check-v9-integration-label: |
| 120 | + runs-on: ubuntu-latest |
| 121 | + outputs: |
| 122 | + run-v9-integration: ${{ steps.check-label.outputs.run-v9-integration }} |
| 123 | + steps: |
| 124 | + - name: Check for v9 integration test label |
| 125 | + id: check-label |
| 126 | + run: | |
| 127 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 128 | + echo "run-v9-integration=true" >> $GITHUB_OUTPUT |
| 129 | + echo "Manual trigger: running v9 integration tests" |
| 130 | + exit 0 |
| 131 | + fi |
| 132 | +
|
| 133 | + if echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | grep -q "run_pyatlan_v9_integration_tests"; then |
| 134 | + echo "run-v9-integration=true" >> $GITHUB_OUTPUT |
| 135 | + echo "Found 'run_pyatlan_v9_integration_tests' label" |
| 136 | + else |
| 137 | + echo "run-v9-integration=false" >> $GITHUB_OUTPUT |
| 138 | + echo "No 'run_pyatlan_v9_integration_tests' label found, skipping v9 integration tests" |
| 139 | + fi |
| 140 | +
|
120 | 141 | qa-checks-and-unit-tests: |
121 | 142 | needs: [check-code-changes, vulnerability-scan] |
122 | 143 | if: needs.check-code-changes.outputs.has-code-changes == 'true' |
@@ -260,3 +281,153 @@ jobs: |
260 | 281 | # Run the async integration test file using `pytest-timer` plugin |
261 | 282 | # to display only the durations of the 10 slowest tests with `pytest-sugar` |
262 | 283 | command: uv run pytest ${{ matrix.test_file }} -p name_of_plugin --timer-top-n 10 --force-sugar -vv |
| 284 | + |
| 285 | + # ========================================================================= |
| 286 | + # V9 (msgspec) Jobs |
| 287 | + # ========================================================================= |
| 288 | + |
| 289 | + v9-qa-checks-and-unit-tests: |
| 290 | + needs: [check-code-changes, vulnerability-scan] |
| 291 | + if: needs.check-code-changes.outputs.has-code-changes == 'true' |
| 292 | + runs-on: ubuntu-latest |
| 293 | + strategy: |
| 294 | + matrix: |
| 295 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 296 | + |
| 297 | + steps: |
| 298 | + - name: Checkout code |
| 299 | + uses: actions/checkout@v4 |
| 300 | + |
| 301 | + - name: Set up Python |
| 302 | + uses: actions/setup-python@v5 |
| 303 | + with: |
| 304 | + python-version: ${{ matrix.python-version }} |
| 305 | + |
| 306 | + - name: Install uv |
| 307 | + uses: astral-sh/setup-uv@v6 |
| 308 | + |
| 309 | + - name: Install dependencies |
| 310 | + run: uv sync --group dev |
| 311 | + |
| 312 | + - name: QA checks (ruff-format, ruff-lint, mypy) |
| 313 | + run: uv run ./qa-checks |
| 314 | + |
| 315 | + - name: Run v9 unit tests |
| 316 | + env: |
| 317 | + ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }} |
| 318 | + ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }} |
| 319 | + run: uv run pytest tests_v9/unit --force-sugar -vv |
| 320 | + |
| 321 | + v9-prepare-integration-tests: |
| 322 | + needs: [check-code-changes, vulnerability-scan, check-v9-integration-label] |
| 323 | + if: >- |
| 324 | + needs.check-code-changes.outputs.has-code-changes == 'true' && |
| 325 | + needs.check-v9-integration-label.outputs.run-v9-integration == 'true' |
| 326 | + runs-on: ubuntu-latest |
| 327 | + outputs: |
| 328 | + v9-files: ${{ steps.distribute-v9-files.outputs.v9-files }} |
| 329 | + v9-aio-files: ${{ steps.distribute-v9-aio-files.outputs.v9-aio-files }} |
| 330 | + |
| 331 | + steps: |
| 332 | + - name: Checkout code |
| 333 | + uses: actions/checkout@v4 |
| 334 | + |
| 335 | + - name: Prepare v9 sync integration tests distribution |
| 336 | + id: distribute-v9-files |
| 337 | + run: | |
| 338 | + files=$(find tests_v9/integration -maxdepth 1 \( -name "test_*.py" -o -name "*_test.py" \) | sort | tr '\n' ' ') |
| 339 | + if [ -n "$files" ]; then |
| 340 | + json_files=$(echo "${files[@]}" | jq -R -c 'split(" ")[:-1]') |
| 341 | + else |
| 342 | + json_files="[]" |
| 343 | + fi |
| 344 | + echo "v9-files=$json_files" >> $GITHUB_OUTPUT |
| 345 | + echo "V9 sync integration test files: $json_files" |
| 346 | +
|
| 347 | + - name: Prepare v9 async integration tests distribution |
| 348 | + id: distribute-v9-aio-files |
| 349 | + run: | |
| 350 | + if [ -d "tests_v9/integration/aio" ]; then |
| 351 | + aio_files=$(find tests_v9/integration/aio -name "test_*.py" | sort | tr '\n' ' ') |
| 352 | + if [ -n "$aio_files" ]; then |
| 353 | + json_aio_files=$(echo "${aio_files[@]}" | jq -R -c 'split(" ")[:-1]') |
| 354 | + else |
| 355 | + json_aio_files="[]" |
| 356 | + fi |
| 357 | + else |
| 358 | + json_aio_files="[]" |
| 359 | + fi |
| 360 | + echo "v9-aio-files=$json_aio_files" >> $GITHUB_OUTPUT |
| 361 | + echo "V9 async integration test files: $json_aio_files" |
| 362 | +
|
| 363 | + v9-integration-tests: |
| 364 | + needs: [v9-prepare-integration-tests] |
| 365 | + if: needs.v9-prepare-integration-tests.outputs.v9-files != '[]' |
| 366 | + runs-on: ubuntu-latest |
| 367 | + strategy: |
| 368 | + fail-fast: false |
| 369 | + matrix: |
| 370 | + test_file: ${{fromJson(needs.v9-prepare-integration-tests.outputs.v9-files)}} |
| 371 | + concurrency: |
| 372 | + group: v9-${{ matrix.test_file }} |
| 373 | + |
| 374 | + steps: |
| 375 | + - name: Checkout code |
| 376 | + uses: actions/checkout@v4 |
| 377 | + |
| 378 | + - name: Set up Python 3.11 |
| 379 | + uses: actions/setup-python@v5 |
| 380 | + with: |
| 381 | + python-version: "3.11" |
| 382 | + |
| 383 | + - name: Install uv |
| 384 | + uses: astral-sh/setup-uv@v6 |
| 385 | + |
| 386 | + - name: Install dependencies |
| 387 | + run: uv sync --group dev |
| 388 | + |
| 389 | + - name: Run v9 integration test |
| 390 | + env: |
| 391 | + ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }} |
| 392 | + ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }} |
| 393 | + uses: nick-fields/retry@v3 |
| 394 | + with: |
| 395 | + max_attempts: 3 |
| 396 | + timeout_minutes: 10 |
| 397 | + command: uv run pytest ${{ matrix.test_file }} -p name_of_plugin --timer-top-n 10 --force-sugar -vv |
| 398 | + |
| 399 | + v9-async-integration-tests: |
| 400 | + needs: [v9-prepare-integration-tests] |
| 401 | + if: needs.v9-prepare-integration-tests.outputs.v9-aio-files != '[]' |
| 402 | + runs-on: ubuntu-latest |
| 403 | + strategy: |
| 404 | + fail-fast: false |
| 405 | + matrix: |
| 406 | + test_file: ${{fromJson(needs.v9-prepare-integration-tests.outputs.v9-aio-files)}} |
| 407 | + concurrency: |
| 408 | + group: v9-async-${{ matrix.test_file }} |
| 409 | + |
| 410 | + steps: |
| 411 | + - name: Checkout code |
| 412 | + uses: actions/checkout@v4 |
| 413 | + |
| 414 | + - name: Set up Python 3.11 |
| 415 | + uses: actions/setup-python@v5 |
| 416 | + with: |
| 417 | + python-version: "3.11" |
| 418 | + |
| 419 | + - name: Install uv |
| 420 | + uses: astral-sh/setup-uv@v6 |
| 421 | + |
| 422 | + - name: Install dependencies |
| 423 | + run: uv sync --group dev |
| 424 | + |
| 425 | + - name: Run v9 async integration test |
| 426 | + env: |
| 427 | + ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }} |
| 428 | + ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }} |
| 429 | + uses: nick-fields/retry@v3 |
| 430 | + with: |
| 431 | + max_attempts: 3 |
| 432 | + timeout_minutes: 15 |
| 433 | + command: uv run pytest ${{ matrix.test_file }} -p name_of_plugin --timer-top-n 10 --force-sugar -vv |
0 commit comments