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: Fix workflow failure caused by missing Python 3.7 in the latest macOS runner. #42

Merged
merged 7 commits into from
Nov 29, 2024

Conversation

LinZhihao-723
Copy link
Member

@LinZhihao-723 LinZhihao-723 commented Nov 28, 2024

References

Description

The package workflow failed in the current repo: https://github.com/LinZhihao-723/clp-loglib-py/actions/runs/12060286918, which is because Python3.7 is no longer valid in the latest macos runner (macos14) for arm64.
This PR fixes the issue by testing Python3.7 in macos13. It redoes part of the changes in #41 to create a stand-alone test section for Python 3.7 to facilitate the management of our workflow config. It also makes it easier to fully remove Python 3.7 testing if we drop support for Python 3.7 (which may be soon 'cuz Python 3.7 has been reached EOL for longer than a year). For Python versions higher than 3.7, we stick to the latest macos runner to ensure the Apple silicon is tested.

Validation performed

Ensure workflows all passed.

Summary by CodeRabbit

  • New Features

    • Introduced a new testing job for Python versions 3.8 and 3.11.
  • Changes

    • Renamed the existing test job to focus solely on Python 3.7.
    • Simplified testing configurations for better clarity and efficiency.

Copy link

coderabbitai bot commented Nov 28, 2024

Walkthrough

The changes in the pull request involve modifications to the GitHub Actions workflow configuration in .github/workflows/package.yaml. The existing job test has been renamed to test-python37, focusing solely on Python 3.7. A new job named test has been introduced to handle testing for Python versions 3.8 and 3.11. The matrix for test-python37 has been simplified, and the job now includes steps to install dependencies and run unit tests, which were previously part of the test job.

Changes

File Change Summary
.github/workflows/package.yaml Renamed job test to test-python37, added new job test for Python 3.8 and 3.11, simplified matrix for test-python37, and adjusted wheel downloading logic.

Sequence Diagram(s)

sequenceDiagram
    participant A as GitHub Actions
    participant B as Code Repository
    participant C as Python 3.7
    participant D as Python 3.8
    participant E as Python 3.11

    A->>B: Checkout code
    A->>C: Setup Python 3.7
    A->>C: Download wheels for Python 3.7
    A->>C: Install dependencies
    A->>C: Run unit tests

    A->>B: Checkout code
    A->>D: Setup Python 3.8
    A->>D: Download wheels for Python 3.8
    A->>D: Install dependencies
    A->>D: Run unit tests

    A->>B: Checkout code
    A->>E: Setup Python 3.11
    A->>E: Download wheels for Python 3.11
    A->>E: Install dependencies
    A->>E: Run unit tests
Loading

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

@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: 1

🧹 Outside diff range and nitpick comments (2)
.github/workflows/package.yaml (2)

41-46: Add comments explaining Python 3.7 special handling

Since this job specifically handles Python 3.7 testing due to macOS compatibility issues, it would be helpful to add comments explaining why this separation exists and the dependency on Python 3.8 wheels.

Add a comment like this:

+  # Separate job for Python 3.7 testing due to its unavailability on macOS 14 (arm64).
+  # Uses Python 3.8 wheels as they maintain compatibility with Python 3.7.
   test-python37:

82-84: Update GitHub Actions to latest versions

Consider updating the following actions to their latest versions for improved security and features:

  • actions/checkout@v3actions/checkout@v4
  • actions/download-artifact@v3actions/download-artifact@v4

Also applies to: 62-62

🧰 Tools
🪛 actionlint (1.7.4)

82-82: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6d355d3 and 3d6a315.

📒 Files selected for processing (1)
  • .github/workflows/package.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/package.yaml

62-62: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


82-82: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/package.yaml (2)

78-78: Verify macOS runner version

Please verify that macos-latest resolves to macOS 14 as intended. If specific version guarantees are needed, consider using an explicit version like macos-14.


Line range hint 41-98: Overall changes look good

The workflow restructuring successfully addresses the Python 3.7 compatibility issue on macOS while maintaining a clean separation that will facilitate future removal of Python 3.7 support. The implementation aligns well with the PR objectives.

🧰 Tools
🪛 actionlint (1.7.4)

56-56: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


62-62: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


82-82: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


89-89: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/package.yaml Outdated Show resolved Hide resolved
Copy link

@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: 2

🧹 Outside diff range and nitpick comments (1)
.github/workflows/package.yaml (1)

41-46: Consider standardizing the job name format

The job name test-python37 uses a different format than typical semantic versioning. Consider using test-python-3.7 for better consistency with version number formatting.

-  test-python37:
+  test-python-3.7:
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6a315 and 2721d6a.

📒 Files selected for processing (1)
  • .github/workflows/package.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/package.yaml

76-76: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


78-78: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (1)
.github/workflows/package.yaml (1)

68-74: Verify workflow job dependencies

The job structure looks good, but let's verify that all necessary artifacts are available for both test jobs.

✅ Verification successful

Job dependencies and artifacts are correctly configured

The workflow structure is well-organized with proper artifact handling:

  • The build job generates wheels for both Python 3.8 and 3.11
  • Each test job downloads the corresponding wheel artifact matching its Python version
  • The test-python37 job specifically uses the Python 3.8 wheel, which is compatible with Python 3.7
  • All test jobs properly depend on the build job completion
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workflow generates all required wheel artifacts

# Check if wheel artifacts are defined for all Python versions
rg -A 2 'name: wheel-' .github/workflows/package.yaml | grep -E 'wheel-(3\.[0-9]+)'

Length of output: 111


Script:

#!/bin/bash
# Let's check the complete build job configuration to understand artifact generation
cat .github/workflows/package.yaml

Length of output: 2113

Comment on lines +76 to +80
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update GitHub Actions to latest versions

Several actions are using older versions. Consider updating to the latest stable versions for improved security and features:

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4

-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
🧰 Tools
🪛 actionlint (1.7.4)

76-76: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


78-78: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/package.yaml Outdated Show resolved Hide resolved
Copy link

@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 (1)
.github/workflows/package.yaml (1)

Line range hint 49-52: Update GitHub Actions to latest versions

Several actions are using older versions. Consider updating to the latest stable versions for improved security and features:

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4

-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
🧰 Tools
🪛 actionlint (1.7.4)

49-49: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2721d6a and f974a51.

📒 Files selected for processing (1)
  • .github/workflows/package.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/package.yaml

77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (3)
.github/workflows/package.yaml (3)

Line range hint 41-68: LGTM! Good job separating Python 3.7 testing

The configuration correctly handles Python 3.7 testing on macOS 13, which resolves the original issue with macOS 14 compatibility. The comment explaining the use of Python 3.8 wheel is helpful for future maintenance.

🧰 Tools
🪛 actionlint (1.7.4)

56-56: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


Line range hint 69-94: LGTM! Proper configuration for Python 3.8+ testing

The job is well-structured and correctly uses the latest macOS runner for Python versions that support it.

🧰 Tools
🪛 actionlint (1.7.4)

56-56: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: the runner of "actions/download-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


77-81: Update GitHub Actions to latest versions

🧰 Tools
🪛 actionlint (1.7.4)

77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

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

For the PR title, how about:

ci: Fix workflow failure caused by missing Python 3.7 in the latest macOS runner.

.github/workflows/package.yaml Outdated Show resolved Hide resolved
@LinZhihao-723 LinZhihao-723 changed the title ci: Fix workflow failure due to missing Python 3.7 in the latest macOS runner. ci: Fix workflow failure caused by missing Python 3.7 in the latest macOS runner. Nov 29, 2024
Copy link

@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 (1)
.github/workflows/package.yaml (1)

41-46: Document Python 3.7 EOL status and future plans

Since Python 3.7 reached end-of-life over a year ago, consider adding a comment explaining why we're maintaining Python 3.7 support and when we plan to remove it.

Add a comment like:

  test-python37:
    needs: [build]
+   # TODO: Remove Python 3.7 support in future release as it reached EOL on 2023-06-27
+   # Maintained temporarily for backwards compatibility
    strategy:
      matrix:
        os: [macos-13, ubuntu-latest]
        python-version: ["3.7"]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f974a51 and 283e6b7.

📒 Files selected for processing (1)
  • .github/workflows/package.yaml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/package.yaml

77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/package.yaml (2)

77-81: 🛠️ Refactor suggestion

Update GitHub Actions to latest versions

Several actions are using older versions. Consider updating to the latest stable versions for improved security and features.

Apply this diff:

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4

-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5

Note: This same update should be applied to all occurrences of these actions in the workflow file.

🧰 Tools
🪛 actionlint (1.7.4)

77-77: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


79-79: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


58-60: Verify Python 3.8 wheel compatibility with Python 3.7

While the comment explains why we're using the Python 3.8 wheel, we should verify that this doesn't introduce compatibility issues.

✅ Verification successful

Based on the codebase analysis, I can now provide a definitive response regarding the Python 3.8 wheel compatibility with Python 3.7.

Python 3.7 compatibility is confirmed

The codebase shows no usage of Python 3.8-specific features that would break compatibility with Python 3.7:

  • No usage of assignment expressions (walrus operator)
  • No positional-only parameters
  • No f-string = specifier
  • The imports and type hints used are compatible with Python 3.7
  • The only special import handling is for zoneinfo, which has a proper fallback to backports.zoneinfo for older Python versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for Python version specific features or dependencies
rg -g '*.py' -A 5 'from __future__ import' || \
rg -g '*.py' -A 5 '@typing\.' || \
rg -g 'requirements*.txt' -A 5 'python_version'

Length of output: 124


Script:

#!/bin/bash
# Check for Python version requirements in setup files and other configuration
fd -e py setup.py -x cat {} \; || \
fd -g 'pyproject.toml' -x cat {} \; || \
fd -g '*requirements*.txt' -x cat {} \; || \
fd -g 'tox.ini' -x cat {} \;

Length of output: 35


Script:

#!/bin/bash
# Let's check the actual Python files to understand the codebase structure and dependencies
fd -e py -x echo "=== {} ===" \; -x cat {} \; || \
fd -g '*.py' -x echo "=== {} ===" \; -x cat {} \;

Length of output: 97211

@LinZhihao-723 LinZhihao-723 merged commit 43d1eaa into y-scope:main Nov 29, 2024
9 checks passed
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.

2 participants