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: refactor msbuild workflow #136

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

ReenigneArcher
Copy link
Contributor

@ReenigneArcher ReenigneArcher commented Jul 15, 2024

This PR makes some changes the msbuild.yml workflow. I am happy to describe any changes in further detail if needed.

  • Add additional events for the workflow
    • On pull_request allows you to verify if PRs have successful builds and/or download the artifacts for testing. This is limited to opened, synchronized (when new commits are pushed to the PR branch), and re-opened events.
    • On push is limited to only the master branch.
    • On workflow_dispatch allows you to run this workflow manually if you ever need to check the build state.
  • The concurrency changes will ensure only a single workflow will run for each ref. This means if a PR contributor pushes new changes to their branch, it will cancel the in process workflow and trigger a new run.
  • env section was shortened, but equivalent to the previous
  • Updated versions for three of the github actions used
  • Removed default values such as:
    • shell: pwsh as this is the default for Windows runners
    • working-directory: ${{env.GITHUB_WORKSPACE}} as this is the default for all job steps
  • Used line continuations for long commands
  • Added a single line break between steps to improve readability

There is a repository setting to configure how github workflows run from outside collaborators. The options are:

  • require approval for first time contributors
  • require approval for all outside collaborates (This is what I use for LizardByte, as it reduces runner consumption when I am not ready to merge PRs)

No matter which option you select, PRs from forks will never have access to secrets. There are none in your workflow currently, so this is just FYI.

P.S. In another PR, I would like to add dependabot to help you keep actions and git submodules updated automatically. Unfortunately, it does not have support for vcpkg (see: dependabot/dependabot-core#2027)

Summary by CodeRabbit

  • New Features

    • Enhanced workflow configuration to trigger on pull requests, improving the development process.
  • Improvements

    • Updated action versions for better performance and compatibility.
    • Streamlined script executions for improved readability and maintainability.
    • Introduced concurrency settings to manage in-progress workflows effectively.
    • Added security enhancements for handling certificates in the build process.

Copy link

coderabbitai bot commented Jul 15, 2024

Walkthrough

The .github/workflows/msbuild.yml file has undergone significant enhancements to improve workflow efficiency and responsiveness. Key updates include the addition of triggers for pull requests, refined concurrency settings, and upgraded action versions. The script execution process has been improved for better readability, and environment variables have been integrated. These changes collectively enhance the workflow’s flexibility, maintainability, and reliability within the CI/CD pipeline.

Changes

Files Change Summary
.github/.../msbuild.yml Added pull request trigger, updated concurrency settings, advanced action versions, refined scripts for readability, integrated environment variables, and upgraded artifact upload actions.

Poem

In workflows where the code does flow,
Updates come with a gentle glow.
Concurrency now wisely tuned,
And scripts by better logic pruned.
Actions updated, artifacts soar,
Efficiency knocks on CI’s door. 🌟


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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 808ed29 and 7a90649.

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

4-10: LGTM! Expanded workflow triggers improve CI/CD.

The new workflow triggers ensure that the workflow runs on pull requests and manual dispatches, which is useful for verifying PRs and manually checking the build state.


12-14: LGTM! Concurrency settings enhance workflow efficiency.

The updated concurrency settings prevent multiple workflows from running simultaneously for the same ref, which is efficient and prevents resource wastage.


24-24: LGTM! Updated action versions ensure latest features and fixes.

Updating the versions for checkout, setup-msbuild, and upload-artifact actions ensures that the workflow uses the latest features and bug fixes provided by these actions.

Also applies to: 29-29, 76-76


16-18: LGTM! Secure handling of sensitive data with environment variables.

Introducing the CERTIFICATE_FILE environment variable sourced from GitHub secrets is a secure way to handle sensitive data.

Also applies to: 53-54


32-35: LGTM! Improved readability and simplified workflow.

The reformatting of script execution blocks improves readability, and the removal of redundant scripts simplifies the workflow.

Also applies to: 64-70


Line range hint 75-80:
LGTM! Updated artifact upload step with improved readability.

Updating the artifact upload step to use the latest version of the upload-artifact action ensures that the workflow benefits from the latest features and fixes.

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 7a90649 and d4e44c7.

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

4-10: Approved: Enhanced workflow triggers.

The addition of pull_request, push, and workflow_dispatch events improves the workflow's flexibility and ensures comprehensive CI/CD coverage.


12-14: Approved: Concurrency settings.

The concurrency settings ensure that only one workflow runs for each ref, canceling in-progress workflows if new changes are pushed. This optimizes resource usage and prevents redundant builds.


16-18: Approved: Streamlined environment variables.

The environment variables section has been shortened while maintaining equivalence, improving readability without altering functionality.


24-24: Approved: Updated GitHub Actions versions.

Updating to newer versions of actions/checkout, microsoft/setup-msbuild, and actions/upload-artifact ensures compatibility with newer features or fixes.

Also applies to: 29-29, 76-76


32-39: Approved: Reformatted VCPKG packages restoration and extraction.

The script for restoring and extracting VCPKG packages has been reformatted for better readability, improving maintainability without altering functionality.


63-70: Approved: Reformatted MSBuild command.

The MSBuild command has been reformatted for better readability, improving maintainability without altering functionality.


75-79: Approved: Updated artifact upload step.

Updating the artifact upload step to use version 4 ensures compatibility with newer features or fixes.

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 d4e44c7 and f4f16d9.

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

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 f4f16d9 and 878ab4f.

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

@ReenigneArcher ReenigneArcher force-pushed the patch-2 branch 2 times, most recently from 63aa00d to ccbbcce Compare August 3, 2024 16:42
@ReenigneArcher ReenigneArcher marked this pull request as draft August 3, 2024 16:43
@ReenigneArcher ReenigneArcher force-pushed the patch-2 branch 17 times, most recently from 62b5e91 to f9db83c Compare August 3, 2024 23:21
@ReenigneArcher ReenigneArcher marked this pull request as ready for review August 4, 2024 00:04
@ReenigneArcher
Copy link
Contributor Author

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 878ab4f and f9db83c.

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

@ReenigneArcher
Copy link
Contributor Author

After this is merged, I plan on working on a way to cache the third party builds as that part is quite time consuming (~25 minutes).

@ReenigneArcher
Copy link
Contributor Author

Looks like i need to tweak something else. I have it working in my repo, so should be close.

ReenigneArcher#1

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 f9db83c and ef96562.

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

4-10: Event triggers updated successfully.

The addition of specific pull_request types and restriction to the master branch for push events, along with workflow_dispatch, enhances control and flexibility.


12-14: Concurrency settings optimized.

The concurrency configuration prevents overlapping runs, reducing resource waste and ensuring builds are up-to-date.


16-18: Environment variables simplified.

The streamlined env section maintains functionality while enhancing readability.


24-29: Action versions updated.

Upgrading to newer versions of actions like actions/checkout@v4 and microsoft/setup-msbuild@v2 is a good practice for leveraging improvements and features.


32-45: VCPKG package handling improved.

The rewritten steps for handling VCPKG packages using multi-line commands enhance readability and maintainability.


52-95: Certificate handling for forks implemented.

The new step for generating a self-signed certificate and using the GITHUB_TOKEN for password creation enhances security and adapts to different repository contexts.


97-109: Local certificate handling secured.

The use of CERTIFICATE_FILE for local builds ensures secure handling of sensitive information.


113-132: Build step robustness enhanced.

The conditional logic for handling certificate passwords dynamically improves the robustness and flexibility of the build process.


134-137: Certificate cleanup ensured.

The cleanup step guarantees the removal of sensitive files, enhancing security.


138-142: Artifact upload updated.

Using actions/upload-artifact@v4 ensures compatibility and benefits from any improvements in the action.

Copy link

@ReenigneArcher
Copy link
Contributor Author

I think I've fixed this.

@TheElixZammuto
Copy link
Owner

Thank you as always!

@TheElixZammuto TheElixZammuto merged commit 3132fdb into TheElixZammuto:master Aug 16, 2024
2 checks passed
@ReenigneArcher ReenigneArcher deleted the patch-2 branch September 17, 2024 00:11
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