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

Add workflow to test conda packages #1935

Merged
merged 56 commits into from
Sep 6, 2024

Conversation

roomrys
Copy link
Collaborator

@roomrys roomrys commented Sep 4, 2024

Description

Previously, we added a workflow in build_ci.yml which builds and installs SLEAP via the PyPI wheel and then runs our unit tests.

In this PR, we add another workflow in build_conda_ci.yml that builds and installs SLEAP through the conda package and then runs our unit tests. Also, I renamed build_ci.yml to build_pypi_ci.yml. I opted not to bundle the conda package build tests with the pypi build tests as they have some non-overlapping triggers (and the conda build is extremely expensive).

However, note that both these workflows use artifact-upload/download between build and test jobs which means that we could download the passing build packages from the provided link in action and use those to upload to conda and PyPI (instead of rebuilding in build.yml and build_manual.yml).


Currently, all package tests fail with:

=========================== short test summary info ============================
FAILED tests/io/test_videowriter.py::test_imageio_video_writer_avi - ModuleNotFoundError: No module named 'imageio_ffmpeg'
FAILED tests/io/test_videowriter.py::test_imageio_video_writer_odd_size - ModuleNotFoundError: No module named 'imageio_ffmpeg'
==== 2 failed, 693 passed, 11 skipped, 5665 warnings in 1074.01s (0:17:54) =====

when we attempt to

>       import imageio_ffmpeg as ffmpeg
E       ModuleNotFoundError: No module named 'imageio_ffmpeg'

. A repo search of develop shows that imageio-ffmpeg was added as a dependency to the environment yamls, but not to the meta yamls that build the conda packages. This PR does not fix this. Instead #1943 fixes this.


Types of changes

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (new workflow)

Does this address any currently open issues?

Outside contributors checklist

  • Review the guidelines for contributing to this repository
  • Read and sign the CLA and add yourself to the authors list
  • Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • Add tests that prove your fix is effective or that your feature works
  • Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

❤️

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced an automated workflow for building and testing Conda packages across multiple operating systems.
    • Updated the workflow for building Python packages with a more specific focus on PyPI tasks.
  • Improvements

    • Enhanced CI/CD pipeline reliability and efficiency through automated package building and testing.
    • Improved readability and maintainability of the PyPI CI workflow configuration.

Copy link

coderabbitai bot commented Sep 4, 2024

Walkthrough

The changes introduce a new GitHub Actions workflow for building and testing a Conda package across multiple operating systems. Additionally, the existing PyPI workflow is updated to reflect a more specific focus on PyPI tasks, with minor formatting improvements. These modifications aim to streamline the automation processes related to package building and testing.

Changes

Files Change Summary
.github/workflows/build_conda_ci.yml Introduced a new workflow for automating Conda package building and testing across Windows, Ubuntu, and macOS. Defines build and tests jobs with matrix strategy and conditional steps.
.github/workflows/build_pypi_ci.yml Updated workflow name to "Build PyPI CI (no upload)" and reformatted paths to use double quotes; minor formatting adjustments made for consistency.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant Conda Environment
    participant Test Environment

    Developer->>GitHub Actions: Push changes
    GitHub Actions->>Conda Environment: Set up environment
    GitHub Actions->>Conda Environment: Build Conda package
    Conda Environment-->>GitHub Actions: Upload artifacts
    GitHub Actions->>Test Environment: Set up testing environment
    Test Environment-->>GitHub Actions: Run tests
Loading

🐇 In fields of green, I hop with glee,
New workflows bloom, as bright as can be!
Conda builds and tests, oh what a sight,
PyPI shines, all polished and bright!
With each little change, our code takes flight,
Hooray for the updates, everything feels right! 🌼


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 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.

@roomrys roomrys marked this pull request as ready for review September 5, 2024 14:11
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, codebase verification and nitpick comments (1)
.github/workflows/build_conda_ci.yml (1)

16-19: Use of environment variables.

