Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: update test workflows #26

Merged
merged 9 commits into from
Nov 12, 2024
Merged

CI: update test workflows #26

merged 9 commits into from
Nov 12, 2024

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Nov 12, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new GitHub Actions workflow for automated testing using Pytest.
    • Enhanced connector testing workflow with improved flexibility and clarity.
  • Changes

    • Updated workflow names and triggers for better organization and responsiveness.
    • Comprehensive configuration for managing dependencies and development tasks in the project.
  • Bug Fixes

    • Adjusted job conditions to ensure tests run only on relevant changes.

@github-actions github-actions bot added the ci label Nov 12, 2024
Copy link
Contributor

coderabbitai bot commented Nov 12, 2024

📝 Walkthrough

Walkthrough

This pull request introduces several changes to the project's GitHub Actions workflows and the pyproject.toml configuration. A new workflow, pytest_fast.yml, is added to automate fast testing with coverage reporting. The existing pytest_matrix.yml workflow has been modified to remove the fast test job and streamline the testing process across multiple Python versions. Additionally, the connector-tests.yml workflow has been updated for improved clarity and flexibility in testing connectors. The pyproject.toml file has been extensively restructured to define project dependencies and metadata.

Changes

File Change Summary
.github/workflows/pytest_fast.yml New workflow added to automate fast testing with coverage reporting.
.github/workflows/pytest_matrix.yml Workflow name changed to "PyTest Matrix," with updated triggers and removal of the pytest-fast job. The remaining job now runs all tests.
pyproject.toml Comprehensive configuration added, detailing dependencies, development tasks, and project metadata. New sections for dependencies, tasks, and options for pytest included.
.github/workflows/connector-tests.yml Workflow name changed to "Test Connectors," with expanded triggers and updated job conditions. New checkout steps added for CDK and Airbyte Monorepo.

Possibly related PRs

  • chore: use dynamic versioning #24: The changes in pyproject.toml related to dynamic versioning are relevant as they may affect the dependency management and testing processes outlined in the new pytest_fast.yml workflow.

Suggested labels

chore


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 3

🧹 Outside diff range and nitpick comments (12)
.github/workflows/pytest_fast.yml (3)

3-16: Consider expanding path triggers for test-related changes

Hey! The current path triggers look good, but what do you think about including test-related files? This would ensure the workflow runs when test files are modified. Maybe something like this, wdyt? 🤔

 on:
   push:
     branches:
       - main
     paths:
       - 'airbyte_cdk/**'
       - 'poetry.lock'
       - 'pyproject.toml'
+      - 'unit_tests/**'
+      - '.github/workflows/pytest*.yml'
   pull_request:
     paths:
       - 'airbyte_cdk/**'
       - 'poetry.lock'
       - 'pyproject.toml'
+      - 'unit_tests/**'
+      - '.github/workflows/pytest*.yml'

35-35: Consider optimizing dependency installation

Hey! I noticed we're installing all extras. For test runs, we might not need everything. Would it make sense to install only test-related extras to speed up the workflow? Something like this perhaps? 🚀

-        run: poetry install --all-extras
+        run: poetry install --extras "test"

56-71: Consider adding coverage thresholds and artifact retention

The coverage setup looks great! A couple of suggestions to make it even better:

  1. Should we add a minimum coverage threshold? We could fail the build if coverage drops below a certain percentage.
  2. Maybe we should set a retention period for the coverage artifacts to manage storage?
       - name: Upload coverage to GitHub Artifacts
         if: always()
         uses: actions/upload-artifact@v4
         with:
           name: fasttest-coverage
           path: htmlcov/
+          retention-days: 14

And for coverage threshold:

       - name: Print Coverage Report
         if: always()
-        run: poetry run coverage report
+        run: poetry run coverage report --fail-under=80

What do you think about these numbers? 📊

.github/workflows/pytest_matrix.yml (4)

14-22: Consider expanding path triggers for comprehensive coverage

