|
| 1 | +# Workflows for CI/CD |
| 2 | +[](https://slurm.schedmd.com/spank.html) [](https://slurm.schedmd.com/) |
| 3 | +### Made to work with: |
| 4 | +[](https://en.wikipedia.org/wiki/C_(programming_language)) |
| 5 | +[](https://www.rust-lang.org/) |
| 6 | +[](https://www.python.org/) |
| 7 | +[](https://www.gnu.org/software/bash/) |
| 8 | + |
| 9 | +# 🛠 CI/CD Workflows |
| 10 | + |
| 11 | +This repository includes **GitHub Actions workflows** to ensure code quality, enforce linting, and run tests. These |
| 12 | +workflows are located in the `.github/workflows/` directory and are automatically triggered when a **pull request (PR) |
| 13 | +is created** or **code is pushed to the main branch**. Additionally, some workflows allow manual execution. |
| 14 | + |
| 15 | +## 📌 Available Workflows |
| 16 | + |
| 17 | +### **1️⃣ Linting Workflow** |
| 18 | + |
| 19 | +- **File:** `.github/workflows/linting.yml` |
| 20 | +- **Purpose:** Runs linters and static analysis tools to enforce coding standards for **C, Rust, Python, and Shell |
| 21 | + scripts**. |
| 22 | +- **Triggers:** |
| 23 | + - On every **pull request** to `main`. |
| 24 | +- **Main Steps:** |
| 25 | + - Install linting tools |
| 26 | + - Run `clang-tidy` for C code |
| 27 | + - Run `clippy` for Rust code |
| 28 | + - Run `pylint` and `black` for Python code |
| 29 | + - Run `shellcheck` and `shfmt` for shell scripts |
| 30 | + |
| 31 | +### **2️⃣ Build & Test Workflow** |
| 32 | + |
| 33 | +- **File:** `.github/workflows/build-test.yml` |
| 34 | +- **Purpose:** Builds the project and runs tests using **MySQL and SLURM**. |
| 35 | +- **Triggers:** |
| 36 | + - On every **pull request** to `main` |
| 37 | + - On **push** to `main` |
| 38 | + - Can also be triggered **manually** via the GitHub UI (`workflow_dispatch`). |
| 39 | +- **Main Steps:** |
| 40 | + - Set up a test SLURM cluster |
| 41 | + - Run automated tests (Work In Progress) |
| 42 | + |
| 43 | +## 🚀 How CI/CD Works |
| 44 | + |
| 45 | +1. **Pull Request Created** → Triggers both `Linting` and `Build & Test` workflows. |
| 46 | +2. **Push to `main` Branch** → Triggers the `Build & Test` workflow. |
| 47 | +3. **Manual Trigger (`workflow_dispatch`)** → Allows manually starting the `Build & Test` workflow. |
| 48 | + |
| 49 | +## 🛠 Detailed Workflow Steps |
| 50 | + |
| 51 | +### 🔹 **Linting Workflow Steps** |
| 52 | + |
| 53 | +| Step Name | Description | |
| 54 | +|-----------------------|------------------------------------------------------------------------| |
| 55 | +| Checkout repository | Fetches the latest code | |
| 56 | +| Install linting tools | Installs `clang-tidy`, `clippy`, `ruff`, `mypy`, `shellcheck`, `shfmt` | |
| 57 | +| Set up C environment | Prepares the `build` directory for linting | |
| 58 | +| Run `clang-tidy` | Lints C code | |
| 59 | +| Run Rust `clippy` | Lints Rust code | |
| 60 | +| Run `ruff` | Lints Python code | |
| 61 | +| Run `mypy` | Checks Python type annotations | |
| 62 | +| Report linting status | Displays final linting results | |
| 63 | + |
| 64 | +### 🔹 **Build & Test Workflow Steps** |
| 65 | + |
| 66 | +| Step Name | Description | |
| 67 | +|--------------------------|-----------------------------------------------| |
| 68 | +| Checkout code | Fetches the latest code | |
| 69 | +| Setup MySQL service | Starts MySQL container for testing | |
| 70 | +| Setup Test SLURM Cluster | Configures SLURM cluster for scheduling tasks | |
| 71 | +| Run tests | Executes the test suite | |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +By using these workflows, we **enforce code quality, catch errors early, and ensure that all commits follow best |
| 76 | +practices** before merging into `main`. 🚀 |
0 commit comments