Defining environment variables at the workflow level is a good practice for reusability and maintaining consistency across jobs. However, the specific purpose of RUN_ID should be documented for clarity.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 35463a1 and 4b3ed81.

Files selected for processing (2)
  • .github/workflows/build_conda_ci.yml (1 hunks)
  • .github/workflows/build_pypi_ci.yml (5 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/build_pypi_ci.yml
Additional context used
actionlint
.github/workflows/build_conda_ci.yml

139-139: shellcheck reported issue in this script: SC1073:error:1:1: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


139-139: shellcheck reported issue in this script: SC1050:error:1:36: Expected 'then'

(shellcheck)


139-139: shellcheck reported issue in this script: SC1072:error:1:37: Unexpected . Fix any mentioned problems and try again

(shellcheck)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

Additional comments not posted (8)
.github/workflows/build_conda_ci.yml (8)

1-3: Clear and concise workflow description.

The initial comments and the name of the workflow are clear and provide a good overview of the workflow's purpose.


5-14: Appropriate triggers for the workflow.

The workflow is triggered by changes to relevant files, ensuring that any modifications that could affect the Conda build process are tested. This is a good practice as it helps in catching issues early in the development cycle.


20-42: Well-structured job definition with matrix strategy.

The matrix strategy is effectively used to run builds across different operating systems. The inclusion of specific configurations for each OS via the include keyword is a good practice, ensuring that each environment is correctly set up.


43-67: Detailed setup steps for the build environment.

The steps for checking out the code, setting up Miniconda, and printing the build environment info are well-defined. Using conditions to control the execution of these steps based on the RUN_BUILD_JOB environment variable is a good practice to optimize workflow runs.


68-83: Conditional build steps for different OS.

The separation of build steps for Windows and other OS is necessary due to different shell environments and potential build differences. This is well-handled here.


84-93: Efficient handling of build artifacts.

Uploading the build artifacts with a retention policy and allowing overwrites is a good practice for CI workflows, especially when subsequent jobs, like tests, depend on these artifacts.


94-126: Comprehensive testing setup.

The testing job is well-structured with its own matrix strategy and includes specific configurations for different OS. The use of conditional steps based on the OS for setting up the test environment is a good practice.


127-194: Detailed steps for testing the package.

The steps for checking out the repository, setting up Python, downloading the build artifact, and setting up Miniconda are well-defined. The final test step is particularly well-detailed, ensuring that the package is correctly installed and tested in a new Conda environment.

Tools
actionlint

139-139: shellcheck reported issue in this script: SC1073:error:1:1: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


139-139: shellcheck reported issue in this script: SC1050:error:1:36: Expected 'then'

(shellcheck)


139-139: shellcheck reported issue in this script: SC1072:error:1:37: Unexpected . Fix any mentioned problems and try again

(shellcheck)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

.github/workflows/build_conda_ci.yml Outdated Show resolved Hide resolved
instead of misleading "Use current run"
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b3ed81 and 8b162ae.

Files selected for processing (1)
  • .github/workflows/build_conda_ci.yml (1 hunks)
Additional context used
actionlint
.github/workflows/build_conda_ci.yml

139-139: shellcheck reported issue in this script: SC1073:error:1:1: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


139-139: shellcheck reported issue in this script: SC1050:error:1:36: Expected 'then'

(shellcheck)


139-139: shellcheck reported issue in this script: SC1072:error:1:37: Unexpected . Fix any mentioned problems and try again

(shellcheck)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

Additional comments not posted (1)
.github/workflows/build_conda_ci.yml (1)

1-194: Comprehensive Review of the New Conda CI Workflow

This review covers the newly introduced GitHub Actions workflow file build_conda_ci.yml, which is designed to build and test the SLEAP package using conda across multiple operating systems. The workflow is well-structured and uses a matrix strategy to handle different environments efficiently. Here are some specific observations and suggestions:

  1. Trigger Paths (Lines 7-14): The workflow is triggered by changes to several critical files, including .conda/meta.yaml and setup.py. This setup ensures that any significant changes in the package configuration or dependencies will initiate a new build and test cycle, which is a good practice.

  2. Environment Variables (Lines 16-18): The use of environment variables such as RUN_BUILD_JOB and RUN_ID is appropriate for controlling the flow within the workflow and for use across different jobs. However, the hardcoded RUN_ID might need to be dynamically generated or fetched depending on the context of the workflow execution.

  3. Matrix Strategy (Lines 26-41): The matrix strategy is comprehensive, covering different operating systems and special configurations for macOS. This approach is efficient for testing across multiple environments but ensure that the condarc and conda-folder paths are correctly set up for each environment.

  4. Deprecated Commands (Lines 139-154): As noted in previous comments and static analysis, the set-output command is deprecated. It's crucial to update these to the new syntax to avoid future deprecation issues. The recommended changes are:

    - echo "::set-output name=RUN_ID::$env:GITHUB_RUN_ID"
    + echo "RUN_ID=$env:GITHUB_RUN_ID" >> $GITHUB_OUTPUT
    
    - echo "::set-output name=RUN_ID::${{ github.run_id }}"
    + echo "RUN_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT

    These changes should be applied to ensure the workflow remains functional with future updates to GitHub Actions.

  5. Testing and Package Installation (Lines 180-194): The steps to create and activate the conda environment, and to install and test the package are well laid out. However, ensure that the conda-channels and the test commands are correctly configured to avoid issues like the one mentioned with the missing imageio_ffmpeg dependency.

Overall, the workflow file is well-constructed with attention to detail in handling different environments and testing scenarios. Ensure to update deprecated commands and verify the configuration of dependencies to avoid runtime errors during the CI process.

Tools
actionlint

139-139: shellcheck reported issue in this script: SC1073:error:1:1: Couldn't parse this if expression. Fix to allow more checks

(shellcheck)


139-139: shellcheck reported issue in this script: SC1050:error:1:36: Expected 'then'

(shellcheck)


139-139: shellcheck reported issue in this script: SC1072:error:1:37: Unexpected . Fix any mentioned problems and try again

(shellcheck)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


139-139: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


149-149: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

@roomrys roomrys marked this pull request as draft September 5, 2024 15:07
@roomrys roomrys marked this pull request as ready for review September 5, 2024 18:59
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8b162ae and efb2295.

Files selected for processing (1)
  • .github/workflows/build_conda_ci.yml (1 hunks)
Additional context used
actionlint
.github/workflows/build_conda_ci.yml

131-131: shellcheck reported issue in this script: SC2086:info:1:39: Double quote to prevent globbing and word splitting

(shellcheck)

Additional comments not posted (2)
.github/workflows/build_conda_ci.yml (2)

21-85: Review of Build Job: Well-structured and comprehensive.

The build job is well-structured with clear steps for setting up the environment, building the package, and uploading it for subsequent use. Using a matrix strategy to test across different operating systems is a good practice. The use of Conda and Miniconda is appropriate for handling Python package dependencies.

Consider documenting each step in the workflow for clarity, especially for new contributors or external collaborators.


86-179: Review of Test Job: Comprehensive testing setup.

The test job is well-organized with steps that ensure the environment is correctly set up and the package is tested across different platforms. The use of matrix strategy for testing is consistent with the build job and helps ensure compatibility across environments.

The step to download and use the build artifact is crucial and appears to be correctly implemented. However, ensure that the environment variables and paths are correctly set to avoid issues during the test execution.

Consider adding more detailed logging or debugging information to help diagnose issues if the tests fail.

Tools
actionlint

131-131: shellcheck reported issue in this script: SC2086:info:1:39: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/build_conda_ci.yml Show resolved Hide resolved
@roomrys roomrys merged commit 84e751e into develop Sep 6, 2024
3 of 6 checks passed
@roomrys roomrys deleted the liezl/add-runner-to-test-conda-packages branch September 6, 2024 17:43
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