-
Notifications
You must be signed in to change notification settings - Fork 4
feat(ci): automated semantic release and versioned Docker tags #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,13 +9,11 @@ on: | |||||||
| push: | ||||||||
| branches: [main] | ||||||||
| paths: | ||||||||
| - 'pyproject.toml' | ||||||||
| - 'pixi.lock' | ||||||||
| - 'src/**' | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what circumstances should we rebuild the container? Maybe talk to Michael about this? I don't have strong opinions, but it isn't cost free to rebuild.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should rebuild on release, which is what this sets up, but we could also build more frequently? Previously we were rebuilding every time one of these files were changed, which will get a bit excessive potentially especially a bit later on. |
||||||||
| - 'scripts/**' | ||||||||
| - 'Dockerfile' | ||||||||
| - 'docker-entrypoint.sh' | ||||||||
| - '.github/workflows/docker.yml' | ||||||||
| tags: | ||||||||
| - 'v*.*.*' | ||||||||
|
Comment on lines
9
to
+16
|
||||||||
| workflow_dispatch: | ||||||||
|
|
||||||||
| env: | ||||||||
|
|
@@ -30,29 +28,39 @@ jobs: | |||||||
|
|
||||||||
| steps: | ||||||||
| - name: Checkout code | ||||||||
| uses: actions/checkout@v4 | ||||||||
| uses: actions/checkout@v6 | ||||||||
|
|
||||||||
| - name: Set up Docker Buildx | ||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||
| uses: docker/setup-buildx-action@v4 | ||||||||
|
|
||||||||
| - name: Login to Docker Hub | ||||||||
| uses: docker/login-action@v3 | ||||||||
| uses: docker/login-action@v4 | ||||||||
| with: | ||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||
|
|
||||||||
| # The Dockerfile uses COPY --from=diffuseproject/sampleworks-checkpoints:latest | ||||||||
| # which Docker automatically pulls from Docker Hub during the build. | ||||||||
| # No checkpoint files are needed in the CI build context. | ||||||||
|
|
||||||||
| - name: Docker metadata | ||||||||
| id: meta | ||||||||
| uses: docker/metadata-action@v6 | ||||||||
| with: | ||||||||
| images: ${{ env.DOCKERHUB_ORG }}/${{ env.IMAGE_NAME }} | ||||||||
| tags: | | ||||||||
| type=raw,value=latest | ||||||||
|
||||||||
| type=raw,value=latest | |
| type=raw,value=latest,enable={{is_tag && matches(tag, '^v[0-9]+\\.[0-9]+\\.[0-9]+$')}} | |
| type=raw,value=edge,enable={{is_default_branch}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix doesn't seem to have an associated value, should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously there was no prefix to the sha256 value in the image, but the new metadata action version by default includes "sha" as the prefix so that's why I set to empty here
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| concurrency: release | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
|
|
||
| - run: git reset --hard ${{ github.sha }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Semantic Release | ||
| id: release | ||
| uses: python-semantic-release/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| git_committer_name: "github-actions" | ||
| git_committer_email: "[email protected]" | ||
|
|
||
|
k-chrispens marked this conversation as resolved.
|
||
| - name: Publish to GitHub Releases | ||
| if: steps.release.outputs.released == 'true' | ||
| uses: python-semantic-release/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| tag: ${{ steps.release.outputs.tag }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -233,6 +233,80 @@ pixi run -e boltz-dev prek run -a # Run all hooks on all files | |
|
|
||
| Note: `ty` type checking is split per environment — Boltz files are checked in `boltz-dev`, Protenix files in `protenix-dev`, RF3 files in `rf3-dev`. See `.pre-commit-config.yaml` for the file routing rules. | ||
|
|
||
| ## Release Process | ||
|
|
||
| Releases are fully automated via [python-semantic-release](https://python-semantic-release.readthedocs.io/) (PSR v10). No manual version bumps or changelog edits are needed. | ||
|
|
||
| ### Conventional Commits (Required) | ||
|
|
||
| All commit messages **must** follow the [Conventional Commits](https://www.conventionalcommits.org/) format: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should start squashing commits and generating a good single commit message for each PR (and reject PRs that try to do too much at once)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I will change the merge requirements on the repo |
||
|
|
||
| ``` | ||
| <type>(<optional scope>): <summary> | ||
|
|
||
| [optional body] | ||
|
|
||
| [optional footer(s)] | ||
| ``` | ||
|
k-chrispens marked this conversation as resolved.
|
||
|
|
||
| **Types and their effect on versioning:** | ||
|
|
||
| | Type | Description | Version bump | | ||
| |------|-------------|-------------| | ||
| | `feat` | New feature | Minor (0.x.0) | | ||
| | `fix` | Bug fix | Patch (0.x.x) | | ||
| | `docs` | Documentation only | None | | ||
| | `refactor` | Code change (no new feature or fix) | None | | ||
| | `test` | Adding/updating tests | None | | ||
| | `chore` | Maintenance (CI, deps, tooling) | None | | ||
| | `perf` | Performance improvement | Patch (0.x.x) | | ||
|
|
||
| **Breaking changes** (append `!` after type, e.g. `feat!:`) bump the minor version while we're in 0.x (`major_on_zero = false`). | ||
|
|
||
| **Examples:** | ||
| ```bash | ||
| feat(rewards): add cryo-EM image stack reward function | ||
| fix(boltz): correct atom reconciler index mapping for OXT atoms | ||
| docs: update AGENTS.md with new model wrapper example | ||
| refactor(scalers)!: rename StepScaler to StepGuide | ||
| chore(ci): pin Docker build action to v5 | ||
| ``` | ||
|
|
||
| A **commitizen** pre-commit hook validates commit messages locally. Install it with: | ||
| ```bash | ||
| pixi run -e boltz-dev prek install --hook-type commit-msg | ||
| ``` | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| ### How Releases Work | ||
|
|
||
| 1. Push/merge to `main` with `feat:` or `fix:` commits | ||
| 2. The **Release** workflow runs PSR, which: | ||
| - Analyzes commits since the last tag | ||
| - Determines the version bump (or skips if no releasable commits) | ||
| - Updates `version` in `pyproject.toml` | ||
| - Updates `CHANGELOG.md` | ||
| - Creates a version commit and `v{version}` tag | ||
| - Pushes the commit and tag | ||
| 3. The **Docker** workflow triggers on the new `v*.*.*` tag and builds images tagged with the version | ||
|
|
||
| ### What Does NOT Trigger a Release | ||
|
|
||
| Commits with types `docs`, `refactor`, `test`, `chore`, `ci`, or `style` do not bump the version. They will appear in the next changelog under their respective sections when a releasable commit is included. | ||
|
|
||
| ### Version Strategy | ||
|
|
||
| We use `major_on_zero = false`, meaning breaking changes bump minor (not major) while the version is 0.x. This will change when we decide to release 1.0. | ||
|
|
||
| ### Merge Strategy | ||
|
|
||
| Use **squash merge** for all PRs. This collapses a PR's commits into a single commit on `main`, with the PR title as the commit message. The PR title **must** follow Conventional Commits format and controls the version bump: | ||
|
|
||
| - `feat(rewards): add cryo-EM image stack reward` → minor bump | ||
| - `fix(boltz): correct OXT atom mapping` → patch bump | ||
| - `docs: update installation guide` → no release | ||
|
|
||
| This keeps the changelog clean (one entry per PR), the version history predictable (one potential bump per PR), and requires no discipline around individual commit messages during development. PRs should be focused on a single logical change — avoid PRs that bundle unrelated features and fixes. | ||
|
|
||
| ## Testing Philosophy | ||
|
|
||
| Write black-box tests that verify **behavior**, not implementation. Test public interfaces with realistic inputs. Verify outputs match contracts — shapes, value ranges, mathematical properties. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # CHANGELOG | ||
|
|
||
| <!--next-version-placeholder--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment on this file: have to tested that it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, good question for Michael too. The only way to test it really is to push to main I think, though I can also look into ways that it might be simulated?