Skip to content

Commit 755152c

Browse files
AbdelStarkclaude
andcommitted
Add production-grade CI/CD workflows with GitHub Actions
- Added CI workflow for automated testing, linting, and building - Added release workflow for building and publishing Docker images - Added GitHub issue and PR templates - Created helper scripts for checking Redis availability - Added local CI check script to run all checks in one command - Added release preparation script - Updated README with CI/CD documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2946df9 commit 755152c

File tree

10 files changed

+713
-0
lines changed

10 files changed

+713
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
A clear and concise description of what the bug is.
11+
12+
## Reproduction Steps
13+
Steps to reproduce the behavior:
14+
1. Start the server with '...'
15+
2. Make API call to '...'
16+
3. With payload '...'
17+
4. See error
18+
19+
## Expected Behavior
20+
A clear and concise description of what you expected to happen.
21+
22+
## Environment
23+
- OS: [e.g. Ubuntu 22.04, macOS 13.0]
24+
- Rust Version: [e.g. 1.70.0]
25+
- Redis Version: [e.g. 7.0.5]
26+
- Docker Version (if applicable): [e.g. 23.0.5]
27+
28+
## Server Logs
29+
```
30+
Paste relevant server logs here
31+
```
32+
33+
## Additional Context
34+
Add any other context about the problem here, such as configurations used or specific environment conditions.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem Statement
10+
A clear and concise description of what problem this feature would solve.
11+
Ex. I'm always frustrated when [...]
12+
13+
## Proposed Solution
14+
A clear and concise description of what you want to happen.
15+
16+
## Alternative Solutions
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
## Implementation Ideas
20+
If you have any thoughts on how this could be implemented, please share them here.
21+
22+
## Additional Context
23+
Add any other context, screenshots, or examples about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Description
2+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
3+
4+
Fixes # (issue)
5+
6+
## Type of change
7+
Please delete options that are not relevant.
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
- [ ] Refactoring (no functional changes)
14+
- [ ] Performance improvement
15+
16+
## How Has This Been Tested?
17+
Please describe the tests that you ran to verify your changes. Provide instructions so others can reproduce.
18+
19+
- [ ] Manual verification
20+
- [ ] Added/updated unit tests
21+
- [ ] Added/updated integration tests
22+
- [ ] Added/updated e2e tests
23+
24+
## Checklist:
25+
- [ ] My code follows the style guidelines of this project
26+
- [ ] I have performed a self-review of my own code
27+
- [ ] I have commented my code, particularly in hard-to-understand areas
28+
- [ ] I have made corresponding changes to the documentation
29+
- [ ] My changes generate no new warnings
30+
- [ ] I have added tests that prove my fix is effective or that my feature works
31+
- [ ] New and existing tests pass locally with my changes

.github/docs/CI_CD.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# CI/CD Workflows Documentation
2+
3+
This document details the continuous integration and continuous deployment workflows for the L402 Server Example project.
4+
5+
## CI Workflow
6+
7+
The CI workflow runs on every push to the main branch and on pull requests targeting main. It consists of several jobs that run in sequence:
8+
9+
### 1. Check
10+
11+
Performs initial quality checks on the codebase:
12+
13+
- **Code Format**: Ensures all code follows Rust formatting guidelines using `cargo fmt`.
14+
- **Linting**: Runs Clippy to catch common mistakes and enforce code quality.
15+
- **Compilation**: Verifies that the code compiles correctly with all features enabled.
16+
17+
This job sets up a Redis service container for any checks that might need database access.
18+
19+
### 2. Test
20+
21+
Runs the full test suite:
22+
23+
- **Unit Tests**: Tests individual components in isolation.
24+
- **Integration Tests**: Tests interactions between components.
25+
- **Code Coverage**: Generates coverage reports using cargo-tarpaulin.
26+
27+
The test job depends on the check job passing successfully. It also uses a Redis service container for tests that require database functionality.
28+
29+
### 3. Security Audit
30+
31+
Performs security checks:
32+
33+
- **Dependency Audit**: Scans dependencies for known vulnerabilities using cargo-audit.
34+
35+
### 4. Build
36+
37+
Builds the production artifacts:
38+
39+
- **Release Binary**: Compiles the application in release mode.
40+
- **Artifact Upload**: Uploads the compiled binary as a job artifact.
41+
42+
This job runs only if the check and test jobs pass successfully.
43+
44+
### 5. Docker
45+
46+
Builds the Docker image:
47+
48+
- **Docker Build**: Creates the Docker image with the application.
49+
- **Caching**: Uses GitHub's cache for faster builds.
50+
51+
This job only runs on the main branch and depends on the build job passing successfully.
52+
53+
## Release Workflow
54+
55+
The release workflow is triggered when a release is published on GitHub or manually with a specified tag.
56+
57+
### 1. Release Build
58+
59+
Creates release artifacts:
60+
61+
- **Binary Build**: Compiles the application in release mode.
62+
- **Archive Creation**: Packages the binary with documentation, license, and configuration examples.
63+
- **Asset Upload**: Uploads the archive to the GitHub release.
64+
65+
### 2. Docker Publish
66+
67+
Publishes Docker images:
68+
69+
- **Image Build**: Creates the Docker image with the application.
70+
- **Registry Push**: Pushes the image to GitHub Container Registry (ghcr.io).
71+
- **Tagging**: Tags the image with both the specific version and 'latest'.
72+
73+
## GitHub Repository Settings
74+
75+
To make the most of these workflows, ensure the repository has the following settings:
76+
77+
1. **Branch Protection Rules** for the main branch:
78+
- Require status checks to pass before merging
79+
- Require branches to be up-to-date before merging
80+
81+
2. **GitHub Packages** enabled for Docker image publishing
82+
83+
3. **Workflow Permissions** set to allow:
84+
- Write access to packages (for Docker publishing)
85+
- Write access to contents (for release assets)

0 commit comments

Comments
 (0)