|
| 1 | +# Testing the Changeset System |
| 2 | + |
| 3 | +This document explains how to test the changeset system implementation. |
| 4 | + |
| 5 | +## Quick Test |
| 6 | + |
| 7 | +Run the automated test suite: |
| 8 | +```bash |
| 9 | +./test_changesets.py |
| 10 | +# or |
| 11 | +python3 test_changesets.py |
| 12 | +``` |
| 13 | + |
| 14 | +This will: |
| 15 | +1. Backup your current files |
| 16 | +2. Test all components of the changeset system |
| 17 | +3. Restore your files to their original state |
| 18 | +4. Show a summary of test results |
| 19 | + |
| 20 | +## Manual Testing |
| 21 | + |
| 22 | +### 1. Create a Changeset |
| 23 | + |
| 24 | +```bash |
| 25 | +# Interactive mode |
| 26 | +./changeset |
| 27 | + |
| 28 | +# Or with parameters |
| 29 | +python3 .changeset/scripts/changeset.py --type patch --message "Fixed a bug" |
| 30 | +``` |
| 31 | + |
| 32 | +### 2. Test Version Bumping |
| 33 | + |
| 34 | +```bash |
| 35 | +# Dry run to see what would happen |
| 36 | +python3 .changeset/scripts/version.py --dry-run |
| 37 | + |
| 38 | +# Actually bump the version |
| 39 | +python3 .changeset/scripts/version.py |
| 40 | +``` |
| 41 | + |
| 42 | +### 3. Test Changelog Generation |
| 43 | + |
| 44 | +```bash |
| 45 | +# Dry run to preview changelog |
| 46 | +python3 .changeset/scripts/changelog.py --dry-run |
| 47 | + |
| 48 | +# Generate changelog |
| 49 | +python3 .changeset/scripts/changelog.py |
| 50 | +``` |
| 51 | + |
| 52 | +### 4. Test Pre-commit Hooks |
| 53 | + |
| 54 | +```bash |
| 55 | +# Validate changeset files |
| 56 | +python3 .changeset/scripts/validate-changesets.py .changeset/*.md |
| 57 | + |
| 58 | +# Check if changeset exists (will fail on main branch) |
| 59 | +python3 .changeset/scripts/check-changeset.py |
| 60 | +``` |
| 61 | + |
| 62 | +## GitHub Actions Testing |
| 63 | + |
| 64 | +The GitHub Actions will trigger when: |
| 65 | +1. **Push to main**: Creates/updates a "Version Packages" PR |
| 66 | +2. **Merge version PR**: Publishes to PyPI and creates GitHub release |
| 67 | + |
| 68 | +To test locally: |
| 69 | +1. Create a feature branch |
| 70 | +2. Make some changes |
| 71 | +3. Create a changeset: `./changeset` |
| 72 | +4. Commit and push |
| 73 | +5. Open PR to main |
| 74 | +6. When merged, the actions will run |
| 75 | + |
| 76 | +## Expected Behavior |
| 77 | + |
| 78 | +### Changeset Creation |
| 79 | +- Creates a markdown file in `.changeset/` with a random name |
| 80 | +- File contains package name, change type, and description |
| 81 | +- Shows changed files compared to main branch |
| 82 | + |
| 83 | +### Version Bumping |
| 84 | +- Reads all changesets |
| 85 | +- Determines version bump (major > minor > patch) |
| 86 | +- Updates version in `pyproject.toml` and `__init__.py` |
| 87 | +- Archives processed changesets |
| 88 | +- Creates data file for changelog generation |
| 89 | + |
| 90 | +### Changelog Generation |
| 91 | +- Reads changeset data from version script |
| 92 | +- Generates formatted changelog entry |
| 93 | +- Updates CHANGELOG.md with new version section |
| 94 | +- Groups changes by type (major/minor/patch) |
| 95 | + |
| 96 | +### GitHub Actions |
| 97 | +- `changesets.yml`: Runs on push to main |
| 98 | +- `changeset-publish.yml`: Runs when version PR is merged |
| 99 | +- Creates PR with version bumps and changelog updates |
| 100 | +- Publishes to PyPI when PR is merged |
| 101 | + |
| 102 | +## Troubleshooting |
| 103 | + |
| 104 | +### "No changeset found" error |
| 105 | +- Make sure you're not on main/master branch |
| 106 | +- Create a changeset with `./changeset` |
| 107 | +- Check `.changeset/` directory for `.md` files |
| 108 | + |
| 109 | +### Version not bumping correctly |
| 110 | +- Check `.changeset/config.json` is valid JSON |
| 111 | +- Ensure changesets have correct format |
| 112 | +- Look for error messages in script output |
| 113 | + |
| 114 | +### Changelog not generating |
| 115 | +- Make sure version script ran first |
| 116 | +- Check for `.changeset/.changeset-data.json` |
| 117 | +- Verify CHANGELOG.md exists or will be created |
| 118 | + |
| 119 | +### Pre-commit hooks not working |
| 120 | +- Install pre-commit: `pip install pre-commit` |
| 121 | +- Set up hooks: `pre-commit install` |
| 122 | +- Run manually: `pre-commit run --all-files` |
0 commit comments