Skip to content

Commit a654d8e

Browse files
andrechiarelliAndre Chiarelli
andauthored
cicd: Add github workflows for lint and tests (#16)
* Add github workflows for lint and tests * Add CMakeLists.txt path * test CMakeLists.txt path * test CMakeLists.txt path * Install slurm dependencies * Install slurm dependencies * Install slurm dependencies * update CMakelist.txt to find the *.c files in plugins * update CMakelist.txt to find the *.c files in plugins * update *.c files paths * turn of clang-tidy warnings * Rust workflow linting steps fixes with the right paths * Separate linters in different jobs * Use the same rust linters as qiskit * Use the same rust linters as qiskit * Setup python linting with pylint and blac * Adjust Github CICD workflow README.md * Adjust to find slurm dir in different OS path patterns * Linting Rust * Fix linting.yaml for Rust and Python * Revert changes from CMakeLists.txt and main.rs * Add different slurm paths patterns in the CMakelists.txt * Disable Rust lint * Disable Python lint * Re-enable rust and python lint * Re-enable rust and python lint * Re-enable rust and python lint * Installing cJson * Installing cJson * Installing cJson * Installing cJson * Installing python dependencies * Installing python dependencies * Installing python dependencies * fix main.rs lint --------- Co-authored-by: Andre Chiarelli <[email protected]>
1 parent 62574da commit a654d8e

File tree

13 files changed

+511
-13
lines changed

13 files changed

+511
-13
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#TODO: Do we need to add a CODEOWNERS file?

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Description of Change
2+
3+
<!-- Please include a readable description about the change. -->
4+
5+
## Checklist ✅
6+
7+
- [ ] Have you included a description of this change?
8+
- [ ] Have you updated the relevant documentation to reflect this change?
9+
- [ ] Have you made sure CI is passing before requesting a review?
10+
11+
## Ticket
12+
- [ ] Fixes #
13+
- [ ] Is Part of #

.github/pr-labels.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
feature: ['feature/*', 'feat/*']
2+
fix: fix/*
3+
chore: chore/*
4+
infra: ['ci/*', 'infra/*']
5+
documentation: ['docs/*', 'doc/*']
6+
release: release/*

.github/release.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .github/release.yaml
2+
changelog:
3+
exclude:
4+
labels:
5+
- ignore-for-release
6+
- documentation
7+
- infra
8+
authors:
9+
- github-actions # exclude GitHub actions bot
10+
categories:
11+
- title: Breaking Changes 🛠
12+
labels:
13+
- breaking-change
14+
- title: New Features 🎉
15+
labels:
16+
- feature
17+
- enhancement
18+
- title: Bug Fixes 🐛
19+
labels:
20+
- fix
21+
- title: Other Changes
22+
labels:
23+
- "*" # all other labels
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: Bug Template
3+
about: Used to identify bugs
4+
title: ''
5+
labels: 'Bug'
6+
assignees: ''
7+
8+
---
9+
10+
## Name
11+
<!-- Include the name of the feature or component where you found the bug. -->
12+
13+
## Description
14+
<!-- Provide a detailed description of the bug. Provide what the expected behavior was versus what you observed. -->
15+
16+
<!--
17+
Severity: Add one of the following tags to classify the severity of the bug
18+
"severity: critical": Causes failure of job processing, data corruption, system outage, or severe security vulnerability.
19+
"severity: high": Significantly impacts performance or functionality, with no reasonable workaround.
20+
"severity: medium": Impacts functionality with a reasonable workaround available, minor security concerns.
21+
"severity: low": Minor issues not affecting core functionality or performance.>
22+
-->
23+
24+
## Environment
25+
<add details>
26+
27+
## Steps to Reproduce
28+
<!-- Describe the steps you took before you encountered the bug, with as much details as possible. -->
29+
30+
## Error Messages and Logs
31+
<add details>
32+
33+
## Screenshots
34+
<add screenshots>
35+
36+
## Frequency
37+
<add details>
38+
39+
## Workarounds
40+
<add details>
41+
42+
## Impact and Risk Assessment
43+
### Immediate Impact
44+
- **User Impact**: <!-- Estimate the number of users currently affected. -->
45+
- **Operational Impact**: <!-- Describe the current effect on operations, including system performance and job processing. -->
46+
- **Financial Impact**: <!-- Estimate the immediate financial impact, if applicable. -->
47+
48+
### Potential Future Impact
49+
- **Scalability Concerns**: <!-- Potential issues as the system scales or database grows. -->
50+
- **Security and Privacy Risks**: <!-- Outline any potential risks to data security or user privacy. -->
51+
- **Financial Risks**: <!-- Highlight future financial risks, such as unauthorized access to paid resources. -->
52+
- **System Stability Risks**: <!-- Discuss the potential for this bug to cause system-wide failures or crashes. -->
53+
54+
## Additional Context
55+
<add details>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: User Story
3+
about: 'User Story Template '
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
Description (what, why)
10+
--------------------
11+
12+
Additional Notes or Context (links to slack threads, box notes, conversations context)
13+
--------------------
14+
<optional>
15+
16+
Acceptance Criteria
17+
--------------------
18+
- [ ] <well-defined objective 1>
19+
- [ ] <well-defined objective 2>
20+
- [ ] Create Acceptance / E2E tests <when possible>
21+
22+
Related tasks links
23+
--------------------
24+
<optional>
25+
26+
Interested Parties
27+
--------------------
28+
- @user
29+
- @group
30+
31+

.github/workflows/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Workflows for CI/CD
2+
[![SPANK Plugins](https://img.shields.io/badge/SPANK-Plugins-blue)](https://slurm.schedmd.com/spank.html) [![HPC Slurm](https://img.shields.io/badge/HPC-Slurm-green)](https://slurm.schedmd.com/)
3+
### Made to work with:
4+
[![C](https://img.shields.io/badge/Made%20with-C-1f425f.svg)](https://en.wikipedia.org/wiki/C_(programming_language))
5+
[![Rust](https://img.shields.io/badge/Rust-000000?style=for-the-badge&logo=rust&logoColor=white)](https://www.rust-lang.org/)
6+
[![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
7+
[![Shell](https://img.shields.io/badge/Shell-4EAA25?style=for-the-badge&logo=gnu-bash&logoColor=white)](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`. 🚀
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Doxygen Documentation Workflow
2+
3+
on:
4+
workflow_dispatch: # Allows manual trigger from GitHub UI
5+
schedule:
6+
- cron: '0 12 * * 1' # Runs every Monday at 12:00 UTC (weekly schedule)
7+
jobs:
8+
generate_docs:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/[email protected]
14+
15+
- name: Install Doxygen and dependencies
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y doxygen graphviz
19+
20+
- name: Generate documentation
21+
run: |
22+
doxygen Doxyfile
23+
24+
- name: Upload documentation artifact
25+
if: success()
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: C_Documentation
29+
path: ./docs/html
30+
31+
- name: Display documentation summary (optional)
32+
run: |
33+
echo "Documentation generated and stored as artifacts."

0 commit comments

Comments
 (0)