|
| 1 | +# Natch Release Process |
| 2 | + |
| 3 | +This document describes the complete process for releasing a new version of Natch to Hex.pm with precompiled binaries. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- All tests passing locally (`mix test`) |
| 8 | +- All tests passing on GitHub Actions |
| 9 | +- CHANGELOG.md updated with new version |
| 10 | +- No compiler warnings |
| 11 | + |
| 12 | +## Release Steps |
| 13 | + |
| 14 | +### 1. Update Version |
| 15 | + |
| 16 | +Update the version in `mix.exs`: |
| 17 | + |
| 18 | +```elixir |
| 19 | +@version "0.X.Y" |
| 20 | +``` |
| 21 | + |
| 22 | +### 2. Update CHANGELOG.md |
| 23 | + |
| 24 | +Add a new section for the release: |
| 25 | + |
| 26 | +```markdown |
| 27 | +## [0.X.Y] - YYYY-MM-DD |
| 28 | + |
| 29 | +### Added |
| 30 | +- New features... |
| 31 | + |
| 32 | +### Changed |
| 33 | +- Changes to existing functionality... |
| 34 | + |
| 35 | +### Fixed |
| 36 | +- Bug fixes... |
| 37 | +``` |
| 38 | + |
| 39 | +### 3. Commit and Tag |
| 40 | + |
| 41 | +```bash |
| 42 | +# Commit version bump |
| 43 | +git add mix.exs CHANGELOG.md |
| 44 | +git commit -m "Release v0.X.Y" |
| 45 | + |
| 46 | +# Create annotated tag |
| 47 | +git tag -a v0.X.Y -m "Release v0.X.Y" |
| 48 | + |
| 49 | +# Push to GitHub (triggers precompile workflow) |
| 50 | +git push origin main --tags |
| 51 | +``` |
| 52 | + |
| 53 | +### 4. Wait for GitHub Actions |
| 54 | + |
| 55 | +The `.github/workflows/precompile.yml` workflow will automatically: |
| 56 | +- Build precompiled binaries for 7 platforms |
| 57 | +- Upload them to the GitHub Release |
| 58 | +- This takes approximately 10-15 minutes |
| 59 | + |
| 60 | +Monitor the workflow at: |
| 61 | +``` |
| 62 | +https://github.com/Intellection/natch/actions |
| 63 | +``` |
| 64 | + |
| 65 | +Expected binaries: |
| 66 | +- `natch-nif-2.17-x86_64-linux-gnu-0.X.Y.tar.gz` |
| 67 | +- `natch-nif-2.17-aarch64-linux-gnu-0.X.Y.tar.gz` |
| 68 | +- `natch-nif-2.17-x86_64-apple-darwin-0.X.Y.tar.gz` |
| 69 | +- `natch-nif-2.17-aarch64-apple-darwin-0.X.Y.tar.gz` |
| 70 | +- `natch-nif-2.17-armv7l-linux-gnueabihf-0.X.Y.tar.gz` (cross-compiled) |
| 71 | +- `natch-nif-2.17-i686-linux-gnu-0.X.Y.tar.gz` (cross-compiled) |
| 72 | +- `natch-nif-2.17-riscv64-linux-gnu-0.X.Y.tar.gz` (cross-compiled) |
| 73 | + |
| 74 | +### 5. Generate Checksums |
| 75 | + |
| 76 | +Once GitHub Actions completes: |
| 77 | + |
| 78 | +```bash |
| 79 | +# Generate checksums for all precompiled binaries |
| 80 | +MIX_ENV=prod mix elixir_make.checksum --all --ignore-unavailable |
| 81 | +``` |
| 82 | + |
| 83 | +This creates `checksum.exs` in your working directory with SHA256 hashes of all binaries. |
| 84 | + |
| 85 | +**Important:** |
| 86 | +- This file is in `.gitignore` (don't commit it) |
| 87 | +- This file is in `mix.exs` package `files:` list (will be included in Hex package) |
| 88 | + |
| 89 | +### 6. Verify Package |
| 90 | + |
| 91 | +```bash |
| 92 | +# Build the package |
| 93 | +mix hex.build |
| 94 | + |
| 95 | +# Verify checksum.exs is included |
| 96 | +tar -tzf natch-0.X.Y.tar | grep checksum |
| 97 | + |
| 98 | +# Should see: checksum.exs |
| 99 | +``` |
| 100 | + |
| 101 | +### 7. Publish to Hex.pm |
| 102 | + |
| 103 | +```bash |
| 104 | +# Publish (will include checksum.exs) |
| 105 | +mix hex.publish |
| 106 | +``` |
| 107 | + |
| 108 | +Follow the prompts and confirm the publication. |
| 109 | + |
| 110 | +### 8. Verify Installation |
| 111 | + |
| 112 | +Create a test project to verify: |
| 113 | + |
| 114 | +```bash |
| 115 | +mkdir /tmp/natch-verify && cd /tmp/natch-verify |
| 116 | +mix new . --app test_natch |
| 117 | +``` |
| 118 | + |
| 119 | +Add to `mix.exs`: |
| 120 | +```elixir |
| 121 | +{:natch, "~> 0.X.Y"} |
| 122 | +``` |
| 123 | + |
| 124 | +Test installation: |
| 125 | +```bash |
| 126 | +mix deps.get |
| 127 | + |
| 128 | +# Look for: "Downloading precompiled NIF to ..." |
| 129 | +# Should NOT see CMake/compiler output |
| 130 | +``` |
| 131 | + |
| 132 | +Test functionality: |
| 133 | +```bash |
| 134 | +# With ClickHouse running on localhost:9000 |
| 135 | +iex -S mix |
| 136 | + |
| 137 | +iex> {:ok, conn} = Natch.Connection.start_link(host: "localhost", port: 9000) |
| 138 | +iex> Natch.Connection.execute(conn, "SELECT 1") |
| 139 | +``` |
| 140 | + |
| 141 | +## Troubleshooting |
| 142 | + |
| 143 | +### Checksums don't match |
| 144 | +- Ensure GitHub Actions completed successfully |
| 145 | +- Check the v0.X.Y release has all 7 binaries |
| 146 | +- Try deleting local cache: `rm -rf ~/.cache/elixir_make/` |
| 147 | +- Re-run: `MIX_ENV=prod mix elixir_make.checksum --all` |
| 148 | + |
| 149 | +### Precompiled binary not downloading |
| 150 | +- Verify checksum.exs is in the Hex package: `mix hex.build` and inspect |
| 151 | +- Check GitHub release has public access to binaries |
| 152 | +- Verify the URL template in mix.exs matches: `https://github.com/Intellection/natch/releases/download/v#{@version}/@{artefact_filename}` |
| 153 | + |
| 154 | +### Build fails for a platform |
| 155 | +- Cross-compiled platforms (armv7l, i686, riscv64) are best-effort |
| 156 | +- Users on those platforms will fall back to source compilation |
| 157 | +- This is expected and acceptable |
| 158 | + |
| 159 | +## Post-Release |
| 160 | + |
| 161 | +1. Announce on: |
| 162 | + - Elixir Forum |
| 163 | + - GitHub Discussions |
| 164 | + - Social media (optional) |
| 165 | + |
| 166 | +2. Monitor for issues: |
| 167 | + - https://github.com/Intellection/natch/issues |
| 168 | + - Hex.pm package page |
| 169 | + |
| 170 | +3. Clean up local artifacts: |
| 171 | + ```bash |
| 172 | + rm checksum.exs |
| 173 | + ``` |
| 174 | + |
| 175 | +## Quick Reference |
| 176 | + |
| 177 | +```bash |
| 178 | +# Full release in one go (after version updates committed) |
| 179 | +git tag -a v0.X.Y -m "Release v0.X.Y" |
| 180 | +git push origin main --tags |
| 181 | + |
| 182 | +# Wait ~10-15 min for GitHub Actions... |
| 183 | + |
| 184 | +MIX_ENV=prod mix elixir_make.checksum --all --ignore-unavailable |
| 185 | +mix hex.build # verify |
| 186 | +mix hex.publish |
| 187 | + |
| 188 | +# Clean up |
| 189 | +rm checksum.exs |
| 190 | +``` |
| 191 | + |
| 192 | +## Version Strategy |
| 193 | + |
| 194 | +- **Patch (0.X.Y)**: Bug fixes, documentation, minor improvements |
| 195 | +- **Minor (0.X.0)**: New features, new types, API additions (backward compatible) |
| 196 | +- **Major (X.0.0)**: Breaking changes, API redesign |
| 197 | + |
| 198 | +Current: v0.2.0 - First public release with precompiled binaries |
0 commit comments