Conversation
baptistebronsin
left a comment
There was a problem hiding this comment.
Overall, your CI configuration seems good 🙂
Could you check to implement this job in the Action repo ?
- Create an issue here
- Validate the issue by people of this service
- Implement this new feature
- Use this feature here
If you think it's out of your scope, don't hesitate to tell us :)
|
Fyi I implemented a CI for tests on the content repository ! Maybe you can take inspiration on that to standardize all of our repositories. Here is the link : https://github.com/beep-industries/content/blob/f20cecfea717ceb636d5b9f41bac7e84a9f9b308/.github/workflows/test.yml Just to give you a quick explanation, there are two types of tests on the content repo : integration tests and unit tests. The unit tests don't need the docker services to be up and can be run with : |
|
@hugoponthieu @isalyne34 I prefer not to review this PR now since it's not marked as "ready for review". Also this PR is a CI/CD PR so I won't be reviewing until a commit has a CI working. Don't worry, as soon as these two criterias are furfilled, I'll review it right away ! |
|
Is this PR ready to be switched to "Ready for review" ? |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a new GitHub Actions CI workflow at Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (push/PR)
participant GH as GitHub Actions
participant RW as Reusable Workflows (Rust validate/test)
participant Builder as Docker Builder
participant Reg as Container Registry
Dev->>GH: push / pull_request / workflow_dispatch
GH->>RW: invoke validate_rust
RW-->>GH: validation result
GH->>RW: invoke test_rust
RW-->>GH: test result
alt push to main or tag
GH->>Builder: run build_push_main / build_push_tag
Builder->>Reg: push image (uses inherited secrets)
Reg-->>Builder: push confirmation
Builder-->>GH: job result
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
…l-templates Signed-off-by: Baptiste Bronsin <79365734+baptistebronsin@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a GitHub Actions CI pipeline for a Rust project that automates validation, testing, and Docker image building/publishing workflows.
Changes:
- Added CI workflow with triggers for pull requests, pushes to main, and tag releases
- Integrated reusable workflows for Rust validation and testing
- Configured Docker build/push jobs for main branch commits and tagged releases
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uses: beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | ||
|
|
||
| test_rust: | ||
| name: Tests Rust | ||
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services |
There was a problem hiding this comment.
The validate_rust and test_rust jobs reference a branch-specific version of the reusable workflows (@17-add-reusable-test-ci-workflow-template-for-rust-services), while build_push_main and build_push_tag jobs reference @main. For production stability and consistency, all reusable workflow references should use the same version strategy. Consider either pinning all workflows to a specific tag/commit SHA for reproducibility, or use @main consistently across all jobs if you want to track the latest changes.
| uses: beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | |
| test_rust: | |
| name: Tests Rust | |
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | |
| uses: beep-industries/actions/.github/workflows/validate-rust.yml@main | |
| test_rust: | |
| name: Tests Rust | |
| uses: beep-industries/actions/.github/workflows/test-rust.yml@main |
| branches: | ||
| - main | ||
| - develop | ||
| - "*" |
There was a problem hiding this comment.
The pull_request trigger includes a wildcard pattern that matches all branches (line 10), which makes the specific branch listing (main, develop on lines 8-9) redundant. You can either remove lines 8-9 and keep just the wildcard, or remove the wildcard if you only want to trigger on specific branches.
| - "*" |
| name: Tests Rust | ||
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | ||
|
|
||
| build_push_main: | ||
| name: Build & Push Docker (main) | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: beep-industries/actions/.github/workflows/build-push-main.yml@main | ||
| secrets: inherit | ||
|
|
||
| build_push_tag: | ||
| name: Build & Push Docker (tag) | ||
| if: startsWith(github.ref, 'refs/tags/') |
There was a problem hiding this comment.
The test_rust and build_push_main/build_push_tag jobs have no explicit dependency on validate_rust. This means validation and testing could run in parallel with Docker builds, potentially allowing images to be built from code that fails validation. Consider adding 'needs: [validate_rust]' to test_rust job and 'needs: [validate_rust, test_rust]' to the build jobs to ensure proper sequencing.
| name: Tests Rust | |
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | |
| build_push_main: | |
| name: Build & Push Docker (main) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: beep-industries/actions/.github/workflows/build-push-main.yml@main | |
| secrets: inherit | |
| build_push_tag: | |
| name: Build & Push Docker (tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| name: Tests Rust | |
| needs: [validate_rust] | |
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | |
| build_push_main: | |
| name: Build & Push Docker (main) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: [validate_rust, test_rust] | |
| uses: beep-industries/actions/.github/workflows/build-push-main.yml@main | |
| secrets: inherit | |
| build_push_tag: | |
| name: Build & Push Docker (tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [validate_rust, test_rust] |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Around line 20-25: The reusable workflow references (`uses:
beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services`
and `uses:
beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services`,
plus the other two references noted around lines 29–35 that currently use
`@main`) must be pinned to immutable commit SHAs; update each `uses:` value to
the corresponding full commit SHA (not a branch or tag) for the referenced
repository so the `validate-rust.yml` and `test-rust.yml` reusable workflows
(and the other two `uses:` occurrences) point to specific commits for
reproducible, auditable CI runs.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
6-10: Clarifypull_request.branchesintent.Including
"*"already matches all base branches, makingmain/developredundant. Consider removing"*"or the explicit list to keep intent clear.♻️ Example (restrict to main + develop)
pull_request: branches: - main - develop - - "*"
| uses: beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | ||
|
|
||
| test_rust: | ||
| name: Tests Rust | ||
| uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/ci.yml | head -40Repository: beep-industries/communities
Length of output: 1270
🌐 Web query:
GitHub Actions reusable workflow best practices pinning tags vs branch refs security
💡 Result:
Short answer — pin reusable-workflow refs to an immutable commit SHA whenever security or stability matters; avoid branch refs for third‑party workflows and prefer SHAs (or immutable release tags from trusted authors) and enforce pinning via org/repo policies. [1][2][3][4]
Best-practice checklist (concise)
- Use commit SHAs for {owner}/{repo}/.github/workflows/{file}@{ref} to get an immutable, auditable ref. — most secure. [1][2]
- Only use tags if they are immutable releases and the author is trusted (Verified badge / audited). Tags can be moved if the repo is compromised. [2][3]
- Avoid using branch names for third‑party reusable workflows (they can change unexpectedly or be hijacked). Branch refs are convenient but lower security. [1][2]
- Enforce organization/repository policy to require SHA pinning and to block specific actions/workflows when needed. Use the “allowed actions and reusable workflows” settings. [3][4]
- Audit reusable-workflow source code and prefer official/verified authors; prefer workflows kept inside your org/repo for sensitive operations. [2]
- Minimize privileges: limit GITHUB_TOKEN permissions, scope secrets, and use least-privilege runner groups for workflows. [2][1]
- Track versions: include human-readable tag/version in a comment when pinning to a SHA to make updates clear and maintainable. [3]
If you want, I can:
- show a short example of calling a reusable workflow pinned to a SHA, or
- scan a specific reusable-workflow ref you use and suggest a pinned-SHA replacement.
Pin reusable workflow refs to immutable commit SHAs instead of branch names.
All four reusable workflow references use branch names (@17-add-reusable-test-ci-workflow-template-for-rust-services and @main), which can change without review and create supply-chain security risks. Pin each to a specific commit SHA for reproducibility and auditability.
🔒 Suggested fix (pin to commit SHAs)
- uses: beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services
+ uses: beep-industries/actions/.github/workflows/validate-rust.yml@<commit-sha>
- uses: beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services
+ uses: beep-industries/actions/.github/workflows/test-rust.yml@<commit-sha>
- uses: beep-industries/actions/.github/workflows/build-push-main.yml@main
+ uses: beep-industries/actions/.github/workflows/build-push-main.yml@<commit-sha>
- uses: beep-industries/actions/.github/workflows/build-push-tag.yml@main
+ uses: beep-industries/actions/.github/workflows/build-push-tag.yml@<commit-sha>Also applies to: 29–35
🤖 Prompt for AI Agents
In @.github/workflows/ci.yml around lines 20 - 25, The reusable workflow
references (`uses:
beep-industries/actions/.github/workflows/validate-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services`
and `uses:
beep-industries/actions/.github/workflows/test-rust.yml@17-add-reusable-test-ci-workflow-template-for-rust-services`,
plus the other two references noted around lines 29–35 that currently use
`@main`) must be pinned to immutable commit SHAs; update each `uses:` value to
the corresponding full commit SHA (not a branch or tag) for the referenced
repository so the `validate-rust.yml` and `test-rust.yml` reusable workflows
(and the other two `uses:` occurrences) point to specific commits for
reproducible, auditable CI runs.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.