gem-ci 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,233 @@
1
+ # GitFlow Workflow Diagram
2
+
3
+ Visual representation of the GitFlow branching model used in gem-ci projects.
4
+
5
+ ## Branch Flow Diagram
6
+
7
+ ```mermaid
8
+ gitGraph
9
+ commit id: "Initial"
10
+
11
+ branch develop
12
+ checkout develop
13
+ commit id: "Setup dev"
14
+
15
+ branch feature/auth
16
+ checkout feature/auth
17
+ commit id: "Add login"
18
+ commit id: "Add tests"
19
+
20
+ checkout develop
21
+ merge feature/auth
22
+ commit id: "Merge auth"
23
+
24
+ branch feature/api
25
+ checkout feature/api
26
+ commit id: "Add API"
27
+ commit id: "API tests"
28
+
29
+ checkout develop
30
+ merge feature/api
31
+ commit id: "Merge API"
32
+
33
+ branch release/v1.0.0
34
+ checkout release/v1.0.0
35
+ commit id: "Version bump"
36
+ commit id: "Update docs"
37
+
38
+ checkout main
39
+ merge release/v1.0.0
40
+ commit id: "Release v1.0.0"
41
+
42
+ checkout develop
43
+ merge release/v1.0.0
44
+
45
+ checkout main
46
+ branch hotfix/v1.0.1
47
+ checkout hotfix/v1.0.1
48
+ commit id: "Critical fix"
49
+
50
+ checkout main
51
+ merge hotfix/v1.0.1
52
+ commit id: "Hotfix v1.0.1"
53
+
54
+ checkout develop
55
+ merge hotfix/v1.0.1
56
+ ```
57
+
58
+ ## Detailed GitFlow Process
59
+
60
+ ```mermaid
61
+ flowchart TD
62
+ A[Start Development] --> B{Feature or Fix?}
63
+
64
+ B -->|New Feature| C[Create feature/* branch]
65
+ B -->|Bug Fix| D[Create bugfix/* branch]
66
+ B -->|Critical Fix| E[Create hotfix/* branch]
67
+
68
+ C --> F[Develop Feature]
69
+ D --> G[Fix Bug]
70
+ E --> H[Apply Hotfix]
71
+
72
+ F --> I[Create PR to develop]
73
+ G --> J[Create PR to develop]
74
+ H --> K[Create PR to master]
75
+
76
+ I --> L{CI Passes?}
77
+ J --> L
78
+ K --> M{CI Passes?}
79
+
80
+ L -->|No| N[Fix Issues]
81
+ L -->|Yes| O[Merge to develop]
82
+ M -->|No| P[Fix Issues]
83
+ M -->|Yes| Q[Merge to master]
84
+
85
+ N --> F
86
+ P --> H
87
+
88
+ O --> R[Integration Testing]
89
+ Q --> S[Tag Release]
90
+ Q --> T[Merge to develop]
91
+
92
+ R --> U{Ready for Release?}
93
+ U -->|No| V[Continue Development]
94
+ U -->|Yes| W[Create release/* branch]
95
+
96
+ V --> A
97
+ W --> X[Prepare Release]
98
+ X --> Y[Create PR to master]
99
+ Y --> Z{Release CI Passes?}
100
+ Z -->|No| AA[Fix Release Issues]
101
+ Z -->|Yes| BB[Merge & Tag]
102
+
103
+ AA --> X
104
+ BB --> CC[Deploy to Production]
105
+ BB --> DD[Merge back to develop]
106
+
107
+ S --> EE[Hotfix Complete]
108
+ CC --> FF[Release Complete]
109
+ DD --> GG[Sync Complete]
110
+
111
+ EE --> A
112
+ FF --> A
113
+ GG --> A
114
+ ```
115
+
116
+ ## CI/CD Integration
117
+
118
+ ```mermaid
119
+ flowchart LR
120
+ subgraph "Branch Types"
121
+ A[feature/*]
122
+ B[bugfix/*]
123
+ C[develop]
124
+ D[release/*]
125
+ E[hotfix/*]
126
+ F[master]
127
+ end
128
+
129
+ subgraph "CI Workflows"
130
+ G[02-ci.yml<br/>Basic Tests]
131
+ H[03-security.yml<br/>Security Scan]
132
+ I[04-quality.yml<br/>Code Quality]
133
+ J[06-release.yml<br/>Release Process]
134
+ end
135
+
136
+ subgraph "Checks Required"
137
+ K[✅ Ruby 3.3 Tests]
138
+ L[✅ RuboCop Linting]
139
+ M[✅ Security Scan]
140
+ N[✅ Code Coverage]
141
+ end
142
+
143
+ A --> G
144
+ B --> G
145
+ C --> G
146
+ C --> H
147
+ C --> I
148
+ D --> G
149
+ D --> H
150
+ D --> I
151
+ E --> G
152
+ E --> H
153
+ F --> J
154
+
155
+ G --> K
156
+ I --> L
157
+ H --> M
158
+ G --> N
159
+ ```
160
+
161
+ ## Branch Protection Rules
162
+
163
+ ```mermaid
164
+ flowchart TD
165
+ subgraph "master Branch"
166
+ A[🔒 Delete Protection]
167
+ B[🔒 Force Push Protection]
168
+ C[✅ Ruby 3.3 CI Required]
169
+ D[✅ Code Quality Required]
170
+ E[✅ Security Scan Required]
171
+ F[👥 PR Review Required]
172
+ G[✍️ Signed Commits Required]
173
+ end
174
+
175
+ subgraph "develop Branch"
176
+ H[✅ Ruby 3.3 CI Required]
177
+ I[✅ Code Quality Required]
178
+ J[👥 PR Review Optional]
179
+ end
180
+
181
+ subgraph "feature/* Branches"
182
+ K[🔓 No Protection]
183
+ L[✅ CI Tests on PR]
184
+ end
185
+
186
+ subgraph "release/* Branches"
187
+ M[✅ Ruby 3.3 CI Required]
188
+ N[✅ Full Quality Suite]
189
+ O[👥 PR Review Required]
190
+ end
191
+ ```
192
+
193
+ ## Release Automation Flow
194
+
195
+ ```mermaid
196
+ sequenceDiagram
197
+ participant Dev as Developer
198
+ participant PR as Pull Request
199
+ participant CI as CI/CD Pipeline
200
+ participant RP as Release Please
201
+ participant GH as GitHub Releases
202
+ participant RG as RubyGems
203
+ participant SL as Slack
204
+
205
+ Dev->>PR: Create PR to master
206
+ PR->>CI: Trigger CI workflows
207
+ CI->>CI: Run tests, security, quality
208
+ CI->>PR: ✅ All checks pass
209
+ Dev->>PR: Merge to master
210
+
211
+ PR->>RP: Trigger release-please
212
+ RP->>RP: Analyze conventional commits
213
+ RP->>GH: Create release PR (if needed)
214
+
215
+ Dev->>GH: Merge release PR
216
+ GH->>CI: Trigger release workflow
217
+ CI->>GH: Create GitHub release
218
+ CI->>RG: Publish to RubyGems
219
+ CI->>SL: Send success notification
220
+ ```
221
+
222
+ ## Workflow Triggers Summary
223
+
224
+ | Branch Pattern | Workflow Triggered | Purpose |
225
+ |---------------|-------------------|---------|
226
+ | `feature/*` | CI on PR | Validate feature changes |
227
+ | `bugfix/*` | CI on PR | Validate bug fixes |
228
+ | `develop` | CI + Security + Quality | Integration validation |
229
+ | `release/*` | Full CI Suite | Pre-release validation |
230
+ | `hotfix/*` | CI + Security | Critical fix validation |
231
+ | `master` | Release Process | Production deployment |
232
+
233
+ This diagram shows how gem-ci integrates GitFlow with automated CI/CD for efficient Ruby gem development and deployment.
@@ -0,0 +1,266 @@
1
+ # GitFlow Guide for gem-ci
2
+
3
+ This guide explains the Git workflow and branching strategy used in gem-ci projects.
4
+
5
+ ## Overview
6
+
7
+ gem-ci follows a simplified GitFlow model optimized for Ruby gem development with automated CI/CD integration.
8
+
9
+ 📊 **Visual Guide**: See the [GitFlow Diagram](../diagrams/gitflow-diagram.md) for a visual representation of this workflow.
10
+
11
+ ## Branch Structure
12
+
13
+ ### Main Branches
14
+
15
+ - **`master`** - Production-ready releases
16
+ - Always deployable
17
+ - Protected with required status checks
18
+ - All commits must be signed
19
+ - Requires pull request reviews
20
+
21
+ - **`develop`** - Integration branch for features
22
+ - Latest development changes
23
+ - Automatically tested on push
24
+ - Base branch for feature development
25
+
26
+ ### Supporting Branches
27
+
28
+ - **`feature/*`** - New features and enhancements
29
+ - Branch from: `develop`
30
+ - Merge back to: `develop`
31
+ - Naming: `feature/description` or `feature/issue-number`
32
+
33
+ - **`bugfix/*`** - Bug fixes for development
34
+ - Branch from: `develop`
35
+ - Merge back to: `develop`
36
+ - Naming: `bugfix/description` or `bugfix/issue-number`
37
+
38
+ - **`hotfix/*`** - Critical production fixes
39
+ - Branch from: `master`
40
+ - Merge back to: `master` and `develop`
41
+ - Naming: `hotfix/version` or `hotfix/critical-fix`
42
+
43
+ - **`release/*`** - Release preparation
44
+ - Branch from: `develop`
45
+ - Merge back to: `master` and `develop`
46
+ - Naming: `release/v1.2.3`
47
+
48
+ ## Workflow Steps
49
+
50
+ ### Feature Development
51
+
52
+ ```bash
53
+ # Start new feature
54
+ git checkout develop
55
+ git pull origin develop
56
+ git checkout -b feature/new-awesome-feature
57
+
58
+ # Work on feature
59
+ git add .
60
+ git commit -m "feat: add awesome feature"
61
+ git push origin feature/new-awesome-feature
62
+
63
+ # Create pull request to develop
64
+ # After review and CI passes, merge via GitHub
65
+ ```
66
+
67
+ ### Bug Fixes
68
+
69
+ ```bash
70
+ # Start bug fix
71
+ git checkout develop
72
+ git pull origin develop
73
+ git checkout -b bugfix/fix-critical-issue
74
+
75
+ # Fix the bug
76
+ git add .
77
+ git commit -m "fix: resolve critical issue with validation"
78
+ git push origin bugfix/fix-critical-issue
79
+
80
+ # Create pull request to develop
81
+ ```
82
+
83
+ ### Hotfix Process
84
+
85
+ ```bash
86
+ # Start hotfix from master
87
+ git checkout master
88
+ git pull origin master
89
+ git checkout -b hotfix/v1.2.1
90
+
91
+ # Apply critical fix
92
+ git add .
93
+ git commit -m "fix: critical security vulnerability"
94
+ git push origin hotfix/v1.2.1
95
+
96
+ # Create PR to master
97
+ # After merge, also merge to develop to sync changes
98
+ ```
99
+
100
+ ### Release Process
101
+
102
+ ```bash
103
+ # Start release preparation
104
+ git checkout develop
105
+ git pull origin develop
106
+ git checkout -b release/v1.3.0
107
+
108
+ # Prepare release (version bumps, changelog, etc.)
109
+ git add .
110
+ git commit -m "chore: prepare release v1.3.0"
111
+ git push origin release/v1.3.0
112
+
113
+ # Create PR to master
114
+ # After merge, tag will be created automatically by release-please
115
+ ```
116
+
117
+ ## Automated Workflows
118
+
119
+ gem-ci includes automated workflows that integrate with this GitFlow:
120
+
121
+ ### CI Triggers
122
+
123
+ - **Feature/Bugfix branches**: Run CI tests on push and PR
124
+ - **Develop branch**: Full CI suite including integration tests
125
+ - **Master branch**: Complete CI/CD including release preparation
126
+ - **Release branches**: Pre-release validation and artifact generation
127
+
128
+ ### Branch Protection
129
+
130
+ Repository rulesets enforce the GitFlow model:
131
+
132
+ - **Master**: Requires PR reviews, status checks, signed commits
133
+ - **Develop**: Requires status checks for integration
134
+ - **Release branches**: Requires CI validation before merge
135
+
136
+ ### Automated Release
137
+
138
+ - Release Please manages version bumps and changelog generation
139
+ - Tags and releases are created automatically on master merges
140
+ - RubyGems publishing happens automatically for tagged releases
141
+
142
+ ## Commit Message Convention
143
+
144
+ Follow [Conventional Commits](https://www.conventionalcommits.org/):
145
+
146
+ ```
147
+ <type>[optional scope]: <description>
148
+
149
+ [optional body]
150
+
151
+ [optional footer(s)]
152
+ ```
153
+
154
+ ### Types
155
+
156
+ - `feat`: New feature
157
+ - `fix`: Bug fix
158
+ - `docs`: Documentation changes
159
+ - `style`: Code style changes (formatting, etc.)
160
+ - `refactor`: Code refactoring
161
+ - `test`: Adding or updating tests
162
+ - `chore`: Maintenance tasks
163
+ - `ci`: CI/CD changes
164
+ - `perf`: Performance improvements
165
+ - `build`: Build system changes
166
+
167
+ ### Examples
168
+
169
+ ```bash
170
+ git commit -m "feat: add support for custom linting rules"
171
+ git commit -m "fix: resolve memory leak in test runner"
172
+ git commit -m "docs: update installation guide with Ruby 3.3 requirements"
173
+ git commit -m "ci: optimize workflow to use only Ruby 3.3 for cost savings"
174
+ ```
175
+
176
+ ## Integration with gem-ci Workflows
177
+
178
+ ### Status Checks
179
+
180
+ Each branch type triggers appropriate workflows:
181
+
182
+ ```yaml
183
+ # .github/workflows/02-ci.yml runs on:
184
+ - feature/* branches (PR events)
185
+ - bugfix/* branches (PR events)
186
+ - develop branch (push events)
187
+ - master branch (push events)
188
+ ```
189
+
190
+ ### Quality Gates
191
+
192
+ - **Code Quality**: RuboCop, custom linting
193
+ - **Security**: CodeQL analysis, vulnerability scanning
194
+ - **Testing**: RSpec test suite with coverage
195
+ - **Documentation**: Link validation, structure checks
196
+
197
+ ### Release Automation
198
+
199
+ ```yaml
200
+ # .github/workflows/06-release.yml handles:
201
+ - Version detection from conventional commits
202
+ - Changelog generation
203
+ - GitHub release creation
204
+ - RubyGems publication
205
+ - Slack notifications
206
+ ```
207
+
208
+ ## Best Practices
209
+
210
+ ### Branch Naming
211
+
212
+ - Use descriptive names: `feature/add-parallel-testing`
213
+ - Include issue numbers: `bugfix/123-fix-memory-leak`
214
+ - Keep names short but clear
215
+ - Use kebab-case for consistency
216
+
217
+ ### Pull Request Guidelines
218
+
219
+ - **Title**: Use conventional commit format
220
+ - **Description**: Explain what and why, not how
221
+ - **Reviewers**: Request appropriate team members
222
+ - **Labels**: Apply relevant labels automatically via labeler
223
+
224
+ ### Merge Strategy
225
+
226
+ - **Squash and merge** for feature branches
227
+ - **Create merge commit** for release branches
228
+ - **Rebase and merge** for small fixes (optional)
229
+
230
+ ## Troubleshooting
231
+
232
+ ### Common Issues
233
+
234
+ **Branch protection conflicts:**
235
+ ```bash
236
+ # If direct push is blocked
237
+ git checkout -b fix/update-readme
238
+ # Make changes, then PR instead of direct push
239
+ ```
240
+
241
+ **Merge conflicts:**
242
+ ```bash
243
+ # Update your branch with latest develop
244
+ git checkout feature/my-feature
245
+ git fetch origin
246
+ git rebase origin/develop
247
+ # Resolve conflicts, then continue
248
+ git rebase --continue
249
+ ```
250
+
251
+ **Failed status checks:**
252
+ ```bash
253
+ # Run tests locally first
254
+ bundle exec rspec
255
+ bundle exec rubocop
256
+ # Fix issues before pushing
257
+ ```
258
+
259
+ ## References
260
+
261
+ - [Git Flow Original](https://nvie.com/posts/a-successful-git-branching-model/)
262
+ - [GitHub Flow](https://guides.github.com/introduction/flow/)
263
+ - [Conventional Commits](https://www.conventionalcommits.org/)
264
+ - [Semantic Versioning](https://semver.org/)
265
+
266
+ This GitFlow model balances structure with simplicity, ensuring quality while maintaining development velocity.