Skip to content

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Sep 9, 2025

ci: skip integration tests on Windows to reduce CI timeout

Summary

Addresses the Windows CI timeout issue where tests were taking 1hr+ vs 22min on Ubuntu. This PR implements a two-part solution:

  1. New poe task: Added test-unit-tests that runs only pytest tests/unit_tests/ (182 unit tests)
  2. Conditional CI execution: Modified the pytest matrix job to run only unit tests on Windows while keeping all tests on Ubuntu

The conditional logic uses ${{ matrix.os == 'Windows' && 'tests/unit_tests/' || '' }} to add the directory restriction only for Windows runners. Ubuntu continues running all tests for full coverage.

Review & Testing Checklist for Human

  • Verify conditional syntax works correctly - Create a test PR and confirm Windows CI runs only unit tests while Ubuntu runs all tests
  • Check CI timing improvement - Confirm Windows CI completes significantly faster (target: ~22min like Ubuntu)
  • Validate unit test coverage is adequate - Ensure 182 unit tests provide sufficient Windows compatibility validation
  • Test job naming - Verify the dynamic job names display correctly in GitHub Actions UI

Testing the changes locally:

# Test the new poe task
poetry run poe test-unit-tests

# Should run 182 unit tests in ~7 seconds

Notes

  • Requested by AJ Steers (@aaronsteers) to solve Windows CI timeouts
  • This is stage 1 of a two-stage fix; stage 2 will investigate root causes of Windows slowness
  • Unit tests confirmed to run successfully (182 tests passed in 7.36s locally)
  • All formatting and linting checks pass

Link to Devin run: https://app.devin.ai/sessions/2cd62f25e51440258413a76d0e0763c6

Summary by CodeRabbit

  • New Features

    • Added a convenient Poe task to run only unit tests locally: poe test-unit-tests.
  • Tests

    • Windows CI now runs unit tests only, improving speed and reliability on that platform.
    • Job names clearly indicate scope (“Unit Tests Only” on Windows, “All Tests” elsewhere).
    • Non-Windows CI behavior remains unchanged.
  • Chores

    • Streamlined test commands for clearer intent and easier developer workflows.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

- Add test-unit-tests poe task for running only unit tests
- Modify CI workflow to run only unit tests on Windows
- Keep all tests running on Ubuntu for full coverage
- This should reduce Windows CI time from 1hr+ to ~22min like Ubuntu

Co-Authored-By: AJ Steers <[email protected]>
Copy link
Contributor

Original prompt from AJ Steers
@Devin - In PyAirbyte, Windows CI tests are taking forever, timing out after 1hr - versus ubuntu CI tests finishing in 22 minutes. Let's do a two stage fix:
1. Create a new PR that skips all integration tests in CI when running on Windows - we'll just run unit tests for Windows instead of all tests.
2. Create a follow-on PR that attempts to discover why things are taking so much longer, and also why some testes are failing outright.
Thread URL: https://airbytehq-team.slack.com/archives/D089P0UPVT4/p1757449919843449?thread_ts=1757449919.843449

Copy link
Contributor

devin-ai-integration bot commented Sep 9, 2025

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

github-actions bot commented Sep 9, 2025

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1757450012-skip-windows-integration-tests' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1757450012-skip-windows-integration-tests'

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

- Revert job name to original format per PR feedback
- Create two separate pytest steps with opposite conditions
- 'Run Pytest [all]' for Ubuntu (matrix.os != 'Windows')
- 'Run Pytest [unit tests only]' for Windows (matrix.os == 'Windows')
- Addresses GitHub comment about job names being hard-coded in merge requirements

Co-Authored-By: AJ Steers <[email protected]>
Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

📝 Walkthrough

Walkthrough

Split CI pytest step by OS: non-Windows runs the original pytest invocation, Windows runs pytest limited to tests/unit_tests/. Added a Poe task test-unit-tests in pyproject.toml to run only unit tests.

