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,323 @@
1
+ ---
2
+ title: Local Testing Guide
3
+ description: Test GitHub Actions workflows locally using act with real integrations
4
+ ---
5
+
6
+ # ๐Ÿงช Local Testing Guide
7
+
8
+ *Test your gem-ci workflows locally with real Slack notifications and GitHub integration*
9
+
10
+ ## ๐ŸŽฏ Quick Start
11
+
12
+ ### **Install act**
13
+
14
+ **Prerequisites:** Docker must be installed and running
15
+
16
+ ```bash
17
+ # Official installation script (Linux/macOS)
18
+ curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
19
+
20
+ # Homebrew (macOS/Linux)
21
+ brew install act
22
+
23
+ # Chocolatey (Windows)
24
+ choco install act-cli
25
+
26
+ # GitHub CLI extension
27
+ gh extension install https://github.com/nektos/gh-act
28
+ ```
29
+
30
+ ### **Basic Local Testing**
31
+
32
+ ```bash
33
+ # List available workflows and jobs
34
+ act -l
35
+
36
+ # Test all workflows triggered by push (default event)
37
+ act
38
+
39
+ # Test all workflows triggered by pull request
40
+ act pull_request
41
+
42
+ # Test specific workflow file
43
+ act -W .github/workflows/02-ci.yml
44
+
45
+ # Test specific job in workflow
46
+ act -j test-ruby
47
+ ```
48
+
49
+ ## ๐Ÿ” Setup Secrets for Real Integrations
50
+
51
+ ### **Create Secrets File**
52
+
53
+ act supports multiple ways to provide secrets. The recommended approach is using a secrets file:
54
+
55
+ ```bash
56
+ # Copy the example file and fill in your values
57
+ cp .secrets.example .secrets
58
+
59
+ # Edit with your actual secrets
60
+ nano .secrets
61
+
62
+ # Secure the secrets file
63
+ chmod 600 .secrets
64
+
65
+ # Ensure it's in .gitignore
66
+ echo ".secrets" >> .gitignore
67
+ ```
68
+
69
+ **Example .secrets file format:**
70
+ ```bash
71
+ # GitHub Token (required)
72
+ GITHUB_TOKEN=github_pat_11ABCDEFG_your_token_here
73
+
74
+ # GitHub App (required for some workflows)
75
+ APP_ID=123456
76
+ PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
77
+ your_private_key_content_here
78
+ -----END RSA PRIVATE KEY-----"
79
+
80
+ # Slack Integration (optional)
81
+ SLACK_BOT_TOKEN=xoxb-1234567890-1234567890123-abc123
82
+ SLACK_CHANNEL_ID=C1234567890
83
+
84
+ # RubyGems Publishing (optional)
85
+ RUBYGEMS_API_KEY=rubygems_your_api_key_here
86
+ ```
87
+
88
+ **Alternative methods:**
89
+ ```bash
90
+ # Pass individual secrets via command line
91
+ act -s GITHUB_TOKEN=your_token
92
+
93
+ # Interactive secret input (secure, not saved in shell history)
94
+ act -s GITHUB_TOKEN
95
+
96
+ # Load from custom secrets file
97
+ act --secret-file my-secrets.env
98
+ ```
99
+
100
+ ### **Get Required Secrets**
101
+
102
+ **GitHub Token:**
103
+ 1. Go to GitHub โ†’ Settings โ†’ Developer settings โ†’ Personal access tokens
104
+ 2. Create token with `repo`, `workflow`, `write:packages` permissions
105
+ 3. Copy token to `.secrets` file
106
+
107
+ **Slack Integration:**
108
+ 1. Create Slack App at [api.slack.com](https://api.slack.com/apps)
109
+ 2. Add `chat:write` OAuth scope
110
+ 3. Install app to workspace
111
+ 4. Copy Bot User OAuth Token (starts with `xoxb-`)
112
+ 5. Get Channel ID from Slack (right-click channel โ†’ View channel details)
113
+
114
+ **RubyGems API Key:**
115
+ 1. Login to [rubygems.org](https://rubygems.org)
116
+ 2. Go to Account โ†’ API Keys
117
+ 3. Create new API key with push permissions
118
+
119
+ ## ๐Ÿš€ Run Workflows with Real Integrations
120
+
121
+ ### **Test CI with Slack Notifications**
122
+
123
+ ```bash
124
+ # Run CI workflow with real Slack notifications
125
+ act -W .github/workflows/02-ci.yml --secret-file .secrets
126
+
127
+ # Test Quality workflow with notifications
128
+ act -W .github/workflows/04-quality.yml --secret-file .secrets
129
+ ```
130
+
131
+ ### **Test Specific Events**
132
+
133
+ ```bash
134
+ # Test push event (default) - triggers CI, Security, Quality
135
+ act --secret-file .secrets
136
+
137
+ # Test pull request event
138
+ act pull_request --secret-file .secrets
139
+
140
+ # Test workflow dispatch (manual trigger)
141
+ act workflow_dispatch --secret-file .secrets
142
+
143
+ # Test scheduled workflows
144
+ act schedule --secret-file .secrets
145
+ ```
146
+
147
+ ### **Test with Custom Events**
148
+
149
+ ```bash
150
+ # Create custom event file
151
+ cat > test-event.json << 'EOF'
152
+ {
153
+ "pull_request": {
154
+ "number": 123,
155
+ "head": { "ref": "feature-branch" },
156
+ "base": { "ref": "main" }
157
+ }
158
+ }
159
+ EOF
160
+
161
+ # Use custom event
162
+ act pull_request -e test-event.json --secret-file .secrets
163
+ ```
164
+
165
+ ## ๐ŸŽญ Test Different Runner Images
166
+
167
+ act uses different Docker images to simulate GitHub runners:
168
+
169
+ | Size | Image | Description |
170
+ |------|-------|-------------|
171
+ | **Small** | `node:16-buster-slim` | ~200MB, basic Node.js environment |
172
+ | **Medium** | `catthehacker/ubuntu:act-latest` | ~500MB, good balance |
173
+ | **Large** | `catthehacker/ubuntu:full-latest` | Full Ubuntu environment |
174
+
175
+ ```bash
176
+ # Use medium-sized runner (recommended)
177
+ act -P ubuntu-latest=catthehacker/ubuntu:act-latest --secret-file .secrets
178
+
179
+ # Use small runner (fastest download)
180
+ act -P ubuntu-latest=node:16-buster-slim --secret-file .secrets
181
+
182
+ # Use full runner (most complete)
183
+ act -P ubuntu-latest=catthehacker/ubuntu:full-latest --secret-file .secrets
184
+ ```
185
+
186
+ ## ๐Ÿ” Debug Workflows
187
+
188
+ ```bash
189
+ # Run with verbose output
190
+ act -v --secret-file .secrets
191
+
192
+ # Run specific job only
193
+ act -j build-gem -W .github/workflows/06-release.yml --secret-file .secrets
194
+
195
+ # Test without network calls (offline mode)
196
+ act --action-offline-mode --secret-file .secrets
197
+ ```
198
+
199
+ ## ๐Ÿ”ฅ Test Release Workflow (Safely)
200
+
201
+ **Important:** Be careful with release workflows to avoid accidental publishing.
202
+
203
+ ```bash
204
+ # Test with environment variables to control behavior
205
+ cat > .env.test << 'EOF'
206
+ DRY_RUN=true
207
+ SKIP_PUBLISH=true
208
+ EOF
209
+
210
+ # Test release workflow with test environment
211
+ act -W .github/workflows/06-release.yml --secret-file .secrets --env-file .env.test
212
+
213
+ # Test specific release job only
214
+ act -j build-gem -W .github/workflows/06-release.yml --secret-file .secrets
215
+ ```
216
+
217
+ **Environment Variables for Testing:**
218
+ ```bash
219
+ # Copy example environment file
220
+ cp .env.example .env.test
221
+
222
+ # Pass environment variables directly
223
+ act --env DRY_RUN=true --env SKIP_PUBLISH=true --secret-file .secrets
224
+
225
+ # Load from environment file
226
+ act --env-file .env.test --secret-file .secrets
227
+ ```
228
+
229
+ **Example .env.test file:**
230
+ ```bash
231
+ # Ruby version override
232
+ RUBY_VERSION=3.3
233
+
234
+ # Testing flags
235
+ DRY_RUN=true
236
+ SKIP_PUBLISH=true
237
+ DEBUG=true
238
+
239
+ # Workflow overrides
240
+ DEFAULT_TIMEOUT=300
241
+ API_RETRY_COUNT=3
242
+ ```
243
+
244
+ ## ๐Ÿ“ฑ Real Slack Notifications
245
+
246
+ When testing with real secrets, you'll get actual Slack notifications using the **official Slack GitHub Action**:
247
+
248
+ ```bash
249
+ # This will send real Slack messages with rich formatting
250
+ act -W .github/workflows/02-ci.yml --secret-file .secrets
251
+ ```
252
+
253
+ **Expected Slack Message Format:**
254
+ - **Header**: โœ… 02 - CI
255
+ - **Repository**: your-username/your-repo
256
+ - **Status**: success
257
+ - **Branch**: main
258
+ - **Commit**: [abc1234](commit-link)
259
+ - **Message**: CI Pipeline completed for main
260
+ - **Action Button**: "View Workflow Run"
261
+
262
+ The notifications use Slack's Block Kit for rich formatting and include clickable links to commits and workflow runs.
263
+
264
+ ## ๐Ÿงน Cleanup
265
+
266
+ ```bash
267
+ # Remove secrets and test files (keep .example files)
268
+ rm .secrets .env.test .env.local test-event.json
269
+
270
+ # Remove Docker images used by act (optional)
271
+ docker rmi catthehacker/ubuntu:act-latest
272
+ docker rmi node:16-buster-slim
273
+
274
+ # Clean up Docker system (optional)
275
+ docker system prune
276
+ ```
277
+
278
+ ## ๐Ÿ’ก Pro Tips
279
+
280
+ **Use Configuration File:**
281
+ ```bash
282
+ # Create ~/.actrc for permanent settings (one argument per line)
283
+ cat > ~/.actrc << 'EOF'
284
+ -P ubuntu-latest=catthehacker/ubuntu:act-latest
285
+ --secret-file .secrets
286
+ --env-file .env
287
+ EOF
288
+ ```
289
+
290
+ **Quick Test Commands:**
291
+ ```bash
292
+ # Test before pushing (default push event)
293
+ act --secret-file .secrets
294
+
295
+ # Test PR checks
296
+ act pull_request --secret-file .secrets
297
+
298
+ # Test specific job
299
+ act -j test-ruby --secret-file .secrets
300
+
301
+ # Test with variables (for ${{ vars.VARIABLE }})
302
+ act --var MY_VAR=value --secret-file .secrets
303
+ ```
304
+
305
+ **Environment Variables:**
306
+ ```bash
307
+ # Pass individual environment variables
308
+ act --env RUBY_VERSION=3.2 --secret-file .secrets
309
+
310
+ # Load from .env file (dotenv format)
311
+ act --env-file .env.local --secret-file .secrets
312
+ ```
313
+
314
+ ## ๐Ÿšจ Security Notes
315
+
316
+ - Never commit `.secrets` file to repository
317
+ - Use different secrets for testing vs production
318
+ - Rotate secrets regularly
319
+ - Consider using test Slack channels for local testing
320
+
321
+ ---
322
+
323
+ **Need help?** Check the [secrets setup guide](../setup/secrets.md) for detailed secret configuration.
data/docs/index.md ADDED
@@ -0,0 +1,112 @@
1
+ ---
2
+ layout: default
3
+ title: gem-ci Documentation
4
+ description: The Ultimate Ruby Gem Automation Showcase
5
+ ---
6
+
7
+ <div align="center">
8
+
9
+ # ๐Ÿ† gem-ci Documentation
10
+
11
+ ![gem-ci Logo](../public/gem-ci-transparent-bg.png)
12
+
13
+ **The Ultimate Ruby Gem Automation Showcase**
14
+
15
+ *Battle-tested GitHub Actions workflows with comprehensive CI/CD, security, and community management*
16
+
17
+ </div>
18
+
19
+ ## ๐Ÿš€ Quick Navigation
20
+
21
+ <div class="grid">
22
+ <div class="card">
23
+ <h3>๐Ÿ Getting Started</h3>
24
+ <p>Set up your repository with our automation workflows</p>
25
+ <ul>
26
+ <li><a href="setup/secrets">๐Ÿ” Secrets Setup</a></li>
27
+ <li><a href="setup/labels">๐Ÿท๏ธ Labels Configuration</a></li>
28
+ <li><a href="guides/local-testing">๐Ÿงช Local Testing</a></li>
29
+ </ul>
30
+ </div>
31
+
32
+ <div class="card">
33
+ <h3>๐Ÿ“Š Workflows</h3>
34
+ <p>Understand our comprehensive automation</p>
35
+ <ul>
36
+ <li><a href="workflows/overview">๐Ÿ”„ Workflow Overview</a></li>
37
+ <li><a href="guides/bot-commands">๐Ÿค– Bot Commands</a></li>
38
+ <li><a href="guides/monitoring">๐Ÿ“ˆ Monitoring</a></li>
39
+ </ul>
40
+ </div>
41
+
42
+ <div class="card">
43
+ <h3>๐ŸŽฏ Advanced</h3>
44
+ <p>Customize and extend the workflows</p>
45
+ <ul>
46
+ <li><a href="guides/customization">๐Ÿ”ง Customization</a></li>
47
+ <li><a href="guides/ecosystem">๐ŸŒ Ecosystem Integration</a></li>
48
+ <li><a href="guides/validation">โœ… Validation</a></li>
49
+ </ul>
50
+ </div>
51
+ </div>
52
+
53
+ ## โœจ What gem-ci Provides
54
+
55
+ This repository showcases **9 comprehensive workflows** that handle every aspect of your Ruby gem's lifecycle:
56
+
57
+ - ๐Ÿ”„ **Automated CI/CD** with consolidated PR status dashboard
58
+ - ๐Ÿ”’ **Security scanning** and vulnerability detection
59
+ - ๐Ÿ“Š **Code quality** enforcement with focused linting
60
+ - ๐Ÿš€ **Automated releases** with semantic versioning
61
+ - ๐Ÿ‘ฅ **Community management** and contributor engagement
62
+ - ๐Ÿ“ˆ **Performance monitoring** and ecosystem health
63
+ - ๐Ÿค– **Bot commands** for interactive workflow management
64
+ - ๐ŸŒ **Ecosystem integration** and compatibility checks
65
+ - ๐Ÿ“Š **Advanced monitoring** with cost-optimized scheduling
66
+
67
+ ## ๐ŸŽฏ Key Highlights
68
+
69
+ ### **๐Ÿ’ฐ Cost Optimized**
70
+ - Ruby 3.3 only (instead of multiple versions)
71
+ - Ubuntu runners only (instead of cross-platform)
72
+ - Reduced scheduled workflow frequency
73
+ - **~75-80% cost reduction** compared to typical setups
74
+
75
+ ### **๐Ÿš€ Performance Focused**
76
+ - Consolidated PR status dashboard (no comment spam)
77
+ - Focused custom linting (replacing slow super-linter)
78
+ - Parallel job execution
79
+ - Smart caching strategies
80
+
81
+ ### **๐Ÿค– Interactive Automation**
82
+ - Slash commands for release management
83
+ - Bot-driven workflow interactions
84
+ - Automated community engagement
85
+ - Smart notification systems
86
+
87
+ ## ๐Ÿš€ Quick Start
88
+
89
+ 1. **[Use this template](https://github.com/patrick204nqh/gem-ci/generate)** to create your repository
90
+ 2. **[Set up secrets](setup/secrets)** for GitHub App authentication
91
+ 3. **[Configure labels](setup/labels)** and repository settings
92
+ 4. **[Test locally](guides/local-testing)** before going live
93
+ 5. **Start developing** - automation handles the rest!
94
+
95
+ ## ๐Ÿค Contributing
96
+
97
+ We welcome contributions! Please see our [Contributing Guide](../CONTRIBUTING.md) for details.
98
+
99
+ ## ๐Ÿ“„ License
100
+
101
+ This project is licensed under the MIT License - see the [LICENSE](../LICENSE.txt) file for details.
102
+
103
+ ---
104
+
105
+ <div align="center">
106
+
107
+ **Built with โค๏ธ for the Ruby community**
108
+
109
+ [![GitHub](https://img.shields.io/badge/GitHub-patrick204nqh%2Fgem--ci-blue?style=flat-square&logo=github)](https://github.com/patrick204nqh/gem-ci)
110
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](../LICENSE.txt)
111
+
112
+ </div>
@@ -0,0 +1,147 @@
1
+ # GitHub Pages Setup
2
+
3
+ Simple guide to enable GitHub Pages for your gem-ci repository documentation.
4
+
5
+ ## Quick Setup
6
+
7
+ ### 1. Enable GitHub Pages
8
+
9
+ 1. Go to repository **Settings**
10
+ 2. Scroll to **Pages** section
11
+ 3. Under **Source**, select **Deploy from a branch**
12
+ 4. Choose **Branch**: `master` or `main`
13
+ 5. Choose **Folder**: `/ (root)` or `/docs`
14
+ 6. Click **Save**
15
+
16
+ ### 2. Configure Jekyll (if using /docs folder)
17
+
18
+ The repository already includes `docs/_config.yml`:
19
+
20
+ ```yaml
21
+ title: gem-ci
22
+ description: Ruby gem continuous integration workflows
23
+ baseurl: "/gem-ci"
24
+ url: "https://your-username.github.io"
25
+
26
+ markdown: kramdown
27
+ highlighter: rouge
28
+ theme: minima
29
+
30
+ plugins:
31
+ - jekyll-feed
32
+ - jekyll-sitemap
33
+
34
+ exclude:
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - node_modules
38
+ - vendor
39
+ ```
40
+
41
+ ### 3. Update Configuration
42
+
43
+ Edit `docs/_config.yml` with your details:
44
+
45
+ ```yaml
46
+ title: Your Gem Name
47
+ description: Your gem description
48
+ baseurl: "/your-repo-name"
49
+ url: "https://your-username.github.io"
50
+ ```
51
+
52
+ ### 4. Access Your Site
53
+
54
+ After setup, your documentation will be available at:
55
+
56
+ ```
57
+ https://your-username.github.io/your-repo-name/
58
+ ```
59
+
60
+ ## File Structure
61
+
62
+ The docs folder should look like:
63
+
64
+ ```
65
+ docs/
66
+ โ”œโ”€โ”€ _config.yml # Jekyll configuration
67
+ โ”œโ”€โ”€ index.md # Homepage
68
+ โ”œโ”€โ”€ guides/ # User guides
69
+ โ”‚ โ”œโ”€โ”€ gitflow.md
70
+ โ”‚ โ””โ”€โ”€ local-testing.md
71
+ โ”œโ”€โ”€ setup/ # Setup instructions
72
+ โ”‚ โ”œโ”€โ”€ secrets.md
73
+ โ”‚ โ””โ”€โ”€ github-pages.md
74
+ โ”œโ”€โ”€ workflows/ # Workflow documentation
75
+ โ”‚ โ””โ”€โ”€ overview.md
76
+ โ””โ”€โ”€ diagrams/ # Workflow diagrams
77
+ โ””โ”€โ”€ ci-workflow-overview.md
78
+ ```
79
+
80
+ ## Custom Domain (Optional)
81
+
82
+ To use a custom domain:
83
+
84
+ 1. Create `docs/CNAME` file with your domain:
85
+ ```
86
+ your-domain.com
87
+ ```
88
+
89
+ 2. Configure DNS with your domain provider:
90
+ - Add CNAME record pointing to `your-username.github.io`
91
+
92
+ 3. In repository Settings > Pages:
93
+ - Enter your custom domain
94
+ - Enable "Enforce HTTPS"
95
+
96
+ ## Testing Locally
97
+
98
+ Install Jekyll to test locally:
99
+
100
+ ```bash
101
+ # Install Jekyll
102
+ gem install jekyll bundler
103
+
104
+ # Navigate to docs folder
105
+ cd docs
106
+
107
+ # Create Gemfile if needed
108
+ bundle init
109
+ bundle add jekyll
110
+ bundle add minima
111
+
112
+ # Serve locally
113
+ bundle exec jekyll serve
114
+
115
+ # View at http://localhost:4000
116
+ ```
117
+
118
+ ## Troubleshooting
119
+
120
+ **Site not updating?**
121
+ - Check Actions tab for build errors
122
+ - Wait 5-10 minutes for changes to deploy
123
+ - Clear browser cache
124
+
125
+ **404 errors?**
126
+ - Verify baseurl in `_config.yml`
127
+ - Check file paths are correct
128
+ - Ensure markdown files have proper frontmatter
129
+
130
+ **Build failures?**
131
+ - Check Jekyll syntax in markdown files
132
+ - Verify all includes and layouts exist
133
+ - Review GitHub Actions logs
134
+
135
+ ## Frontmatter Template
136
+
137
+ Add to the top of each markdown file:
138
+
139
+ ```yaml
140
+ ---
141
+ layout: default
142
+ title: Page Title
143
+ description: Page description
144
+ ---
145
+ ```
146
+
147
+ That's it! Your gem-ci documentation will be live on GitHub Pages.
@@ -9,13 +9,13 @@ This guide walks you through setting up all required secrets for gem-ci workflow
9
9
 
10
10
  The gem-ci workflows require the following secrets:
11
11
 
12
- | Secret | Purpose | Required | Setup Section |
13
- |--------|---------|----------|---------------|
14
- | `APP_ID` | GitHub App ID for branded automation | โœ… Yes | Step 1-2 |
15
- | `PRIVATE_KEY` | GitHub App private key | โœ… Yes | Step 1-2 |
16
- | `SLACK_BOT_TOKEN` | Slack bot token for notifications | โŒ Optional | Step 3 |
17
- | `SLACK_CHANNEL_ID` | Slack channel ID | โŒ Optional | Step 3 |
18
- | `RUBYGEMS_API_KEY` | RubyGems publishing key | โŒ Optional | Step 4 |
12
+ | Secret | Purpose | Required | Setup Section |
13
+ | ------------------ | ------------------------------------ | ---------- | ------------- |
14
+ | `APP_ID` | GitHub App ID for branded automation | โœ… Yes | Step 1-2 |
15
+ | `PRIVATE_KEY` | GitHub App private key | โœ… Yes | Step 1-2 |
16
+ | `SLACK_BOT_TOKEN` | Slack bot token for notifications | โŒ Optional | Step 3 |
17
+ | `SLACK_CHANNEL_ID` | Slack channel ID | โŒ Optional | Step 3 |
18
+ | `RUBYGEMS_API_KEY` | RubyGems publishing key | โŒ Optional | Step 4 |
19
19
 
20
20
  ## ๐Ÿ“‹ Prerequisites
21
21