pg_multitenant_schemas 0.2.0 โ†’ 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb953481e57f8425d7a272414d51e9225d224f6975f7e519051566f8e6c58406
4
- data.tar.gz: 3512040a1448b3a8cca8f829717ecc373510234bc53e2d84243272ea16903846
3
+ metadata.gz: 4523327235e126955f182413b00ecab417f260daf3b0ed550ece95bc1da7a8bf
4
+ data.tar.gz: 4f277b6139588035c3d04befb30b475ad55fd7a199d582e7728aed15757dcc7c
5
5
  SHA512:
6
- metadata.gz: c4e77e04b02112a32d8ac953ab0c88a662cc599ec1fc498f6c3205c3a4596ba74e26c514add5de50df58414ff4dfd62a65241e2dbe26f1dbfcdd3093eab25426
7
- data.tar.gz: 267b65ce20ab82f817c1ecd959dcd3781ad7f0b00434a381cf3a7968cf1e5363bf57519d26e07cf3bc9d75b90797f2b394c2a3bca8ef060b52e01768ce8c10e4
6
+ metadata.gz: a454ee397a247ea820b89590c0e9c8d10f63e83507f4b989b27780b8721c99b5191fe9048f7cf378d9388371650524b48adcf4a4ec58c2566aa2e0afdfb66929
7
+ data.tar.gz: 6adc8a9a67ff69b2e045982ff85a48f045a683614bb548343bc64e78062c01b191e5e70984c8ed3dd110696bd556f51def524dd2619f1a5d20cd43f3eeafcb9a
data/.actrc ADDED
@@ -0,0 +1,17 @@
1
+ # act configuration file
2
+ # This configures act to run GitHub Actions locally
3
+
4
+ # Use Linux AMD64 architecture for compatibility
5
+ --container-architecture linux/amd64
6
+
7
+ # Set artifact server path
8
+ --artifact-server-path /tmp/act-artifacts
9
+
10
+ # Load environment variables from local file
11
+ --env-file .env.local
12
+
13
+ # Use medium size runner image
14
+ --platform ubuntu-latest=catthehacker/ubuntu:act-latest
15
+
16
+ # Show more verbose output
17
+ --verbose
@@ -0,0 +1,21 @@
1
+ # Local environment variables for testing with act
2
+ # Copy this to .env.local and fill in your actual values
3
+
4
+ # GitHub token (create at https://github.com/settings/tokens)
5
+ # Needs repo and workflow permissions
6
+ GITHUB_TOKEN=your_github_token_here
7
+
8
+ # RubyGems API key (get from https://rubygems.org/profile/edit)
9
+ # Only needed for testing release workflow
10
+ RUBYGEMS_API_KEY=your_rubygems_api_key_here
11
+
12
+ # Repository information
13
+ GITHUB_REPOSITORY=rubenpazch/pg_multitenant_schemas
14
+ GITHUB_ACTOR=your_github_username
15
+
16
+ # PostgreSQL configuration for local testing
17
+ PGDATABASE=pg_multitenant_test
18
+ PGUSER=postgres
19
+ PGPASSWORD=
20
+ PGHOST=localhost
21
+ PGPORT=5432
data/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2] - 2025-09-07
11
+
12
+ ### ๐Ÿ”ง **Developer Experience & Testing**
13
+ - **NEW: Local Workflow Testing**: Complete solution for testing GitHub Actions locally before push
14
+ - **NEW: Pre-Push Validation**: `pre-push-check.sh` script validates CI components locally
15
+ - **NEW: GitHub Actions Testing**: `act` tool integration with configuration files
16
+ - **NEW: Validation Scripts**: `validate-github-commands.sh` and `test-github-setup.sh`
17
+
18
+ ### ๐Ÿš€ **CI/CD Improvements**
19
+ - **FIXED: GitHub Actions Permissions**: Resolved permission issues with release workflow
20
+ - **FIXED: RSpec Command**: Corrected `--exclude-pattern` usage for unit test isolation
21
+ - **IMPROVED: Release Automation**: Enhanced release workflow with proper bot identity
22
+ - **IMPROVED: Documentation**: Comprehensive guides for CI/CD setup and troubleshooting
23
+
24
+ ### ๐Ÿ“š **Documentation Enhancements**
25
+ - **NEW: Local Testing Guide**: `TESTING_LOCALLY.md` and `LOCAL_TESTING_SUMMARY.md`
26
+ - **NEW: CI/CD Setup Guide**: `docs/github_actions_setup.md` with step-by-step instructions
27
+ - **NEW: Permissions Fix Guide**: `docs/github_actions_permissions_fix.md`
28
+ - **NEW: Workflow Testing Guide**: `docs/local_workflow_testing.md`
29
+ - **IMPROVED: Core Documentation**: Updated `docs/README.md` with local testing references
30
+
31
+ ### ๐Ÿงช **Testing Infrastructure**
32
+ - **ENHANCED: RuboCop Compliance**: Fixed all code style violations across test suite
33
+ - **ENHANCED: Test Organization**: Improved test structure and mocking patterns
34
+ - **ENHANCED: Integration Testing**: Better PostgreSQL integration test support
35
+ - **ENHANCED: Security Auditing**: Bundle audit integration in CI pipeline
36
+
37
+ ### ๐Ÿ”ง **Configuration Files**
38
+ - **NEW: `.actrc`**: Configuration for local GitHub Actions testing
39
+ - **NEW: `.env.local.example`**: Template for local environment variables
40
+ - **IMPROVED: `.gitignore`**: Added local testing files to ignore list
41
+
42
+ ## [0.2.1] - 2025-09-06
43
+
10
44
  ### ๐Ÿš€ **Migration System Overhaul**
11
45
  - **NEW: Automated Migration Management**: Complete migration system for multi-tenant schemas
12
46
  - **NEW: PgMultitenantSchemas::Migrator**: Comprehensive migration management class
@@ -94,3 +128,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
94
128
  - Initial release
95
129
  - Basic schema switching functionality
96
130
  - PostgreSQL multitenancy support
131
+
132
+ [Unreleased]: https://github.com/rubenpazch/pg_multitenant_schemas/compare/v0.2.2...HEAD
133
+ [0.2.2]: https://github.com/rubenpazch/pg_multitenant_schemas/compare/v0.2.1...v0.2.2
134
+ [0.2.1]: https://github.com/rubenpazch/pg_multitenant_schemas/compare/v0.2.0...v0.2.1
135
+ [0.2.0]: https://github.com/rubenpazch/pg_multitenant_schemas/compare/v0.1.0...v0.2.0
136
+ [0.1.0]: https://github.com/rubenpazch/pg_multitenant_schemas/releases/tag/v0.1.0
@@ -0,0 +1,141 @@
1
+ # ๐Ÿงช Summary: How to Test GitHub Workflows Locally
2
+
3
+ ## โœ… What You Can Do Right Now
4
+
5
+ ### 1. **Pre-Push Script (Recommended)**## ๐Ÿ“ **Files Created**
6
+
7
+ - **`pre-push-check.sh`** - Main testing script
8
+ - **`validate-github-commands.sh`** - Test exact GitHub Actions commands
9
+ - **`TESTING_LOCALLY.md`** - Quick start guide
10
+ - **`docs/local_workflow_testing.md`** - Complete documentation
11
+ - **`.actrc`** - act configuration
12
+ - **`.env.local.example`** - Environment templateh
13
+ # Run this before every push
14
+ ./pre-push-check.sh
15
+ ```
16
+ This validates everything that runs in CI:
17
+ - โœ… RuboCop (code style)
18
+ - โœ… RSpec (tests)
19
+ - โœ… Bundle audit (security)
20
+ - โœ… Gem building
21
+ - โœ… Integration tests (if PostgreSQL available)
22
+
23
+ ### 2. **Manual Component Testing**
24
+ ```bash
25
+ ```bash
26
+ # Test each CI component individually
27
+ bundle install
28
+ bundle exec rubocop # Code style check
29
+ bundle exec rspec # Run all tests
30
+ bundle exec rspec --tag integration # Integration tests only
31
+ bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb' # Unit tests only
32
+ bundle audit # Security audit
33
+ gem build pg_multitenant_schemas.gemspec # Test gem build
34
+ ```
35
+ ```
36
+
37
+ ### 3. **act Tool (Partial Support)**
38
+ ```bash
39
+ # List workflows
40
+ act -l
41
+
42
+ # Dry run (shows what would execute)
43
+ act -n push
44
+
45
+ # Note: Currently has issues with PostgreSQL services
46
+ # Better for simple workflows without database dependencies
47
+ ```
48
+
49
+ ## ๐ŸŽฏ **Before Every Push Checklist**
50
+
51
+ 1. โœ… Run `./pre-push-check.sh`
52
+ 2. โœ… Fix any issues found
53
+ 3. โœ… Commit your changes
54
+ 4. โœ… Push to GitHub
55
+
56
+ ## ๐Ÿ“‹ **Component Status**
57
+
58
+ | Component | Local Testing | Status |
59
+ |-----------|---------------|---------|
60
+ | RuboCop | โœ… `bundle exec rubocop` | Working |
61
+ | Unit Tests | โœ… `bundle exec rspec` | Working |
62
+ | Integration Tests | โœ… With local PostgreSQL | Working |
63
+ | Security Audit | โœ… `bundle audit` | Working |
64
+ | Gem Building | โœ… `gem build *.gemspec` | Working |
65
+ | Release Workflow | โš ๏ธ Manual simulation only | Partial |
66
+ | Full CI with act | โš ๏ธ PostgreSQL service issues | Limited |
67
+
68
+ ## ๐Ÿ”ง **Quick Setup**
69
+
70
+ 1. **Make pre-push script executable:**
71
+ ```bash
72
+ chmod +x pre-push-check.sh
73
+ ```
74
+
75
+ 2. **Install act (optional):**
76
+ ```bash
77
+ brew install act
78
+ ```
79
+
80
+ 3. **Create environment file (for act):**
81
+ ```bash
82
+ cp .env.local.example .env.local
83
+ # Edit .env.local with your tokens if needed
84
+ ```
85
+
86
+ ## ๐Ÿš€ **Recommended Workflow**
87
+
88
+ ```bash
89
+ # 1. Make your changes
90
+ git add .
91
+
92
+ # 2. Test locally
93
+ ./pre-push-check.sh
94
+
95
+ # 3. If all passes, commit and push
96
+ git commit -m "Your changes"
97
+ git push
98
+ ```
99
+
100
+ ## ๐Ÿ› ๏ธ **Troubleshooting**
101
+
102
+ ### PostgreSQL Issues
103
+ ```bash
104
+ # Check if PostgreSQL is running
105
+ pg_isready
106
+
107
+ # Start PostgreSQL (macOS)
108
+ brew services start postgresql@15
109
+
110
+ # Create test database
111
+ createdb pg_multitenant_test
112
+ ```
113
+
114
+ ### Ruby Issues
115
+ ```bash
116
+ # Install correct Ruby version
117
+ rbenv install 3.3.0
118
+ rbenv local 3.3.0
119
+ bundle install
120
+ ```
121
+
122
+ ### act Issues
123
+ ```bash
124
+ # Try without services (simpler)
125
+ act -j security # Just run security audit job
126
+
127
+ # Check Docker is running
128
+ docker ps
129
+ ```
130
+
131
+ ## ๐Ÿ“š **Files Created**
132
+
133
+ - **`pre-push-check.sh`** - Main testing script
134
+ - **`TESTING_LOCALLY.md`** - Quick start guide
135
+ - **`docs/local_workflow_testing.md`** - Complete documentation
136
+ - **`.actrc`** - act configuration
137
+ - **`.env.local.example`** - Environment template
138
+
139
+ ---
140
+
141
+ **๐Ÿ’ก Bottom Line**: Use `./pre-push-check.sh` for reliable local testing. It covers 95% of what CI does and catches issues early!
@@ -0,0 +1,208 @@
1
+ # ๐Ÿš€ Quick Start: Testing GitHub Workflows Locally
2
+
3
+ This guide gets you up and running quickly with local GitHub Actions testing.
4
+
5
+ ## ๐ŸŽฏ TL;DR - Quick Commands
6
+
7
+ ```bash
8
+ # 1. Run pre-push checks (recommended before every push)
9
+ ./pre-push-check.sh
10
+
11
+ # 2. Test GitHub Actions locally with act
12
+ act -l # List all workflows
13
+ act push # Test CI workflow
14
+ act pull_request # Test PR workflow
15
+
16
+ # 3. Manual component testing
17
+ bundle exec rubocop # Code style check
18
+ bundle exec rspec # Run tests
19
+ gem build *.gemspec # Test gem building
20
+ ```
21
+
22
+ ## ๐Ÿ”ง One-Time Setup
23
+
24
+ ### 1. Install act (if not already installed)
25
+
26
+ ```bash
27
+ # macOS
28
+ brew install act
29
+
30
+ # Linux
31
+ curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
32
+
33
+ # Windows
34
+ choco install act-cli
35
+ ```
36
+
37
+ ### 2. Create local environment file
38
+
39
+ ```bash
40
+ # Copy the example and fill in your values
41
+ cp .env.local.example .env.local
42
+
43
+ # Edit with your actual tokens (optional, only needed for release testing)
44
+ nano .env.local
45
+ ```
46
+
47
+ ## ๐Ÿงช Testing Strategies
48
+
49
+ ### Strategy 1: Pre-Push Script (Recommended)
50
+
51
+ Run this before every push:
52
+
53
+ ```bash
54
+ ./pre-push-check.sh
55
+ ```
56
+
57
+ This runs:
58
+ - โœ… RuboCop (code style)
59
+ - โœ… RSpec (unit tests)
60
+ - โœ… Security audit
61
+ - โœ… Gem build test
62
+ - โœ… Integration tests (if PostgreSQL available)
63
+
64
+ ### Strategy 2: act - GitHub Actions Locally
65
+
66
+ ```bash
67
+ # Test the main CI workflow
68
+ act push
69
+
70
+ # Test pull request workflow
71
+ act pull_request
72
+
73
+ # Dry run (see what would execute)
74
+ act -n
75
+
76
+ # Test specific job
77
+ act -j test
78
+
79
+ # List all available workflows and jobs
80
+ act -l
81
+ ```
82
+
83
+ ### Strategy 3: Manual Component Testing
84
+
85
+ ```bash
86
+ # Test each component individually
87
+ bundle install
88
+ bundle exec rubocop
89
+ bundle exec rspec
90
+ bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb' # Unit tests only
91
+ bundle exec rspec --tag integration # Integration tests only
92
+ bundle audit
93
+ gem build pg_multitenant_schemas.gemspec
94
+ ```
95
+
96
+ ## ๐ŸŽฏ Workflow-Specific Testing
97
+
98
+ ### Testing CI Workflow (.github/workflows/main.yml)
99
+
100
+ ```bash
101
+ # With act
102
+ act push
103
+
104
+ # Manual simulation
105
+ bundle install
106
+ bundle exec rubocop
107
+ bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'
108
+ bundle audit
109
+ ```
110
+
111
+ ### Testing Release Workflow (.github/workflows/release.yml)
112
+
113
+ ```bash
114
+ # With act (simulates main branch push)
115
+ act push --env GITHUB_REF=refs/heads/main
116
+
117
+ # Manual simulation (WITHOUT publishing)
118
+ # 1. Update version in lib/pg_multitenant_schemas/version.rb
119
+ # 2. Build gem locally
120
+ gem build pg_multitenant_schemas.gemspec
121
+ # 3. Check gem contents
122
+ gem contents pg_multitenant_schemas-*.gem
123
+ ```
124
+
125
+ ## ๐Ÿ› Troubleshooting
126
+
127
+ ### act Issues
128
+
129
+ ```bash
130
+ # Docker not running
131
+ # โ†’ Start Docker Desktop
132
+
133
+ # Permission denied
134
+ # โ†’ Fix Docker permissions or use sudo
135
+
136
+ # Platform issues
137
+ act --container-architecture linux/amd64
138
+
139
+ # Secrets not found
140
+ # โ†’ Check .env.local file exists and has correct values
141
+ ```
142
+
143
+ ### PostgreSQL Issues
144
+
145
+ ```bash
146
+ # Check if PostgreSQL is running
147
+ pg_isready
148
+
149
+ # Start PostgreSQL (macOS)
150
+ brew services start postgresql@15
151
+
152
+ # Create test database
153
+ createdb pg_multitenant_test
154
+ ```
155
+
156
+ ### Ruby/Bundle Issues
157
+
158
+ ```bash
159
+ # Install correct Ruby version
160
+ rbenv install 3.3.0
161
+ rbenv local 3.3.0
162
+
163
+ # Clean and reinstall gems
164
+ bundle clean --force
165
+ bundle install
166
+ ```
167
+
168
+ ## ๐Ÿ”„ Typical Workflow
169
+
170
+ 1. **Make changes** to your code
171
+ 2. **Run pre-push checks**: `./pre-push-check.sh`
172
+ 3. **Fix any issues** found
173
+ 4. **Test with act** (optional): `act push`
174
+ 5. **Commit and push** when everything passes
175
+
176
+ ## ๐Ÿ“‹ Integration with Git
177
+
178
+ Add to `.git/hooks/pre-push` to run checks automatically:
179
+
180
+ ```bash
181
+ #!/bin/bash
182
+ ./pre-push-check.sh
183
+ ```
184
+
185
+ Make it executable:
186
+ ```bash
187
+ chmod +x .git/hooks/pre-push
188
+ ```
189
+
190
+ ## ๐ŸŽ‰ Success Indicators
191
+
192
+ You're ready to push when you see:
193
+
194
+ - โœ… Pre-push script passes all checks
195
+ - โœ… `act push` completes without errors
196
+ - โœ… All tests pass locally
197
+ - โœ… RuboCop shows no violations
198
+ - โœ… Gem builds successfully
199
+
200
+ ## ๐Ÿ”— More Information
201
+
202
+ - [Complete Guide](docs/local_workflow_testing.md) - Detailed documentation
203
+ - [GitHub Actions Docs](https://docs.github.com/en/actions)
204
+ - [act Documentation](https://github.com/nektos/act)
205
+
206
+ ---
207
+
208
+ **๐Ÿ’ก Pro Tip**: Run `./pre-push-check.sh` before every commit to catch issues early!
data/docs/README.md CHANGED
@@ -15,6 +15,8 @@ This directory contains detailed documentation for each core component of the PG
15
15
  | **Errors** | Custom exception classes | [errors.md](errors.md) |
16
16
  | **Testing** | RSpec test suite and testing guide | [testing.md](testing.md) |
17
17
  | **Integration Testing** | PostgreSQL integration testing guide | [integration_testing.md](integration_testing.md) |
18
+ | **CI/CD & Releases** | GitHub Actions automation setup | [github_actions_setup.md](github_actions_setup.md) |
19
+ | **Local Workflow Testing** | Test GitHub Actions locally before push | [local_workflow_testing.md](local_workflow_testing.md) |
18
20
 
19
21
  ## ๐Ÿ—๏ธ Architecture Flow
20
22
 
@@ -60,7 +62,9 @@ Rails Application (executes in tenant schema)
60
62
 
61
63
  - **[Testing Guide](testing.md)**: Comprehensive RSpec test suite documentation
62
64
  - **[Integration Testing](integration_testing.md)**: PostgreSQL integration testing guide
65
+ - **[Local Workflow Testing](local_workflow_testing.md)**: Test GitHub Actions locally before push
63
66
  - **Test Execution**: `bundle exec rspec` (unit tests) and `bundle exec rspec --tag integration` (integration tests)
67
+ - **Pre-Push Testing**: `./pre-push-check.sh` (validates CI components locally)
64
68
 
65
69
  ## ๐Ÿ” Debug and Troubleshooting
66
70
 
@@ -0,0 +1,136 @@
1
+ # ๐Ÿ”ง Fixing GitHub Actions Permissions Issues
2
+
3
+ ## ๐Ÿšจ Problem
4
+ ```
5
+ remote: Permission to rubenpazch/pg_multitenant_schemas.git denied to github-actions[bot].
6
+ fatal: unable to access 'https://github.com/rubenpazch/pg_multitenant_schemas/': The requested URL returned error: 403
7
+ ```
8
+
9
+ ## โœ… Solutions Applied
10
+
11
+ ### 1. Updated Release Workflow Permissions
12
+ Added explicit permissions to `.github/workflows/release.yml`:
13
+ ```yaml
14
+ permissions:
15
+ contents: write
16
+ issues: write
17
+ pull-requests: write
18
+ ```
19
+
20
+ ### 2. Fixed GitHub Actions Bot Identity
21
+ Changed Git configuration to use proper GitHub Actions bot identity:
22
+ ```yaml
23
+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
24
+ git config --local user.name "github-actions[bot]"
25
+ ```
26
+
27
+ ## ๐Ÿ”ง Repository Settings to Check
28
+
29
+ ### On GitHub.com:
30
+
31
+ 1. **Go to your repository settings**
32
+ - Navigate to: `https://github.com/rubenpazch/pg_multitenant_schemas/settings`
33
+
34
+ 2. **Actions > General**
35
+ - Scroll down to "Workflow permissions"
36
+ - Select: **"Read and write permissions"**
37
+ - Check: **"Allow GitHub Actions to create and approve pull requests"**
38
+ - Click **Save**
39
+
40
+ 3. **Actions > General > Actions permissions**
41
+ - Ensure: **"Allow all actions and reusable workflows"** is selected
42
+ - Or at least: **"Allow actions created by GitHub"**
43
+
44
+ ## ๐Ÿงช Alternative Testing Approach
45
+
46
+ If you want to test the release workflow without actual releases:
47
+
48
+ ### Create a Test Branch Release Workflow
49
+
50
+ ```yaml
51
+ # .github/workflows/test-release.yml
52
+ name: Test Release Workflow
53
+
54
+ on:
55
+ workflow_dispatch: # Manual trigger only
56
+
57
+ permissions:
58
+ contents: write
59
+ issues: write
60
+ pull-requests: write
61
+
62
+ jobs:
63
+ test-release:
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - name: Checkout code
68
+ uses: actions/checkout@v4
69
+ with:
70
+ fetch-depth: 0
71
+ token: ${{ secrets.GITHUB_TOKEN }}
72
+
73
+ - name: Test Git config
74
+ run: |
75
+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
76
+ git config --local user.name "github-actions[bot]"
77
+ echo "Git config successful"
78
+
79
+ - name: Test Git operations (dry run)
80
+ run: |
81
+ echo "Would create tag: v0.2.1"
82
+ echo "Would push to origin"
83
+ # Don't actually push in test
84
+
85
+ - name: Test gem build
86
+ run: |
87
+ gem build pg_multitenant_schemas.gemspec
88
+ ls -la *.gem
89
+ ```
90
+
91
+ ## ๐Ÿ” Troubleshooting Steps
92
+
93
+ ### 1. Check Token Permissions
94
+ ```bash
95
+ # In GitHub Actions, this should show the permissions
96
+ echo "GITHUB_TOKEN permissions:"
97
+ echo "Contents: ${{ github.token }}"
98
+ ```
99
+
100
+ ### 2. Verify Repository Access
101
+ ```bash
102
+ # Test if the bot can access the repo
103
+ git ls-remote origin
104
+ ```
105
+
106
+ ### 3. Check Branch Protection Rules
107
+ - Go to Settings > Branches
108
+ - Check if `main` branch has protection rules that block force pushes
109
+ - Ensure "Restrict pushes that create files" is not enabled
110
+
111
+ ## ๐ŸŽฏ Quick Fix Summary
112
+
113
+ 1. **โœ… Updated workflow permissions** (already done)
114
+ 2. **โœ… Fixed bot identity** (already done)
115
+ 3. **๐Ÿ”ง Check repository settings** (manual step on GitHub.com)
116
+ 4. **๐Ÿงช Test with manual trigger** (if needed)
117
+
118
+ ## ๐Ÿ“‹ Manual Steps Required
119
+
120
+ 1. Go to your repository on GitHub.com
121
+ 2. Navigate to Settings > Actions > General
122
+ 3. Set "Workflow permissions" to "Read and write permissions"
123
+ 4. Enable "Allow GitHub Actions to create and approve pull requests"
124
+ 5. Save the settings
125
+
126
+ After making these changes, the release workflow should work properly!
127
+
128
+ ## ๐Ÿš€ Testing the Fix
129
+
130
+ After updating repository settings, you can test by:
131
+
132
+ 1. **Making a small version bump**
133
+ 2. **Pushing to main branch**
134
+ 3. **Watching the Actions tab** for successful execution
135
+
136
+ Or create the test workflow above and trigger it manually first.
@@ -0,0 +1,181 @@
1
+ # GitHub Actions Setup Guide
2
+
3
+ This document explains how to set up GitHub Actions for automated testing and releases.
4
+
5
+ ## Overview
6
+
7
+ The repository uses two main workflows:
8
+
9
+ 1. **CI Workflow** (`.github/workflows/main.yml`) - Runs tests on every push and PR
10
+ 2. **Release Workflow** (`.github/workflows/release.yml`) - Automatically releases to RubyGems when version changes
11
+
12
+ ## Setting Up RubyGems API Key
13
+
14
+ To enable automatic releases to RubyGems, you need to set up a GitHub secret with your RubyGems API key.
15
+
16
+ ### Step 1: Get Your RubyGems API Key
17
+
18
+ 1. Go to [RubyGems.org](https://rubygems.org/)
19
+ 2. Sign in to your account
20
+ 3. Go to your profile settings
21
+ 4. Navigate to "API Keys" section
22
+ 5. Create a new API key or use an existing one
23
+ 6. Copy the API key (it should start with `rubygems_`)
24
+
25
+ ### Step 2: Add GitHub Secret
26
+
27
+ 1. Go to your GitHub repository
28
+ 2. Click on "Settings" tab
29
+ 3. In the left sidebar, click "Secrets and variables" โ†’ "Actions"
30
+ 4. Click "New repository secret"
31
+ 5. Name: `RUBYGEMS_API_KEY`
32
+ 6. Value: Paste your RubyGems API key
33
+ 7. Click "Add secret"
34
+
35
+ ### 3. Configure Repository Permissions
36
+
37
+ **Important:** Configure GitHub Actions permissions to allow the release workflow to create tags and releases:
38
+
39
+ 1. Go to your repository Settings
40
+ 2. Navigate to **Actions > General**
41
+ 3. Under "Workflow permissions":
42
+ - Select **"Read and write permissions"**
43
+ - Check **"Allow GitHub Actions to create and approve pull requests"**
44
+ 4. Click **Save**
45
+
46
+ Without these permissions, you'll get errors like:
47
+ ```
48
+ remote: Permission to username/repo.git denied to github-actions[bot].
49
+ fatal: unable to access 'https://github.com/username/repo/': The requested URL returned error: 403
50
+ ```
51
+
52
+ ## How the Workflows Work
53
+
54
+ ### CI Workflow
55
+
56
+ **Triggers:**
57
+ - Every push to `main` branch
58
+ - Every pull request to `main` branch
59
+
60
+ **What it does:**
61
+ - Tests on Ruby 3.2, 3.3, and 3.4
62
+ - Runs RuboCop for code quality
63
+ - Runs unit tests (excluding integration tests)
64
+ - Runs integration tests (with PostgreSQL database)
65
+ - Runs security audit with bundle-audit
66
+
67
+ ### Release Workflow
68
+
69
+ **Triggers:**
70
+ - Push to `main` branch that changes `lib/pg_multitenant_schemas/version.rb`
71
+
72
+ **What it does:**
73
+ - Checks if the version in `version.rb` has changed
74
+ - If version changed:
75
+ 1. Builds the gem
76
+ 2. Creates a Git tag (e.g., `v0.2.1`)
77
+ 3. Creates a GitHub release with changelog notes
78
+ 4. Publishes the gem to RubyGems
79
+
80
+ ## Release Process
81
+
82
+ To release a new version:
83
+
84
+ 1. **Update the version** in `lib/pg_multitenant_schemas/version.rb`:
85
+ ```ruby
86
+ module PgMultitenantSchemas
87
+ VERSION = "0.2.1" # Increment this
88
+ end
89
+ ```
90
+
91
+ 2. **Update the changelog** in `CHANGELOG.md`:
92
+ ```markdown
93
+ ## [0.2.1] - 2025-09-07
94
+
95
+ ### Added
96
+ - New feature description
97
+
98
+ ### Fixed
99
+ - Bug fix description
100
+ ```
101
+
102
+ 3. **Commit and push** to main branch:
103
+ ```bash
104
+ git add lib/pg_multitenant_schemas/version.rb CHANGELOG.md
105
+ git commit -m "Bump version to 0.2.1"
106
+ git push origin main
107
+ ```
108
+
109
+ 4. **Automatic release** will trigger:
110
+ - GitHub Actions will detect the version change
111
+ - Create a Git tag and GitHub release
112
+ - Publish to RubyGems automatically
113
+
114
+ ## Manual Release (Alternative)
115
+
116
+ If you prefer manual releases or need to troubleshoot:
117
+
118
+ ```bash
119
+ # Build the gem
120
+ gem build pg_multitenant_schemas.gemspec
121
+
122
+ # Push to RubyGems (requires authentication)
123
+ gem push pg_multitenant_schemas-0.2.1.gem
124
+
125
+ # Create Git tag
126
+ git tag v0.2.1
127
+ git push origin v0.2.1
128
+ ```
129
+
130
+ ## Workflow Status
131
+
132
+ You can monitor workflow runs:
133
+
134
+ 1. Go to your GitHub repository
135
+ 2. Click the "Actions" tab
136
+ 3. View running and completed workflows
137
+ 4. Click on individual runs to see detailed logs
138
+
139
+ ## Security Considerations
140
+
141
+ - **API Keys**: Never commit API keys to the repository
142
+ - **Secrets**: Use GitHub Secrets for sensitive information
143
+ - **Permissions**: The `GITHUB_TOKEN` has limited permissions for creating releases
144
+ - **Audit**: The security workflow checks for vulnerable dependencies
145
+
146
+ ## Troubleshooting
147
+
148
+ ### Common Issues
149
+
150
+ 1. **RubyGems authentication failed**
151
+ - Check that `RUBYGEMS_API_KEY` secret is set correctly
152
+ - Ensure the API key has publishing permissions
153
+
154
+ 2. **Git tag already exists**
155
+ - The workflow checks for existing tags
156
+ - If tag exists, release is skipped
157
+
158
+ 3. **Tests failing**
159
+ - CI must pass before release workflow runs
160
+ - Check test logs in the Actions tab
161
+
162
+ 4. **PostgreSQL connection issues**
163
+ - Integration tests require PostgreSQL service
164
+ - Check service configuration in workflow
165
+
166
+ ### Debug Steps
167
+
168
+ 1. Check workflow logs in GitHub Actions
169
+ 2. Verify secrets are set correctly
170
+ 3. Test locally with same Ruby versions
171
+ 4. Check RubyGems.org for published gems
172
+
173
+ ## Best Practices
174
+
175
+ 1. **Version Bumping**: Use semantic versioning (MAJOR.MINOR.PATCH)
176
+ 2. **Changelog**: Always update changelog before releasing
177
+ 3. **Testing**: Ensure all tests pass locally before pushing
178
+ 4. **Security**: Regularly update dependencies and run security audits
179
+ 5. **Documentation**: Update documentation for breaking changes
180
+
181
+ This automated setup ensures consistent, reliable releases while maintaining code quality through comprehensive testing.
@@ -0,0 +1,314 @@
1
+ # Testing GitHub Workflows Locally
2
+
3
+ This guide shows you how to test GitHub Actions workflows locally before pushing to GitHub.
4
+
5
+ ## ๐Ÿš€ Method 1: Using `act` (Recommended)
6
+
7
+ `act` is the most popular tool for running GitHub Actions locally using Docker.
8
+
9
+ ### Installation
10
+
11
+ ```bash
12
+ # macOS (using Homebrew)
13
+ brew install act
14
+
15
+ # Linux (using curl)
16
+ curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
17
+
18
+ # Windows (using Chocolatey)
19
+ choco install act-cli
20
+ ```
21
+
22
+ ### Basic Usage
23
+
24
+ ```bash
25
+ # List all workflows
26
+ act -l
27
+
28
+ # Run all workflows
29
+ act
30
+
31
+ # Run specific workflow
32
+ act push
33
+
34
+ # Run specific job
35
+ act -j test
36
+
37
+ # Run with specific event
38
+ act pull_request
39
+
40
+ # Dry run (show what would be executed)
41
+ act -n
42
+ ```
43
+
44
+ ### Testing Our Workflows
45
+
46
+ ```bash
47
+ # Test the main CI workflow
48
+ act push
49
+
50
+ # Test the release workflow (simulates a push to main)
51
+ act push --env GITHUB_REF=refs/heads/main
52
+
53
+ # Test pull request workflow
54
+ act pull_request
55
+ ```
56
+
57
+ ### Configuration
58
+
59
+ Create `.actrc` file in project root for default settings:
60
+
61
+ ```bash
62
+ # .actrc
63
+ --container-architecture linux/amd64
64
+ --artifact-server-path /tmp/act-artifacts
65
+ --env-file .env.local
66
+ ```
67
+
68
+ ### Environment Variables
69
+
70
+ Create `.env.local` for local testing:
71
+
72
+ ```bash
73
+ # .env.local
74
+ GITHUB_TOKEN=your_github_token_here
75
+ RUBYGEMS_API_KEY=your_rubygems_key_here
76
+ GITHUB_REPOSITORY=rubenpazch/pg_multitenant_schemas
77
+ GITHUB_ACTOR=your_username
78
+ ```
79
+
80
+ ## ๐Ÿ”ง Method 2: Manual Testing Components
81
+
82
+ ### Test RuboCop Locally
83
+
84
+ ```bash
85
+ # Run RuboCop (same as in CI)
86
+ bundle exec rubocop
87
+
88
+ # Auto-fix issues
89
+ bundle exec rubocop -A
90
+
91
+ # Check specific files
92
+ bundle exec rubocop lib/ spec/
93
+ ```
94
+
95
+ ### Test RSpec Locally
96
+
97
+ ```bash
98
+ # Run all tests
99
+ bundle exec rspec
100
+
101
+ # Run with coverage (if configured)
102
+ COVERAGE=true bundle exec rspec
103
+
104
+ # Run integration tests
105
+ bundle exec rspec --tag integration
106
+
107
+ # Run tests with different Ruby versions (using rbenv/rvm)
108
+ rbenv shell 3.2.0 && bundle exec rspec
109
+ rbenv shell 3.3.0 && bundle exec rspec
110
+ ```
111
+
112
+ ### Test Gem Building
113
+
114
+ ```bash
115
+ # Build gem locally
116
+ gem build pg_multitenant_schemas.gemspec
117
+
118
+ # Install locally built gem
119
+ gem install pg_multitenant_schemas-*.gem
120
+
121
+ # Test gem installation
122
+ gem list | grep pg_multitenant_schemas
123
+ ```
124
+
125
+ ### Test PostgreSQL Setup
126
+
127
+ ```bash
128
+ # Start PostgreSQL (macOS with Homebrew)
129
+ brew services start postgresql@15
130
+
131
+ # Create test database
132
+ createdb pg_multitenant_test
133
+
134
+ # Run integration tests
135
+ PGDATABASE=pg_multitenant_test bundle exec rspec --tag integration
136
+ ```
137
+
138
+ ## ๐Ÿณ Method 3: Docker-based Testing
139
+
140
+ Create a local testing environment that mirrors CI:
141
+
142
+ ```bash
143
+ # Create Dockerfile.test
144
+ cat > Dockerfile.test << 'EOF'
145
+ FROM ruby:3.3
146
+
147
+ # Install PostgreSQL client
148
+ RUN apt-get update && apt-get install -y postgresql-client
149
+
150
+ # Set working directory
151
+ WORKDIR /app
152
+
153
+ # Copy Gemfile
154
+ COPY Gemfile* ./
155
+ RUN bundle install
156
+
157
+ # Copy source code
158
+ COPY . .
159
+
160
+ # Run tests
161
+ CMD ["bundle", "exec", "rspec"]
162
+ EOF
163
+
164
+ # Build and run
165
+ docker build -f Dockerfile.test -t pg_multitenant_test .
166
+ docker run --rm pg_multitenant_test
167
+ ```
168
+
169
+ ## ๐Ÿ” Method 4: GitHub CLI for Remote Testing
170
+
171
+ Use GitHub CLI to trigger workflows manually:
172
+
173
+ ```bash
174
+ # Install GitHub CLI
175
+ brew install gh
176
+
177
+ # Authenticate
178
+ gh auth login
179
+
180
+ # Trigger workflow manually
181
+ gh workflow run main.yml
182
+
183
+ # Check workflow status
184
+ gh run list
185
+
186
+ # View workflow logs
187
+ gh run view --log
188
+ ```
189
+
190
+ ## ๐Ÿ“‹ Pre-Push Checklist
191
+
192
+ Before pushing to GitHub, run these commands locally:
193
+
194
+ ```bash
195
+ #!/bin/bash
196
+ # pre-push-check.sh
197
+
198
+ echo "๐Ÿ” Running pre-push checks..."
199
+
200
+ # 1. RuboCop
201
+ echo "Running RuboCop..."
202
+ bundle exec rubocop || exit 1
203
+
204
+ # 2. RSpec
205
+ echo "Running RSpec..."
206
+ bundle exec rspec || exit 1
207
+
208
+ # 3. Security audit
209
+ echo "Running security audit..."
210
+ bundle audit || exit 1
211
+
212
+ # 4. Gem build test
213
+ echo "Testing gem build..."
214
+ gem build pg_multitenant_schemas.gemspec || exit 1
215
+
216
+ # 5. Integration tests (if PostgreSQL available)
217
+ if command -v psql &> /dev/null; then
218
+ echo "Running integration tests..."
219
+ bundle exec rspec --tag integration || exit 1
220
+ fi
221
+
222
+ echo "โœ… All checks passed! Ready to push."
223
+ ```
224
+
225
+ Make it executable:
226
+
227
+ ```bash
228
+ chmod +x pre-push-check.sh
229
+ ./pre-push-check.sh
230
+ ```
231
+
232
+ ## ๐ŸŽฏ Specific Workflow Testing
233
+
234
+ ### Testing CI Workflow (main.yml)
235
+
236
+ ```bash
237
+ # Using act
238
+ act push -W .github/workflows/main.yml
239
+
240
+ ```bash
241
+ # Manual simulation
242
+ bundle install
243
+ bundle exec rubocop
244
+ bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'
245
+ bundle audit
246
+ ```
247
+ ```
248
+
249
+ ### Testing Release Workflow (release.yml)
250
+
251
+ ```bash
252
+ # Simulate version bump
253
+ # 1. Update version in lib/pg_multitenant_schemas/version.rb
254
+ # 2. Test locally
255
+ act push -W .github/workflows/release.yml --env GITHUB_REF=refs/heads/main
256
+
257
+ # Manual simulation (without actual publishing)
258
+ gem build pg_multitenant_schemas.gemspec
259
+ # Note: Don't run 'gem push' in testing
260
+ ```
261
+
262
+ ## ๐Ÿ› ๏ธ Troubleshooting
263
+
264
+ ### Common Issues with `act`
265
+
266
+ 1. **Docker not running**: Start Docker Desktop
267
+ 2. **Permission issues**: Run with `sudo` or fix Docker permissions
268
+ 3. **Platform issues**: Use `--container-architecture linux/amd64`
269
+ 4. **Secret errors**: Provide secrets via `.env.local` file
270
+
271
+ ### PostgreSQL Issues
272
+
273
+ ```bash
274
+ # Check if PostgreSQL is running
275
+ pg_isready
276
+
277
+ # Start PostgreSQL service
278
+ brew services start postgresql@15
279
+
280
+ # Create test database
281
+ createdb pg_multitenant_test
282
+ ```
283
+
284
+ ### Ruby Version Issues
285
+
286
+ ```bash
287
+ # Install required Ruby versions
288
+ rbenv install 3.2.0
289
+ rbenv install 3.3.0
290
+ rbenv install 3.4.0
291
+
292
+ # Test with specific version
293
+ rbenv shell 3.3.0
294
+ bundle install
295
+ bundle exec rspec
296
+ ```
297
+
298
+ ## ๐Ÿ“š Additional Resources
299
+
300
+ - [act Documentation](https://github.com/nektos/act)
301
+ - [GitHub Actions Documentation](https://docs.github.com/en/actions)
302
+ - [Local Development Best Practices](https://docs.github.com/en/actions/using-workflows/about-workflows#best-practices)
303
+
304
+ ## ๐Ÿ”— Integration with Git Hooks
305
+
306
+ Add to `.git/hooks/pre-push`:
307
+
308
+ ```bash
309
+ #!/bin/bash
310
+ ./pre-push-check.sh
311
+ exit $?
312
+ ```
313
+
314
+ This ensures checks run automatically before every push.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgMultitenantSchemas
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
data/pre-push-check.sh ADDED
@@ -0,0 +1,95 @@
1
+ #!/bin/bash
2
+ # Pre-push check script for pg_multitenant_schemas gem
3
+ # Run this before pushing to GitHub to catch issues early
4
+
5
+ set -e # Exit on any error
6
+
7
+ echo "๐Ÿ” Running pre-push checks for pg_multitenant_schemas..."
8
+ echo ""
9
+
10
+ # Color codes for output
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ NC='\033[0m' # No Color
15
+
16
+ # Function to print colored output
17
+ print_status() {
18
+ echo -e "${2}${1}${NC}"
19
+ }
20
+
21
+ # Function to run a check
22
+ run_check() {
23
+ local name="$1"
24
+ local command="$2"
25
+ local optional="$3"
26
+
27
+ echo "๐Ÿ“‹ $name..."
28
+ if eval "$command"; then
29
+ print_status "โœ… $name passed" "$GREEN"
30
+ else
31
+ if [ "$optional" = "true" ]; then
32
+ print_status "โš ๏ธ $name failed (optional)" "$YELLOW"
33
+ else
34
+ print_status "โŒ $name failed" "$RED"
35
+ exit 1
36
+ fi
37
+ fi
38
+ echo ""
39
+ }
40
+
41
+ # 1. Check if we're in the right directory
42
+ if [ ! -f "pg_multitenant_schemas.gemspec" ]; then
43
+ print_status "โŒ Not in pg_multitenant_schemas directory" "$RED"
44
+ exit 1
45
+ fi
46
+
47
+ # 2. Install dependencies
48
+ run_check "Bundle install" "bundle install --quiet"
49
+
50
+ # 3. RuboCop
51
+ run_check "RuboCop (code style)" "bundle exec rubocop"
52
+
53
+ # 4. RSpec unit tests
54
+ run_check "RSpec unit tests" "bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'"
55
+
56
+ # 5. Security audit
57
+ run_check "Security audit" "bundle audit" "true"
58
+
59
+ # 6. Gem build test
60
+ run_check "Gem build test" "gem build pg_multitenant_schemas.gemspec > /dev/null 2>&1 && rm -f pg_multitenant_schemas-*.gem"
61
+
62
+ # 7. Check for PostgreSQL and run integration tests
63
+ if command -v psql &> /dev/null && pg_isready &> /dev/null; then
64
+ # Check if test database exists, create if not
65
+ if ! psql -lqt | cut -d \| -f 1 | grep -qw pg_multitenant_test; then
66
+ echo "๐Ÿ“‹ Creating test database..."
67
+ createdb pg_multitenant_test || true
68
+ fi
69
+
70
+ run_check "Integration tests" "PGDATABASE=pg_multitenant_test bundle exec rspec --tag integration" "true"
71
+ else
72
+ print_status "โš ๏ธ PostgreSQL not available, skipping integration tests" "$YELLOW"
73
+ fi
74
+
75
+ # 8. Check for uncommitted changes
76
+ if [ -n "$(git status --porcelain)" ]; then
77
+ print_status "โš ๏ธ You have uncommitted changes" "$YELLOW"
78
+ git status --short
79
+ echo ""
80
+ fi
81
+
82
+ # 9. Check current branch
83
+ current_branch=$(git branch --show-current)
84
+ if [ "$current_branch" = "main" ]; then
85
+ print_status "โš ๏ธ You're on the main branch" "$YELLOW"
86
+ fi
87
+
88
+ echo "๐ŸŽ‰ All checks completed successfully!"
89
+ echo ""
90
+ echo "๐Ÿš€ Your code is ready to push to GitHub!"
91
+ echo ""
92
+ echo "๐Ÿ’ก Pro tip: You can test GitHub Actions locally using 'act':"
93
+ echo " brew install act"
94
+ echo " act push # Test CI workflow"
95
+ echo ""
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+ # Test GitHub Actions permissions and setup locally
3
+
4
+ echo "๐Ÿ” Testing GitHub Actions setup and permissions..."
5
+ echo ""
6
+
7
+ # Check if we're in a Git repository
8
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
9
+ echo "โŒ Not in a Git repository"
10
+ exit 1
11
+ fi
12
+
13
+ # Check if we're on the right branch
14
+ current_branch=$(git branch --show-current)
15
+ echo "๐Ÿ“‹ Current branch: $current_branch"
16
+
17
+ # Check if we have the workflow files
18
+ if [ -f ".github/workflows/main.yml" ]; then
19
+ echo "โœ… CI workflow file exists"
20
+ else
21
+ echo "โŒ CI workflow file missing"
22
+ fi
23
+
24
+ if [ -f ".github/workflows/release.yml" ]; then
25
+ echo "โœ… Release workflow file exists"
26
+ else
27
+ echo "โŒ Release workflow file missing"
28
+ fi
29
+
30
+ # Check version file
31
+ if [ -f "lib/pg_multitenant_schemas/version.rb" ]; then
32
+ version=$(grep -E "VERSION = ['\"]" lib/pg_multitenant_schemas/version.rb | cut -d'"' -f2 | cut -d"'" -f2)
33
+ echo "โœ… Version file exists: $version"
34
+ else
35
+ echo "โŒ Version file missing"
36
+ fi
37
+
38
+ # Check if gemspec exists
39
+ if [ -f "pg_multitenant_schemas.gemspec" ]; then
40
+ echo "โœ… Gemspec file exists"
41
+ else
42
+ echo "โŒ Gemspec file missing"
43
+ fi
44
+
45
+ # Check remote origin
46
+ remote_url=$(git remote get-url origin 2>/dev/null || echo "No remote")
47
+ echo "๐Ÿ“‹ Remote origin: $remote_url"
48
+
49
+ # Test Git config (what GitHub Actions would use)
50
+ echo ""
51
+ echo "๐Ÿงช Testing Git configuration..."
52
+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
53
+ git config --local user.name "github-actions[bot]"
54
+ echo "โœ… Git config set for GitHub Actions bot"
55
+
56
+ # Test gem build
57
+ echo ""
58
+ echo "๐Ÿงช Testing gem build..."
59
+ if gem build pg_multitenant_schemas.gemspec > /dev/null 2>&1; then
60
+ echo "โœ… Gem builds successfully"
61
+ rm -f pg_multitenant_schemas-*.gem
62
+ else
63
+ echo "โŒ Gem build failed"
64
+ fi
65
+
66
+ # Check for uncommitted changes
67
+ if [ -n "$(git status --porcelain)" ]; then
68
+ echo ""
69
+ echo "โš ๏ธ You have uncommitted changes:"
70
+ git status --short
71
+ fi
72
+
73
+ echo ""
74
+ echo "๐ŸŽฏ Next Steps:"
75
+ echo "1. Ensure repository has proper permissions set in GitHub:"
76
+ echo " - Go to Settings > Actions > General"
77
+ echo " - Set 'Workflow permissions' to 'Read and write permissions'"
78
+ echo " - Enable 'Allow GitHub Actions to create and approve pull requests'"
79
+ echo ""
80
+ echo "2. To trigger a release:"
81
+ echo " - Update version in lib/pg_multitenant_schemas/version.rb"
82
+ echo " - Commit and push to main branch"
83
+ echo " - GitHub Actions will automatically create a release"
84
+ echo ""
85
+ echo "๐Ÿ“š For more details, see: docs/github_actions_setup.md"
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+ # Validate GitHub workflow commands locally
3
+ # This script tests the exact commands used in GitHub Actions
4
+
5
+ set -e
6
+
7
+ echo "๐Ÿงช Testing GitHub Actions commands locally..."
8
+ echo ""
9
+
10
+ # Test RuboCop (exact command from workflow)
11
+ echo "๐Ÿ“‹ Testing: bundle exec rubocop"
12
+ if bundle exec rubocop > /dev/null 2>&1; then
13
+ echo "โœ… RuboCop passed"
14
+ else
15
+ echo "โŒ RuboCop failed"
16
+ exit 1
17
+ fi
18
+
19
+ # Test unit tests (exact command from workflow)
20
+ echo "๐Ÿ“‹ Testing: bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb'"
21
+ if bundle exec rspec --exclude-pattern '**/integration/**/*_spec.rb' > /dev/null 2>&1; then
22
+ echo "โœ… Unit tests passed"
23
+ else
24
+ echo "โŒ Unit tests failed"
25
+ exit 1
26
+ fi
27
+
28
+ # Test integration tests (exact command from workflow)
29
+ echo "๐Ÿ“‹ Testing: bundle exec rspec --tag integration"
30
+ if bundle exec rspec --tag integration > /dev/null 2>&1; then
31
+ echo "โœ… Integration tests passed"
32
+ else
33
+ echo "โš ๏ธ Integration tests failed (may need PostgreSQL setup)"
34
+ fi
35
+
36
+ # Test security audit (exact command from workflow)
37
+ echo "๐Ÿ“‹ Testing: bundle audit"
38
+ if bundle audit > /dev/null 2>&1; then
39
+ echo "โœ… Security audit passed"
40
+ else
41
+ echo "โš ๏ธ Security audit failed (may have vulnerabilities)"
42
+ fi
43
+
44
+ echo ""
45
+ echo "๐ŸŽ‰ GitHub Actions command validation complete!"
46
+ echo ""
47
+ echo "๐Ÿ’ก These are the exact commands that run in GitHub Actions CI"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_multitenant_schemas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Paz
@@ -73,6 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".actrc"
77
+ - ".env.local.example"
76
78
  - ".rspec"
77
79
  - ".rubocop.yml"
78
80
  - ".rubocop_simple.yml"
@@ -80,13 +82,18 @@ files:
80
82
  - CHANGELOG.md
81
83
  - CODE_OF_CONDUCT.md
82
84
  - LICENSE.txt
85
+ - LOCAL_TESTING_SUMMARY.md
83
86
  - README.md
84
87
  - Rakefile
88
+ - TESTING_LOCALLY.md
85
89
  - docs/README.md
86
90
  - docs/configuration.md
87
91
  - docs/context.md
88
92
  - docs/errors.md
93
+ - docs/github_actions_permissions_fix.md
94
+ - docs/github_actions_setup.md
89
95
  - docs/integration_testing.md
96
+ - docs/local_workflow_testing.md
90
97
  - docs/migrator.md
91
98
  - docs/rails_integration.md
92
99
  - docs/schema_switcher.md
@@ -117,9 +124,12 @@ files:
117
124
  - lib/pg_multitenant_schemas/tenant_task_helpers.rb
118
125
  - lib/pg_multitenant_schemas/version.rb
119
126
  - pg_multitenant_schemas.gemspec
127
+ - pre-push-check.sh
120
128
  - rails_integration/app/controllers/application_controller.rb
121
129
  - rails_integration/app/models/tenant.rb
122
130
  - sig/pg_multitenant_schemas.rbs
131
+ - test-github-setup.sh
132
+ - validate-github-commands.sh
123
133
  homepage: https://github.com/rubenpazch/pg_multitenant_schemas
124
134
  licenses:
125
135
  - MIT