The path triggers look good for catching direct changes, but what about test files? Would it make sense to also include tests/** in the paths to catch changes in test files themselves? wdyt? 🤔

    paths:
      - 'airbyte_cdk/**'
      - 'poetry.lock'
      - 'pyproject.toml'
+     - 'tests/**'

Line range hint 31-33: Track Python 3.12 compatibility

The comment indicates Pendulum is blocking Python 3.12 support. Should we create an issue to track this and set a reminder to revisit once Pendulum adds support? Happy to help create one! 🎯


Line range hint 35-37: Document Windows testing status

The comment mentions Windows is excluded from the test matrix. Should we add a TODO with context or create an issue to track when/if Windows support will be added back? I can help document this if you'd like! 📝


Line range hint 44-46: Track UTF-8 encoding enforcement

There's a TODO about enforcing UTF-8 encoding within PyAirbyte itself. Would you like me to create an issue to track this improvement? It could help remove this environment-specific workaround! 🔧

.github/workflows/test-connectors.yml (3)

22-23: Consider adding more defensive checks to the job condition

The current condition only checks for workflow success. What do you think about also checking if the workflow run exists when it's a workflow_run trigger? Something like this:

-    if: ${{ github.event.workflow_run.conclusion == 'success' }}
+    if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run && github.event.workflow_run.conclusion == 'success') }}

wdyt? 🤔


Line range hint 65-73: Question about the commented-out connector

I notice source-zendesk-support is commented out with a note about CI not passing. Would it be helpful to create an issue to track this and remove the commented code? I can help create that issue if you'd like!


Line range hint 61-63: Consider reviewing the timeout value

The 6-hour timeout seems quite generous. Based on the 90-minute timeout for individual connector tests, perhaps we could reduce this? What about starting with 3 hours (180 minutes) and adjusting based on actual run times?

pyproject.toml (2)

Line range hint 1-4: Consider adding a comment about the versioning strategy? 🤔

I see you're using poetry-dynamic-versioning with a placeholder "0.0.0" version. While there's a link to the docs, would it be helpful to add a brief comment about which git tags/refs are used for version calculation? This could help other contributors understand the versioning strategy better, wdyt?

Also applies to: 24-25


Line range hint 33-36: Should we pin the versions for better reproducibility? 🔒

I notice that some dependencies like backoff, cachetools, requests, and requests_cache use "*" as their version constraint. While this gives us the latest versions, it might lead to unexpected breaking changes in production. Would it make sense to pin these to specific versions or at least use version ranges (e.g., "^2.0.0") for better reproducibility, wdyt?

Also applies to: 42-43

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2edf3fa and c146270.

📒 Files selected for processing (4)
  • .github/workflows/pytest_fast.yml (1 hunks)
  • .github/workflows/pytest_matrix.yml (1 hunks)
  • .github/workflows/test-connectors.yml (2 hunks)
  • pyproject.toml (1 hunks)
🔇 Additional comments (6)
.github/workflows/pytest_matrix.yml (2)

Line range hint 1-93: Overall changes look great! 👍

The workflow separation and matrix configuration are well thought out. The coverage reporting is robust with proper fallbacks, and the conditions for running on forks vs. main branch are clear.


Line range hint 73-77: Verify test timeout duration

The 60-minute timeout seems quite generous. Should we check the historical run times in GitHub Actions to see if we can tighten this up a bit? I can help analyze the logs if you'd like! ⏱️

.github/workflows/test-connectors.yml (1)

Line range hint 9-17: Nice work on the concurrency configuration! 👍

The concurrency setup is well thought out - it prevents parallel runs for PRs while allowing multiple workflow dispatches. The comments explaining the logic are particularly helpful.

pyproject.toml (3)

Line range hint 143-144: Is ignoring task failures intentional? ⚠️

I noticed ignore_fail = "return_non_zero" in format-check and format-fix tasks. This means the sequence will continue even if a task fails. While this might be desired for formatting tasks, it could potentially mask important issues. Should we make this behavior more explicit in the task descriptions, wdyt?

#!/bin/bash
# Check if there are any recent CI failures related to these tasks
gh run list --repo airbytehq/airbyte-python-cdk --workflow pytest_matrix.yml --json conclusion,name | \
  jq '.[] | select(.conclusion == "failure" and (.name | contains("format")))'

Also applies to: 147-148


Line range hint 193-196: Should we document the experimental features? 📝

I see we're filtering out ExperimentalClassWarning. To ensure users are aware of which features are experimental, would it be helpful to add a section in the README or documentation listing these features? This could help users make informed decisions about using them in production, wdyt?

#!/bin/bash
# Look for experimental features in the codebase
rg -l "ExperimentalClassWarning" || echo "No direct references found"

Line range hint 127-131: Shall we check if issue #12 is still relevant? 🔍

The TODO comments reference issue #12 for excluding __init__.py files. Let me check if this is still relevant.

✅ Verification successful

Issue #12 is still open and relevant - shall we keep the TODO comments for now? 🤔

The issue about circular imports in __init__.py files is still open and active. The TODO comments in the pyproject.toml are serving as important reminders of this known limitation, where excluding __init__.py files from formatting is a temporary workaround until the circular reference issue is resolved.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced issue is still open
gh issue view 12 --repo airbytehq/airbyte-python-cdk || echo "Issue not found or not accessible"

# Check for __init__.py files that might be affected
find . -name "__init__.py" -type f -exec grep -l "^from\|^import" {} \;

Length of output: 781


Script:

#!/bin/bash
# Let's search for any TODO comments in isort and ruff configurations
rg -i "todo.*issue.*#12|issue.*#12.*todo" pyproject.toml

# Let's also check for any __init__.py exclusions in the config
rg "__init__.py" pyproject.toml

# Let's find all __init__.py files with imports to understand the scope
find . -name "__init__.py" -type f | while read -r file; do
  if grep -q "^from\|^import" "$file"; then
    echo "=== $file ==="
    head -n 5 "$file"
    echo "..."
  fi
done

Length of output: 29059


Script:

#!/bin/bash
# Let's check if issue #12 still exists in the repository
gh issue view 12

# Let's also check the git history of these TODO comments to understand their context
git log -p -- pyproject.toml | grep -A 5 -B 5 "TODO.*issue.*#12"

# And check if there are any recent PRs or discussions about this
gh pr list --search "issue #12 in:title,body"

Length of output: 287

.github/workflows/pytest_fast.yml Outdated Show resolved Hide resolved
.github/workflows/pytest_fast.yml Outdated Show resolved Hide resolved
.github/workflows/test-connectors.yml Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (4)
.github/workflows/connector-tests.yml (4)

8-12: Consider implementing the workflow optimization? 🤔

The TODO comment suggests running these tests only after the "PyTest (Fast)" workflow succeeds. This could help reduce CI load by avoiding unnecessary runs. Would you like me to help implement this optimization using workflow_run trigger? wdyt?


82-82: Add matrix strategy documentation? 📝

The matrix strategy maps connectors to CDK extras, but the relationship isn't immediately clear. Maybe we could add a comment explaining:

  • Why certain connectors need specific extras
  • What "n/a" means for extras
  • Why some connectors are commented out

This would help future maintainers understand the configuration better. wdyt?


94-105: Consider using variables for checkout paths? 🔧

The paths 'airbyte-python-cdk' and 'airbyte' are hardcoded. Maybe we could make this more maintainable by defining them as variables at the job level? Something like:

env:
  CDK_PATH: airbyte-python-cdk
  MONOREPO_PATH: airbyte

Then reference them as ${{ env.CDK_PATH }} and ${{ env.MONOREPO_PATH }}. This would make path changes easier to manage. wdyt?


Line range hint 111-116: Fix shell command syntax? 🐛

There are some syntax issues in the test command. Here's a suggested fix:

  cd airbyte
  make tools.airbyte-ci-binary.install
  airbyte-ci connectors \
  --name ${{matrix.connector}} \
- test
- --global-status-check-context='Connectors Test: ${{matrix.connector}}'"
+ test \
+ --global-status-check-context='Connectors Test: ${{matrix.connector}}'

This fixes the line continuation and removes the stray quote. wdyt?

🧰 Tools
🪛 actionlint

111-111: shellcheck reported issue in this script: SC1009:info:6:1: The mentioned syntax error was in this simple command

(shellcheck)


111-111: shellcheck reported issue in this script: SC1073:error:6:71: Couldn't parse this double quoted string. Fix to allow more checks

(shellcheck)


111-111: shellcheck reported issue in this script: SC1072:error:8:1: Expected end of double quoted string. Fix any mentioned problems and try again

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ae4c90a and 6cfaa08.

📒 Files selected for processing (2)
  • .github/workflows/connector-tests.yml (3 hunks)
  • .github/workflows/pytest_fast.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pytest_fast.yml
🧰 Additional context used
🪛 actionlint
.github/workflows/connector-tests.yml

111-111: shellcheck reported issue in this script: SC1009:info:6:1: The mentioned syntax error was in this simple command

(shellcheck)


111-111: shellcheck reported issue in this script: SC1073:error:6:71: Couldn't parse this double quoted string. Fix to allow more checks

(shellcheck)


111-111: shellcheck reported issue in this script: SC1072:error:8:1: Expected end of double quoted string. Fix any mentioned problems and try again

(shellcheck)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant