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: Add workflow for releases from GHA #1117

Merged
merged 18 commits into from
Jul 4, 2024
Merged

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Jul 3, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a workflow for automating releases, including building, testing, and publishing package distributions to PyPI.
    • Updated macOS build version from macOS 11 to macOS 13 for application download links.
  • Bug Fixes

    • Improved Pydantic 2 compatibility.
    • Fixed issues with rendering icons in colormap preview and test validation length for sentry-sdk 2.0 release.
  • Refactor

    • Migrated project configuration to pyproject.toml.
    • Updated hidden imports and removed redundant module references for better performance.
  • Chores

    • Enhanced coverage reporting and artifact handling.
    • Updated pre-commit configurations and added new rules for codespell.
    • Incorporated security updates for dependencies.
  • Documentation

    • Updated README and changelog to reflect the latest changes and references to GitHub releases.

@Czaki Czaki added this to the 0.15.3 milestone Jul 3, 2024
Copy link
Contributor

sourcery-ai bot commented Jul 3, 2024

🧙 Sourcery has finished reviewing your pull request!


Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

The updates encompass multiple enhancements to improve functionality, including workflow automation for building and publishing releases, macOS version updates, and codebase compatibility upgrades. Key adjustments involve adding jobs in GitHub Actions for release management, Pydantic 2 compatibility improvements, refined import handling, and addressing text encoding in setup files. Overall, these changes streamline the build process, improve code stability, and ensure compatibility with updated dependencies.

Changes

File / Path Change Summary
.github/workflows/make_release.yml Added workflow for building, testing, and publishing releases, integrate release note generation and artifact management.
Readme.md Updated macOS build version reference from macOS 11 to macOS 13.
changelog.md Documented changes for version 0.15.3, including compatibility and bug fixes.
build_utils/create_and_pack_executable.py Added logic to append "-arm64" to archive filenames for macOS arm64.
launcher.spec Removed and adjusted hidden imports for various modules.
setup.py Added UTF-8 encoding to file read operations.
pyproject.toml Introduced a platform-specific condition for the PyOpenGL-accelerate dependency.

Poem

🐇 In code's vast embrace,
A release sets its pace,
Building wheels, bundling new,
For macOS updates too.
UTF-8 for clearer sight,
Bugs fixed, it's dynamite!
With each step, brighter grows
The path where our project flows. 🚀


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c41e051 and a2dc9a6.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Additional comments not posted (3)
.github/workflows/make_release.yml (3)

11-24: Verify the necessity of permissions and the appropriateness of the action.

Ensure that the write permissions for attestations and id-token are necessary for the build_wheels job. Additionally, verify that the hynek/build-and-inspect-python-package action is suitable for your use case.


26-60: Verify the appropriateness of steps for each OS and the correctness of dependency installations.

Ensure that the steps for setting up Python, installing dependencies, and building/testing PyInstaller bundles are appropriate for each OS in the matrix. Additionally, verify that the dependencies are correctly installed, especially the conditional installation of Windows OpenGL libraries.


63-84: Verify the appropriateness and security of steps for downloading artifacts and publishing to PyPI.

Ensure that the steps for downloading artifacts using actions/download-artifact and publishing to PyPI using pypa/gh-action-pypi-publish are appropriate and secure. Verify that the id-token permission is necessary and properly configured.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a2dc9a6 and 3cfa7b8.

Files selected for processing (2)
  • .github/workflows/make_release.yml (1 hunks)
  • build_utils/create_and_pack_executable.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml
Additional comments not posted (1)
build_utils/create_and_pack_executable.py (1)

26-28: LGTM! The changes correctly handle macOS arm64 architecture.

The logic to append "-arm64" to the archive file name if the platform is macOS and the machine is arm64 is implemented correctly.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3cfa7b8 and 0208fc3.

Files selected for processing (4)
  • .github/workflows/make_release.yml (1 hunks)
  • Readme.md (1 hunks)
  • changelog.md (1 hunks)
  • launcher.spec (4 hunks)
Files skipped from review due to trivial changes (1)
  • Readme.md
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml
Additional context used
LanguageTool
changelog.md

[grammar] ~85-~85: The operating system from Apple is written “macOS”.
Context: ...] pre-commit autoupdate (#1103) - Bump macos runners to macos-13 (both azure and GHA...

(MAC_OS)

Additional comments not posted (12)
launcher.spec (3)

67-67: Approved: Necessary hidden imports added.

The addition of "pkg_resources.py2_warn" and "ipykernel.datapub" to the hiddenimports list ensures these modules are included in the PyInstaller bundle.


95-95: Approved: Include imageio known plugins.

The inclusion of module names from imageio_known_plugins in the hiddenimports list ensures that all known plugins from imageio are included in the PyInstaller bundle.


96-96: Approved: Include skimage submodules.

The inclusion of submodules from skimage that do not contain "tests" in the hiddenimports list ensures that all necessary submodules are included in the PyInstaller bundle while excluding unnecessary test modules.

changelog.md (9)

3-3: Approved: Version header added.

The version header for 0.15.3 with the date 2024-07-03 correctly documents the new version and its release date.


7-7: Approved: Feature entry added.

The feature entry for Pydantic 2 compatibility correctly documents a new feature.


11-14: Approved: Bug fix entries added.

The bug fix entries for rendering icons, validation length of message, reader check, and napari compatibility correctly document the bug fixes included in this version.


18-21: Approved: Refactor entries added.

The refactor entries for fixing Qt flags and migrating to pyproject.toml correctly document the refactorings included in this version.


25-25: Approved: Documentation entry added.

The documentation entry for allowing the use of newer release of build docs dependencies correctly documents the documentation update included in this version.


29-45: Approved: Testing entries added.

The testing entries for automatic constraints upgrades and improvements to the test suite correctly document the testing updates included in this version.


49-87: Approved: Miscellaneous tasks entries added.

The miscellaneous tasks entries for pre-commit autoupdates, plugin page removal, coverage upload, actions updates, and more correctly document the miscellaneous tasks included in this version.

Tools
LanguageTool

[grammar] ~85-~85: The operating system from Apple is written “macOS”.
Context: ...] pre-commit autoupdate (#1103) - Bump macos runners to macos-13 (both azure and GHA...

(MAC_OS)


91-99: Approved: Security entries added.

The security entries for dependency bumps correctly document the security updates included in this version.


103-104: Approved: Build entries added.

The build entries for fixing the bundling of a font file and updating references to GitHub releases correctly document the build updates included in this version.

- Exclude pyside2 on python 3.11 and 3.12 from testing (#1099)
- \[pre-commit.ci\] pre-commit autoupdate (#1101)
- \[pre-commit.ci\] pre-commit autoupdate (#1103)
- Bump macos runners to macos-13 (both azure and GHA) (#1113)
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix grammar: Capitalize "macOS".

The operating system from Apple is written “macOS”.

- Bump macos runners to macos-13 (both azure and GHA)
+ Bump macOS runners to macOS-13 (both azure and GHA)
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
- Bump macos runners to macos-13 (both azure and GHA) (#1113)
- Bump macos runners to macos-13 (both azure and GHA)
+ Bump macOS runners to macOS-13 (both azure and GHA)
Tools
LanguageTool

[grammar] ~85-~85: The operating system from Apple is written “macOS”.
Context: ...] pre-commit autoupdate (#1103) - Bump macos runners to macos-13 (both azure and GHA...

(MAC_OS)

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0208fc3 and 2bba326.

Files selected for processing (1)
  • setup.py (1 hunks)
Additional comments not posted (2)
setup.py (2)

21-21: Ensure proper text encoding for Readme.md.

The addition of encoding="utf8" to the open() call ensures that the file is read with the correct encoding, preventing potential issues with non-ASCII characters.


29-29: Ensure proper text encoding for changelog.md.

The addition of encoding="utf8" to the open() call ensures that the file is read with the correct encoding, preventing potential issues with non-ASCII characters.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2bba326 and 60c3715.

Files selected for processing (3)
  • .github/workflows/make_release.yml (1 hunks)
  • pyproject.toml (2 hunks)
  • setup.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • setup.py
Additional comments not posted (11)
.github/workflows/make_release.yml (7)

11-17: Ensure proper permissions for the build_wheels job.

The permissions for attestations and id-token are set to write. Verify that these permissions are necessary and do not pose a security risk.


26-31: Consider adding macOS 14 to the matrix.

The matrix strategy includes macOS 13 but macOS 14 is commented out. Verify if macOS 14 should be included.


39-45: Verify the installation of Windows OpenGL.

The script clones a repository and runs a PowerShell script to install OpenGL. Ensure that the repository is trusted and the script is secure.


58-61: Ensure the test command is correct.

The test command dist/PartSeg/PartSeg _test should be verified to ensure it correctly tests the built bundle.


65-68: Ensure proper permissions for the create_release job.

The permissions for id-token are set to write. Verify that this permission is necessary and does not pose a security risk.


84-87: Verify the release notes generation script.

The script build_utils/cut_changelog.py is used to generate release notes. Ensure that the script is secure and correctly generates the release notes.


102-104: Ensure the PyPI publish step is secure.

The step uses pypa/gh-action-pypi-publish@release/v1 to publish package distributions to PyPI. Verify that the action is secure and correctly configured.

pyproject.toml (4)

102-102: Ensure compatibility with arm64.

The condition platform_machine != 'arm64' is added for PyOpenGL-accelerate. Verify that this condition is necessary and does not affect compatibility with arm64.


118-118: Ensure compatibility with arm64.

The condition platform_machine != 'arm64' is added for PyOpenGL-accelerate. Verify that this condition is necessary and does not affect compatibility with arm64.


118-118: Ensure compatibility with arm64.

The condition platform_machine != 'arm64' is added for PyOpenGL-accelerate. Verify that this condition is necessary and does not affect compatibility with arm64.


118-118: Ensure compatibility with arm64.

The condition platform_machine != 'arm64' is added for PyOpenGL-accelerate. Verify that this condition is necessary and does not affect compatibility with arm64.

Comment on lines 46 to 47
- name: Install PartSeg
run: python -m pip install -e .[pyinstaller] -c requirements/constraints_py3.10.txt
Copy link
Contributor

@coderabbitai coderabbitai bot Jul 3, 2024

Choose a reason for hiding this comment

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

Pin the versions of dependencies.

The pip install command does not pin the versions of dependencies. This could lead to issues with future updates.

      - name: Install PartSeg
        run: python -m pip install -e .[pyinstaller] -c requirements/constraints_py3.10.txt
+       run: python -m pip install -r requirements.txt

Committable suggestion was skipped due to low confidence.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it pin using constraints file

Copy link
Contributor

Choose a reason for hiding this comment

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

@Czaki, you are correct. The requirements/constraints_py3.10.txt file does pin the versions of the dependencies. Thank you for the clarification.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Display the contents of the constraints file to verify if it pins the versions of dependencies.
cat requirements/constraints_py3.10.txt

Length of output: 8043


Learnings added
Learnt from: Czaki
PR: 4DNucleome/PartSeg#1117
File: .github/workflows/make_release.yml:46-47
Timestamp: 2024-07-03T14:07:21.406Z
Learning: The `requirements/constraints_py3.10.txt` file is used to pin the versions of dependencies in the `pip install` command for the PartSeg project.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +18 to +24
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: 'true'

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a step to set up Python.

The job is missing a step to set up the Python environment before using hynek/build-and-inspect-python-package@v2. This could lead to issues if the correct Python version is not available.

      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
+     - uses: actions/setup-python@v5
+       with:
+         python-version: "3.10"
      - uses: hynek/build-and-inspect-python-package@v2
        with:
          attest-build-provenance-github: 'true'
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@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: 'true'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: 'true'

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 60c3715 and de828a8.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between de828a8 and 66f89b0.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 66f89b0 and 44f58b7.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 44f58b7 and df13613.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml

Copy link

sonarcloud bot commented Jul 4, 2024

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df13613 and de2ffcd.

Files selected for processing (1)
  • .github/workflows/make_release.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/make_release.yml

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.93%. Comparing base (65e788f) to head (de2ffcd).
Report is 84 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1117      +/-   ##
===========================================
+ Coverage    92.91%   92.93%   +0.01%     
===========================================
  Files          205      205              
  Lines        32519    32519              
===========================================
+ Hits         30215    30220       +5     
+ Misses        2304     2299       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Czaki Czaki merged commit 8288ed8 into develop Jul 4, 2024
61 checks passed
@Czaki Czaki deleted the create_release_workflow branch July 4, 2024 11:04
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