Skip to content

Implement ci pipeline - #57

Open
isalyne34 wants to merge 14 commits into
mainfrom
26-implement-ci-pipeline-using-organisational-templates
Open

isalyne34 wants to merge 14 commits into
mainfrom
26-implement-ci-pipeline-using-organisational-templates

Conversation

@isalyne34

@isalyne34 isalyne34 commented Nov 28, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Enhanced CI with a reusable, multi-stage pipeline for automated validation, testing, and conditional build/deployment of container images on main and tag updates.
    • Improved workflow triggers to run checks on pushes, pull requests, and manual dispatch, reducing regressions and speeding delivery.

✏️ Tip: You can customize this high-level summary in your review settings.

@isalyne34 isalyne34 self-assigned this Nov 28, 2025
@isalyne34 isalyne34 linked an issue Nov 28, 2025 that may be closed by this pull request

@baptistebronsin baptistebronsin left a comment

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.

Overall, your CI configuration seems good 🙂

Could you check to implement this job in the Action repo ?

  1. Create an issue here
  2. Validate the issue by people of this service
  3. Implement this new feature
  4. Use this feature here

If you think it's out of your scope, don't hesitate to tell us :)

Comment thread .github/workflows/ci.yml Outdated
@Courtcircuits

Copy link
Copy Markdown

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 : cargo test. Then there are the integration tests that need the services to be up and that can be run with : cargo test -- --ignored. My implementation works but can be optimized a lot. Every CI compiles the project from scratch but this compilation can be cached using sccache (here is a quick tutorial on how to use it in rust https://blog.otso.fr/2023-04-02-sccache-build-rust.html). I think that with this technique the tests might run in less than 1 minute, for reference currently the tests take 3min30 to run...

Comment thread .github/workflows/ci.yml
@Courtcircuits

Copy link
Copy Markdown

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

@Courtcircuits

Copy link
Copy Markdown

Is this PR ready to be switched to "Ready for review" ?

@isalyne34
isalyne34 marked this pull request as ready for review December 31, 2025 14:32
@coderabbitai

coderabbitai Bot commented Jan 17, 2026 •

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

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

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions CI workflow at .github/workflows/ci.yml that triggers on dispatch, pull_request, and push; delegates Rust validation and tests to reusable workflows; and conditionally builds and pushes Docker images for main and tag pushes.

Changes

Cohort / File(s) Summary
CI Workflow Configuration
\.github/workflows/ci\.yml
New reusable-composing workflow with four jobs: validate_rust and test_rust (delegate to external reusable workflows), build_push_main (build & push Docker on main), and build_push_tag (build & push Docker on tag pushes). Secrets are inherited where required.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Poem

🐰
I hopped through commits, branch and tag in sight,
Stitched workflows together, automated the night.
Rust checks, Docker pushes, all queued just right,
This rabbit applauds: CI dreams take flight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Implement ci pipeline' directly and clearly describes the main change: adding a CI pipeline workflow to the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

…l-templates

Signed-off-by: Baptiste Bronsin <79365734+baptistebronsin@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 21, 2026 10:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread .github/workflows/ci.yml
Comment on lines +20 to +24
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

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
branches:
- main
- develop
- "*"

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
- "*"

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +23 to +34
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/')

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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]

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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: Clarify pull_request.branches intent.

Including "*" already matches all base branches, making main/develop redundant. Consider removing "*" or the explicit list to keep intent clear.

♻️ Example (restrict to main + develop)
  pull_request:
    branches:
      - main
      - develop
-      - "*"

Comment thread .github/workflows/ci.yml
Comment on lines +20 to +25
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/ci.yml | head -40

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

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.

Implement CI pipeline using organisational templates

5 participants