Skip to content

CI: Preinstall packages needed for testing and benchmark.#1894

Merged
Dead2 merged 1 commit intodevelopfrom
preinstall-ci-tools
Apr 4, 2025
Merged

CI: Preinstall packages needed for testing and benchmark.#1894
Dead2 merged 1 commit intodevelopfrom
preinstall-ci-tools

Conversation

@Dead2
Copy link
Copy Markdown
Member

@Dead2 Dead2 commented Apr 2, 2025

Avoids having to compile gtest and google benchmark in every CI job. To make sure we also test downloading and building ourself, don't install for jobs that specify any matrix.packages.

In my spotchecks, it typically spends ~7-8sec extra to run apt install, while the compile is ~22-40sec faster.

Summary by CodeRabbit

  • Chores
    • Refined the continuous integration conditions to streamline the setup process.
    • Added a default package installation fallback to ensure essential dependencies are reliably installed during automated processes.

Avoids having to compile gtest and google benchmark in every CI job.

To make sure we also test downloading and building ourself, don't
install for jobs that specify any matrix.packages.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2025

Walkthrough

The changes update a GitHub Actions workflow in the cmake configuration. The conditions for the "Add ubuntu mirrors" and "Install packages (Ubuntu)" steps are simplified to check only for Linux runners that are not on the 'z15' platform, removing the requirement for matrix packages. Additionally, the installation command in the "Install packages (Ubuntu)" step now uses default packages ("libgtest-dev libbenchmark-dev") if matrix.packages is not provided, ensuring fallback behavior in the workflow.

Changes

File Change Summary
.github/workflows/cmake.yml Simplified conditions for "Add ubuntu mirrors" and "Install packages (Ubuntu)"; removed matrix package check and added fallback installation of default packages.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as R
    participant Workflow as W
    participant MirrorsStep as MS
    participant InstallStep as IS

    R->>W: Trigger workflow (Linux runner, not z15)
    W->>MS: Execute "Add ubuntu mirrors" step
    MS-->>W: Mirrors step executed

    W->>IS: Execute "Install packages (Ubuntu)" step
    alt matrix.packages is defined
        IS-->>W: Install packages from matrix
    else matrix.packages not defined
        IS-->>W: Install 'libgtest-dev libbenchmark-dev'
    end
Loading

Suggested labels

Testing Framework


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
🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

sudo apt-get update
sudo apt-get install -y --allow-downgrades --no-install-recommends ${{ matrix.packages }}
sudo apt-get install -y --allow-downgrades --no-install-recommends \
${{ matrix.packages || 'libgtest-dev libbenchmark-dev' }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sudo apt-get install -y --allow-downgrades --no-install-recommends \
    libgtest-dev libbenchmark-dev ${{ matrix.packages }}

No need for || ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is if we still want to also test the download-and-compile-ourselves code.

Copy link
Copy Markdown
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

🧹 Nitpick comments (2)
.github/workflows/cmake.yml (2)

656-662: Simplify Ubuntu Mirrors Addition Step
The updated condition now checks that the runner is Linux and that the job is not on a platform whose matrix.os contains 'z15'. This streamlined check aligns with the PR objective by excluding the preinstallation on designated platforms without adding extraneous conditions. Please verify that this simple exclusion based on 'z15' satisfies all intended scenarios.


664-669: Default Package Fallback in the Installation Step
The installation command now smartly uses the expression
${{ matrix.packages || 'libgtest-dev libbenchmark-dev' }}
to preinstall a default set of packages when no specific packages are provided via the matrix. This change fulfills the preinstallation objective by ensuring essential packages are always available and can reduce CI time. One small note: please confirm that cases where matrix.packages might be an empty string are handled as intended, and that overriding defaults works in all scenarios.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 724dc0c and e4f0eec.

📒 Files selected for processing (1)
  • .github/workflows/cmake.yml (1 hunks)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.43%. Comparing base (724dc0c) to head (e4f0eec).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1894      +/-   ##
===========================================
+ Coverage    82.85%   83.43%   +0.57%     
===========================================
  Files          144      144              
  Lines        12946    12950       +4     
  Branches      2855     2858       +3     
===========================================
+ Hits         10727    10805      +78     
+ Misses        1248     1203      -45     
+ Partials       971      942      -29     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dead2 Dead2 merged commit 5ab093e into develop Apr 4, 2025
288 of 298 checks passed
@Dead2 Dead2 deleted the preinstall-ci-tools branch August 23, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants