Skip to content

Conversation

@0xrinegade
Copy link
Member

@0xrinegade 0xrinegade commented Mar 12, 2025

Update CI workflows to improve performance and consistency.

  • CI Workflow (.github/workflows/ci.yml)

    • Update actions-rs/toolchain@v1 to dtolnay/rust-toolchain@stable
    • Update actions-rs/cargo@v1 to dtolnay/rust-toolchain@stable with direct run commands
    • Update actions/checkout@v3 to actions/checkout@v4
    • Update actions/cache@v3 to actions/cache@v4
    • Fix code coverage step to use a working version of cargo-tarpaulin
    • Add explicit working directory for all cargo commands
    • Update codecov/codecov-action@v3 to codecov/codecov-action@v4
  • Benchmarks Workflow (.github/workflows/benchmarks.yml)

    • Update actions/checkout@v3 to actions/checkout@v4
    • Update actions-rs/toolchain@v1 to dtolnay/rust-toolchain@stable
    • Update actions-rs/cargo@v1 to dtolnay/rust-toolchain@stable with direct run commands
    • Update actions/cache@v3 to actions/cache@v4
    • Fix actions-rs/[email protected] step to use a direct cargo install command
    • Add explicit working directory for all cargo commands
    • Fix benchmark comparison step
  • Cross-Platform Workflow (.github/workflows/cross-platform.yml)

    • Update actions/checkout@v3 to actions/checkout@v4
    • Update actions-rs/toolchain@v1 to dtolnay/rust-toolchain@stable
    • Update actions-rs/cargo@v1 to dtolnay/rust-toolchain@stable with direct run commands
    • Update actions/cache@v3 to actions/cache@v4
    • Add explicit working directory for all cargo commands
  • Release Workflow (.github/workflows/release.yml)

    • Update actions/checkout@v3 to actions/checkout@v4
    • Update actions-rs/toolchain@v1 to dtolnay/rust-toolchain@stable
    • Update actions-rs/cargo@v1 to dtolnay/rust-toolchain@stable with direct run commands
    • Update actions/upload-artifact@v3 to actions/upload-artifact@v4
    • Update actions/download-artifact@v3 to actions/download-artifact@v4
    • Update peaceiris/actions-gh-pages@v3 to the latest version
    • Add explicit working directory for all cargo commands
  • Security Workflow (.github/workflows/security.yml)

    • Update actions/checkout@v3 to actions/checkout@v4
    • Update actions-rs/toolchain@v1 to dtolnay/rust-toolchain@stable
    • Update actions-rs/cargo@v1 to dtolnay/rust-toolchain@stable with direct run commands
    • Fix actions-rs/[email protected] step to use a direct cargo install command
    • Update github/codeql-action/init@v2 to github/codeql-action/init@v3
    • Update github/codeql-action/analyze@v2 to github/codeql-action/analyze@v3
    • Update actions/dependency-review-action@v3 to actions/dependency-review-action@v4
    • Add explicit working directory for all cargo commands

For more details, open the Copilot Workspace session.

Summary by Sourcery

Updates CI workflows to improve consistency and performance by updating actions, fixing code coverage, and adding explicit working directories for cargo commands.

CI:

  • Updates actions in CI workflows to improve performance and consistency.
  • Fixes the code coverage step to use a working version of cargo-tarpaulin.
  • Adds explicit working directories for all cargo commands.

Update CI workflows to improve performance and consistency.

* **CI Workflow (`.github/workflows/ci.yml`)**
  - Update `actions-rs/toolchain@v1` to `dtolnay/rust-toolchain@stable`
  - Update `actions-rs/cargo@v1` to `dtolnay/rust-toolchain@stable` with direct `run` commands
  - Update `actions/checkout@v3` to `actions/checkout@v4`
  - Update `actions/cache@v3` to `actions/cache@v4`
  - Fix code coverage step to use a working version of `cargo-tarpaulin`
  - Add explicit working directory for all cargo commands
  - Update `codecov/codecov-action@v3` to `codecov/codecov-action@v4`

* **Benchmarks Workflow (`.github/workflows/benchmarks.yml`)**
  - Update `actions/checkout@v3` to `actions/checkout@v4`
  - Update `actions-rs/toolchain@v1` to `dtolnay/rust-toolchain@stable`
  - Update `actions-rs/cargo@v1` to `dtolnay/rust-toolchain@stable` with direct `run` commands
  - Update `actions/cache@v3` to `actions/cache@v4`
  - Fix `actions-rs/[email protected]` step to use a direct cargo install command
  - Add explicit working directory for all cargo commands
  - Fix benchmark comparison step

* **Cross-Platform Workflow (`.github/workflows/cross-platform.yml`)**
  - Update `actions/checkout@v3` to `actions/checkout@v4`
  - Update `actions-rs/toolchain@v1` to `dtolnay/rust-toolchain@stable`
  - Update `actions-rs/cargo@v1` to `dtolnay/rust-toolchain@stable` with direct `run` commands
  - Update `actions/cache@v3` to `actions/cache@v4`
  - Add explicit working directory for all cargo commands

* **Release Workflow (`.github/workflows/release.yml`)**
  - Update `actions/checkout@v3` to `actions/checkout@v4`
  - Update `actions-rs/toolchain@v1` to `dtolnay/rust-toolchain@stable`
  - Update `actions-rs/cargo@v1` to `dtolnay/rust-toolchain@stable` with direct `run` commands
  - Update `actions/upload-artifact@v3` to `actions/upload-artifact@v4`
  - Update `actions/download-artifact@v3` to `actions/download-artifact@v4`
  - Update `peaceiris/actions-gh-pages@v3` to the latest version
  - Add explicit working directory for all cargo commands

* **Security Workflow (`.github/workflows/security.yml`)**
  - Update `actions/checkout@v3` to `actions/checkout@v4`
  - Update `actions-rs/toolchain@v1` to `dtolnay/rust-toolchain@stable`
  - Update `actions-rs/cargo@v1` to `dtolnay/rust-toolchain@stable` with direct `run` commands
  - Fix `actions-rs/[email protected]` step to use a direct cargo install command
  - Update `github/codeql-action/init@v2` to `github/codeql-action/init@v3`
  - Update `github/codeql-action/analyze@v2` to `github/codeql-action/analyze@v3`
  - Update `actions/dependency-review-action@v3` to `actions/dependency-review-action@v4`
  - Add explicit working directory for all cargo commands

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/openSVM/osvm-cli?shareId=XXXX-XXXX-XXXX-XXXX).
@devloai
Copy link
Contributor

devloai bot commented Mar 12, 2025

Unable to perform a code review. You have run out of credits 😔

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 12, 2025

Reviewer's Guide by Sourcery

This pull request updates the CI workflows to improve consistency and performance. It migrates from actions-rs to dtolnay/rust-toolchain for Rust toolchain management, updates various GitHub Action versions, adds explicit working directories for cargo commands, and refactors installation steps to use direct cargo install commands. It also fixes issues in the code coverage and benchmark comparison steps.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Migrated from actions-rs actions to dtolnay/rust-toolchain for Rust toolchain management and updated action versions.
  • Replaced actions-rs/toolchain@v1 with dtolnay/rust-toolchain@stable.
  • Replaced actions-rs/cargo@v1 with direct run commands for cargo operations.
  • Updated actions/checkout@v3 to actions/checkout@v4.
  • Updated actions/cache@v3 to actions/cache@v4.
  • Updated actions/upload-artifact@v3 to actions/upload-artifact@v4.
  • Updated actions/download-artifact@v3 to actions/download-artifact@v4.
  • Updated codecov/codecov-action@v3 to codecov/codecov-action@v4.
  • Updated github/codeql-action/init@v2 to github/codeql-action/init@v3.
  • Updated github/codeql-action/analyze@v2 to github/codeql-action/analyze@v3.
  • Updated actions/dependency-review-action@v3 to actions/dependency-review-action@v4.
  • Updated peaceiris/actions-gh-pages@v3 to the latest version.
.github/workflows/ci.yml
.github/workflows/benchmarks.yml
.github/workflows/cross-platform.yml
.github/workflows/release.yml
.github/workflows/security.yml
Improved workflow clarity and reliability by adding explicit working directories for all cargo commands.
  • Added working-directory: . to all cargo command steps.
.github/workflows/ci.yml
.github/workflows/benchmarks.yml
.github/workflows/cross-platform.yml
.github/workflows/release.yml
.github/workflows/security.yml
Refactored installation steps to use direct cargo install commands. .github/workflows/benchmarks.yml
.github/workflows/security.yml
Fixed issues in the code coverage step and benchmark comparison step.
  • Fixed code coverage step to use a working version of cargo-tarpaulin.
  • Fixed benchmark comparison step.
.github/workflows/ci.yml
.github/workflows/benchmarks.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

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

Hey @0xrinegade - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a matrix strategy to avoid repeating the same steps across multiple workflows.
  • The consistency improvements across workflows look good.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

crate: cargo-tarpaulin
version: latest
use-tool-cache: true
run: cargo install cargo-tarpaulin
Copy link

Choose a reason for hiding this comment

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

suggestion (performance): Consider caching the installation for cargo-tarpaulin.

Replacing the actions-based install with a direct cargo command improves simplicity, but installing cargo-tarpaulin every run could impact performance. Evaluate if caching the installed binary is feasible to reduce CI time.

Suggested implementation:

      - name: Cache cargo-tarpaulin
        id: cache-cargo-tarpaulin
        uses: actions/cache@v2
        with:
          path: ~/.cargo/bin/cargo-tarpaulin
          key: ${{ runner.os }}-cargo-tarpaulin

      - name: Install cargo-tarpaulin
        if: steps.cache-cargo-tarpaulin.outputs.cache-hit != 'true'
        run: cargo install cargo-tarpaulin
        working-directory: .

Ensure that the cache key is updated if you ever change the version of cargo-tarpaulin being installed,
so that a new version is installed when needed.
Also, verify the order of steps in your workflow so that the caching step runs before the installation.

crate: cargo-criterion
version: latest
use-tool-cache: true
run: cargo install cargo-criterion
Copy link

Choose a reason for hiding this comment

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

suggestion (performance): Evaluate caching for cargo-criterion installation.

Similar to other installation steps, running cargo install for cargo-criterion on each workflow execution may slow down builds. Consider whether caching the result of this installation could lead to overall performance improvements.

Suggested implementation:

      - name: Cache dependencies

      - name: Cache cargo-criterion
        id: cache-cargo-criterion
        uses: actions/cache@v2
        with:
          path: ~/.cargo/bin/cargo-criterion
          key: ${{ runner.os }}-cargo-criterion-${{ hashFiles('**/Cargo.lock') }}

      - name: Install cargo-criterion
        if: steps.cache-cargo-criterion.outputs.cache-hit != 'true'
        run: cargo install cargo-criterion
        working-directory: .

Ensure that the cache key is appropriate for your project. If you later add custom flags or the version of cargo-criterion changes, update the key to force cache refresh.

@0xrinegade 0xrinegade merged commit 0d5c318 into main Mar 13, 2025
4 of 13 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