|
| 1 | +# Release Workflow Testing Guide |
| 2 | + |
| 3 | +This document explains how to test the release workflow without actually creating releases. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The release workflow has been improved with better error handling and more reliable triggering. To test these changes safely, we've created multiple testing approaches. |
| 8 | + |
| 9 | +## Testing Approaches |
| 10 | + |
| 11 | +### 1. Local Testing (Recommended) |
| 12 | + |
| 13 | +Run the local test script to verify all components work correctly: |
| 14 | + |
| 15 | +```bash |
| 16 | +./scripts/test-release.sh |
| 17 | +``` |
| 18 | + |
| 19 | +This script will: |
| 20 | +- ✅ Check Node.js and npm availability |
| 21 | +- ✅ Install dependencies |
| 22 | +- ✅ Run semantic-release dry-run |
| 23 | +- ✅ Test the version update script |
| 24 | +- ✅ Verify all required files exist |
| 25 | +- ✅ Validate semantic-release configuration |
| 26 | + |
| 27 | +### 2. GitHub Actions Testing |
| 28 | + |
| 29 | +The `release-test.yml` workflow will run automatically when: |
| 30 | +- CI completes on the `test-release-workflow` branch |
| 31 | +- Manual workflow dispatch is triggered |
| 32 | + |
| 33 | +This workflow: |
| 34 | +- ✅ Uses the same setup as the real release workflow |
| 35 | +- ✅ Runs semantic-release in dry-run mode |
| 36 | +- ✅ Tests the version update script |
| 37 | +- ✅ Validates configuration without creating releases |
| 38 | + |
| 39 | +### 3. Manual Testing |
| 40 | + |
| 41 | +To test specific components: |
| 42 | + |
| 43 | +```bash |
| 44 | +# Test semantic-release configuration |
| 45 | +npx semantic-release --dry-run |
| 46 | + |
| 47 | +# Test version update script |
| 48 | +./scripts/update-version.sh 9.9.9-test |
| 49 | +git checkout -- Sources/Helpers/Version.swift |
| 50 | + |
| 51 | +# Test workflow files exist |
| 52 | +ls -la .github/workflows/release.yml |
| 53 | +ls -la .releaserc.json |
| 54 | +ls -la package.json |
| 55 | +``` |
| 56 | + |
| 57 | +## What Was Changed |
| 58 | + |
| 59 | +### Release Workflow Improvements |
| 60 | + |
| 61 | +1. **Removed problematic conditional**: The `if: "!contains(github.event.head_commit.message, 'skip ci')"` condition was removed because `workflow_run` events don't have direct access to commit messages. |
| 62 | + |
| 63 | +2. **Added better error handling**: |
| 64 | + - Added `continue-on-error: false` |
| 65 | + - Added success check step |
| 66 | + - Added proper step IDs |
| 67 | + |
| 68 | +3. **Improved structure**: Better formatting and organization |
| 69 | + |
| 70 | +### New Testing Infrastructure |
| 71 | + |
| 72 | +1. **`release-test.yml`**: GitHub Actions workflow for testing |
| 73 | +2. **`test-release.sh`**: Local testing script |
| 74 | +3. **`RELEASE_TESTING.md`**: This documentation |
| 75 | + |
| 76 | +## Testing Workflow |
| 77 | + |
| 78 | +### Step 1: Local Testing |
| 79 | +```bash |
| 80 | +git checkout test-release-workflow |
| 81 | +./scripts/test-release.sh |
| 82 | +``` |
| 83 | + |
| 84 | +### Step 2: Push to GitHub |
| 85 | +```bash |
| 86 | +git push origin test-release-workflow |
| 87 | +``` |
| 88 | + |
| 89 | +### Step 3: Create Test PR |
| 90 | +1. Go to GitHub and create a PR from `test-release-workflow` to `main` |
| 91 | +2. Add conventional commit messages to trigger semantic-release analysis |
| 92 | +3. The `release-test.yml` workflow will run automatically |
| 93 | + |
| 94 | +### Step 4: Verify Results |
| 95 | +- Check the workflow logs in GitHub Actions |
| 96 | +- Verify no actual releases are created |
| 97 | +- Confirm all tests pass |
| 98 | + |
| 99 | +## Conventional Commit Examples |
| 100 | + |
| 101 | +To test semantic-release analysis, use these commit types: |
| 102 | + |
| 103 | +```bash |
| 104 | +# Minor version bump |
| 105 | +git commit -m "feat: add new feature" |
| 106 | + |
| 107 | +# Patch version bump |
| 108 | +git commit -m "fix: fix existing bug" |
| 109 | + |
| 110 | +# No version bump |
| 111 | +git commit -m "docs: update documentation" |
| 112 | +git commit -m "test: add test coverage" |
| 113 | +git commit -m "chore: update dependencies" |
| 114 | +``` |
| 115 | + |
| 116 | +## Safety Features |
| 117 | + |
| 118 | +- **Dry-run mode**: All semantic-release operations run in dry-run mode |
| 119 | +- **Test branch**: Workflow only runs on `test-release-workflow` branch |
| 120 | +- **No actual releases**: No GitHub releases or tags are created |
| 121 | +- **Reversible changes**: Version changes are reverted after testing |
| 122 | + |
| 123 | +## Troubleshooting |
| 124 | + |
| 125 | +### Common Issues |
| 126 | + |
| 127 | +1. **Node.js not found**: Install Node.js 20 or later |
| 128 | +2. **npm ci fails**: Delete `node_modules` and `package-lock.json`, then run `npm install` |
| 129 | +3. **Permission denied**: Make sure `scripts/test-release.sh` is executable (`chmod +x scripts/test-release.sh`) |
| 130 | + |
| 131 | +### Debug Commands |
| 132 | + |
| 133 | +```bash |
| 134 | +# Check Node.js version |
| 135 | +node --version |
| 136 | + |
| 137 | +# Check npm version |
| 138 | +npm --version |
| 139 | + |
| 140 | +# Check semantic-release version |
| 141 | +npx semantic-release --version |
| 142 | + |
| 143 | +# Test specific semantic-release plugins |
| 144 | +npx semantic-release --dry-run --debug |
| 145 | +``` |
| 146 | + |
| 147 | +## Next Steps |
| 148 | + |
| 149 | +Once testing is complete: |
| 150 | + |
| 151 | +1. ✅ Verify all tests pass |
| 152 | +2. ✅ Review workflow logs |
| 153 | +3. ✅ Create PR to main branch |
| 154 | +4. ✅ Merge changes |
| 155 | +5. ✅ Monitor first real release |
| 156 | + |
| 157 | +## Files Modified |
| 158 | + |
| 159 | +- `.github/workflows/release.yml` - Improved release workflow |
| 160 | +- `.github/workflows/release-test.yml` - New test workflow |
| 161 | +- `scripts/test-release.sh` - Local testing script |
| 162 | +- `RELEASE_TESTING.md` - This documentation |
0 commit comments