Changes

Cohort / File(s) Summary of Changes
CI: OS-gated pytest steps
.github/workflows/python_pytest.yml
Split the existing Run Pytest step into Run Pytest [all] (runs when matrix.os != 'Windows') and a new Run Pytest [unit tests only] (runs when matrix.os == 'Windows'), with the Windows step invoking pytest tests/unit_tests/.
Developer tooling: Poe task for unit tests
pyproject.toml
Added a new Poe task test-unit-tests = { shell = "pytest tests/unit_tests/" } under [tool.poe.tasks].

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Commit/PR
  participant GH as GitHub Actions
  participant Runner as Matrix Runner
  participant PyTest as pytest

  Dev->>GH: Trigger workflow
  GH->>Runner: Start job (matrix.os, python-version)
  note right of Runner #DDEBF7: Job name and step gated by OS
  alt matrix.os == "Windows"
    Runner->>PyTest: pytest tests/unit_tests/
  else matrix.os != "Windows"
    Runner->>PyTest: pytest (original selection)
  end
  PyTest-->>Runner: Exit code
  Runner-->>GH: Report result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Would you like me to suggest consolidating step names or adding a brief workflow comment explaining the OS split, wdyt?


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d160b0 and 3bb83b2.

📒 Files selected for processing (1)
  • .github/workflows/python_pytest.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/python_pytest.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (No Creds)
  • GitHub Check: Pytest (Fast)

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the primary change of the pull request—skipping integration tests on Windows to reduce CI timeout—which aligns directly with the OS-based conditional gating and test selection logic implemented in the workflow.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The description concisely and accurately outlines implementing a new poe task that runs only unit tests and modifying the CI workflow to conditionally skip integration tests on Windows, directly reflecting the changes in the GitHub Actions workflow and pyproject.toml. It clearly references the Windows CI timeout issue versus Ubuntu timings, explains the conditional syntax, and includes a practical testing checklist. The notes on local test performance and the Devin run link further demonstrate alignment with the actual modifications. Overall, the description stays on-topic and meaningfully describes the changeset.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1757450012-skip-windows-integration-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/python_pytest.yml (1)

146-229: Harden GITHUB_TOKEN permissions for this workflow.

CodeQL’s suggestion is solid: can we explicitly set permissions to least privilege, e.g., contents: read, wdyt?

 name: Run Tests
 
 on:
   push:
@@
   pull_request: {}
 
+permissions:
+  contents: read
+
 env:
   AIRBYTE_ANALYTICS_ID: ${{ vars.AIRBYTE_ANALYTICS_ID }}
🧹 Nitpick comments (3)
pyproject.toml (1)

186-186: Add a coverage-backed poe task and (optionally) reuse it in CI?

Nice addition. To keep the “unit-tests-only” target in one place and avoid repeating the path logic in CI, would you like to add a coverage variant and/or have Windows use the poe task, wdyt?

 [tool.poe.tasks]
 test = { shell = "pytest" }
 test-fast = { shell = "pytest --durations=5 --exitfirst -m 'not slow'" }
 test-unit-tests = { shell = "pytest tests/unit_tests/" }
+test-unit-tests-coverage = { shell = "coverage run -m pytest tests/unit_tests/" }

If you want this discoverable by any internal CI helpers, consider appending it to the airbyte_ci list too:

 [tool.airbyte_ci]
 extra_poetry_groups = ["dev"]
-poe_tasks = ["test"]
+poe_tasks = ["test", "test-unit-tests"]
.github/workflows/python_pytest.yml (2)

146-146: Dynamic job name reads fine; prefer a matrix flag to avoid duplicating expressions?

The inline ternary works, but you’re now repeating the same condition here and in the pytest command. Would you consider introducing a matrix field (e.g., subset: unit|all) and referencing it in both places for clarity, wdyt?

   strategy:
     matrix:
-      python-version: [
+      python-version: [
         '3.10',
         '3.11',
       ]
-      os: [
-        Ubuntu,
-        Windows,
-      ]
+      os: [Ubuntu, Windows]
+      include:
+        - os: Windows
+          subset: Unit Tests Only
+          test_path: tests/unit_tests/
+        - os: Ubuntu
+          subset: All Tests
+          test_path: ""
   fail-fast: false
@@
-  name: Pytest (${{ matrix.os == 'Windows' && 'Unit Tests Only' || 'All Tests' }}, Python ${{ matrix.python-version }}, ${{ matrix.os }})
+  name: Pytest (${{ matrix.subset }}, Python ${{ matrix.python-version }}, ${{ matrix.os }})

190-194: Switch to the poe task (or a matrix-provided path) for Windows to centralize test selection?

To keep logic DRY and aligned with pyproject, would you like to drive the path via matrix (see prior comment) or call the poe task on Windows, wdyt?

Option A (use matrix.test_path from prior diff):

-        poetry run coverage run -m pytest
-        --verbose
-        ${{ matrix.os == 'Windows' && 'tests/unit_tests/' || '' }}
+        poetry run coverage run -m pytest --verbose ${{ matrix.test_path }}
         -m "not linting and not super_slow and not flaky"

Option B (split steps and reuse poe task):

-    - name: Run Pytest
+    - name: Run Pytest (Windows - Unit)
+      if: matrix.os == 'Windows'
       timeout-minutes: 60
       env:
         GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
-      run: >
-        poetry run coverage run -m pytest
-        --verbose
-        ${{ matrix.os == 'Windows' && 'tests/unit_tests/' || '' }}
-        -m "not linting and not super_slow and not flaky"
+      run: >
+        poetry run coverage run -m poe test-unit-tests
+        -m "not linting and not super_slow and not flaky"
+
+    - name: Run Pytest (Ubuntu - Full)
+      if: matrix.os == 'Ubuntu'
+      timeout-minutes: 60
+      env:
+        GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
+      run: >
+        poetry run coverage run -m pytest --verbose
+        -m "not linting and not super_slow and not flaky"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between beb6665 and 1d160b0.

📒 Files selected for processing (2)
  • .github/workflows/python_pytest.yml (2 hunks)
  • pyproject.toml (1 hunks)
🧰 Additional context used
🪛 GitHub Check: CodeQL
.github/workflows/python_pytest.yml

[warning] 146-229: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (Unit Tests Only, Python 3.11, Windows)
  • GitHub Check: Pytest (Unit Tests Only, Python 3.10, Windows)
  • GitHub Check: Pytest (All Tests, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All Tests, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (No Creds)
🔇 Additional comments (1)
.github/workflows/python_pytest.yml (1)

164-176: Approve runner labels and tests setup

Ubuntu-latest and Windows-latest resolve correctly on Actions, and tests/unit_tests contains 82 tests—can we remove the extra verification script? wdyt?

Copy link

github-actions bot commented Sep 9, 2025

PyTest Results (Fast Tests Only, No Creds)

301 tests  ±0   300 ✅ ±0   4m 37s ⏱️ -6s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3bb83b2. ± Comparison against base commit beb6665.

@aaronsteers aaronsteers enabled auto-merge (squash) September 9, 2025 20:53
Copy link

github-actions bot commented Sep 9, 2025

PyTest Results (Full)

364 tests  ±0   348 ✅ +1   22m 22s ⏱️ - 1m 33s
  1 suites ±0    16 💤 ±0 
  1 files   ±0     0 ❌  - 1 

Results for commit 3bb83b2. ± Comparison against base commit beb6665.

@aaronsteers aaronsteers merged commit e2f3fd5 into main Sep 9, 2025
24 checks passed
@aaronsteers aaronsteers deleted the devin/1757450012-skip-windows-integration-tests branch September 9, 2025 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant