Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 1 addition & 50 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Please use a PR title that conforms to *conventional commits*: "<commit_type>: Describe your change"; for example: "fix: prevent race condition". Some other commit types are: fix, feat, ci, doc, refactor...
For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0-beta.2/
For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0/
-->

#### Relevant issue or PR
Expand All @@ -11,52 +11,3 @@ For a full list of commit types visit https://www.conventionalcommits.org/en/v1.

#### Testing done
<!-- Describe how the changes were tested; e.g., "CI passes", "Tested manually in stagingrepo#123", screenshots of a terminal session that verify the changes, or any other evidence of testing the changes. -->

#### License

- [ ] By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license](https://pasteurlabs.github.io/tesseract-jax/LICENSE).
- [ ] I sign the Developer Certificate of Origin below by adding my name and email address to the `Signed-off-by` line.

<details>
<summary><b>Developer Certificate of Origin</b></summary>

```text
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```

</details>

Signed-off-by: [YOUR NAME] <[YOUR EMAIL]>
42 changes: 42 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "CLA Assistant"

on:
issue_comment:
types: [created]
pull_request_target:
types: [opened,closed,synchronize]

jobs:
cla-assistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: startsWith(github.event.comment.body, '@PasteurBot') || github.event.comment.body == 'recheck' || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
with:
allowlist: 'PasteurBot,dependabot[bot],github-actions[bot]'

remote-organization-name: 'pasteurlabs'
remote-repository-name: 'pasteur-oss-cla-signatures'
path-to-signatures: 'signatures/version1/cla.json'
branch: 'main'

create-file-commit-message: 'Creating file for storing CLA Signatures'
signed-commit-message: '$contributorName has signed the CLA in $owner/$repo'
custom-notsigned-prcomment: >
#### CLA signatures required

Thank you for your PR, we really appreciate it!
Like many open-source projects, we ask that all contributors sign our
[Contributor License Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md)
before we can accept your contribution. This only needs to be done once per contributor.
You can do so by commenting the following on this pull request:
custom-allsigned-prcomment: >
#### CLA signatures confirmed

All contributors have signed the [Contributor License Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md).
custom-pr-sign-comment: |
@PasteurBot I have read the CLA Document and I hereby sign the CLA
189 changes: 189 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: Handle release process

# This workflow automates the release process.
# Only safe to use if the following conditions are met:
# 1. `main` is protected and requires a PR to merge.
# 2. Only squash-merging is allowed.
# 3. PRs are required to be up-to-date with `main` before merging.
# 4. Everyone is forbidden from creating releases manually.

on:
# Case 1: manual trigger -> initiate release process
workflow_dispatch:

# Case 2: release PR is being updated -> update changelog
push:
branches:
- 'bot/release/*'

# Case 3: release PR is merged -> create a new release
pull_request:
types:
- closed
branches:
- main

env:
GH_TOKEN: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}

jobs:
trigger-pr:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install git-cliff
run: |
pip install git-cliff

- name: Generate changelog
id: generate_changelog
run: |
git-cliff --output CHANGELOG.md --bump
new_version=$(git-cliff --bumped-version)
echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
committer: PasteurBot <${{ vars.PL_PASTEURBOT_EMAIL }}>
author: PasteurBot <${{ vars.PL_PASTEURBOT_EMAIL }}>
commit-message: "chore: update changelog"
title: "chore: 🚢 release ${{ steps.generate_changelog.outputs.new_version }}"
branch: bot/release/${{ steps.generate_changelog.outputs.new_version }}
draft: false
base: main
add-paths: CHANGELOG.md
body: |
This PR contains the generated changelog for the release ${{ steps.generate_changelog.outputs.new_version }}.

⚠️ **Merging this PR will immediately trigger a new release**. ⚠️

To specify additional release notes, please edit this comment after the following line.

---

update-pr:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/bot/release/')

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install git-cliff
run: |
pip install git-cliff

- name: Generate changelog
id: generate_changelog
run: |
git-cliff --output CHANGELOG.md --bump
new_version=$(git-cliff --bumped-version)
echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Update PR with changelog
run: |
git config --global user.name "PasteurBot"
git config --global user.email "${{ vars.PL_PASTEURBOT_EMAIL }}"

git add CHANGELOG.md

if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "chore: update changelog before release"
git push origin HEAD:${{ github.ref }}
fi

release:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'bot/release/')

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PL_PASTEURBOT_PAT_PUBLIC }}
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install git-cliff
run: |
pip install git-cliff

- name: Get version numbers
id: get_version
run: |
current_version=$(gh release view --json tagName --jq '.tagName' || echo "v0.0.0")
echo "current_version=$current_version" >> $GITHUB_OUTPUT

new_version=$(git-cliff --bumped-version)
echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Assemble release notes
id: release_notes
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
changelog=$(git-cliff --unreleased --bump --latest --strip all)
# Strip off first line (which is the version number)
changelog=$(printf "%s" "$changelog" | sed '1d')

# Get custom notes from the PR body
custom_notes="$PR_BODY"
# Fix line endings
custom_notes=$(echo "$custom_notes" | tr -d '\r')
# Keep only the part after the first '---' line
custom_notes=$(echo "$custom_notes" | sed -n '/^---$/,$p' | sed '1d')
# Strip leading / trailing whitespace
custom_notes=$(echo "$custom_notes" | sed 's/^[ \t]*//;s/[ \t]*$//')

# Create the release notes file
touch /tmp/notes.md
echo "# Release ${{ steps.get_version.outputs.new_version }}" > /tmp/notes.md
if [[ -n "$custom_notes" ]]; then
printf "%s\n\n" "$custom_notes" >> /tmp/notes.md
fi
printf "## What's Changed\n%s\n" "$changelog" >> /tmp/notes.md

# Append link to full diff
echo -e "\n**Full diff**: https://github.com/${{ github.repository }}/compare/${{ steps.get_version.outputs.current_version }}...${{ steps.get_version.outputs.new_version }}" >> /tmp/notes.md

echo "release_note_file=/tmp/notes.md" >> $GITHUB_OUTPUT

- name: Create new release
run: |
gh release create "${{ steps.get_version.outputs.new_version }}" \
--title "${{ steps.get_version.outputs.new_version }}" \
--notes-file "${{ steps.release_notes.outputs.release_note_file }}" \
--target ${{ github.event.pull_request.merge_commit_sha }} \
--latest
37 changes: 23 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ reports and feature requests only.

## Documentation

Tesseract documentation is kept under the `docs/` directory of the repository,
Tesseract-JAX documentation is kept under the `docs/` directory of the repository,
written in Markdown and using Sphinx to generate the final HTMLs. Fixes and
enhancements to the documentation should be submitted as pull requests, we
treat the same as code contributions.
Expand All @@ -58,9 +58,11 @@ those posted elsewhere already) are best highlighted and celebrated in the

## Code

Tesseract is developed under the [Apache 2.0](LICENSE) license. By contributing
to the Tesseract project you agree that your code contributions are governed by
this license.
Tesseract-JAX is developed under the [Apache 2.0](LICENSE) license. By contributing
to the Tesseract-JAX project you agree that your code contributions are governed by
this license. We require you to sign our [Contributor License
Agreement](https://github.com/pasteurlabs/pasteur-oss-cla/blob/main/README.md)
to state so.


### Local development setup
Expand All @@ -71,7 +73,7 @@ clone the repository, install the dependencies, and setup pre-commit hooks:

```console
$ git clone git@github.com:pasteurlabs/tesseract-jax.git
$ cd tesseract
$ cd tesseract-jax
$ python -m venv venv
$ . venv/bin/activate
$ pip install -e .[dev]
Expand Down Expand Up @@ -138,11 +140,11 @@ _description_: `type[(scope)]: description`. The types we use are:
- `test`: for adding new tests or fixing existing ones.

The scopes we use are:
- `cli`: for changes that affect `tesseract` CLI.
- `cli`: for changes that affect CLI.
- `engine`: for changes that affect the CLI engine.
- `sdk`: for changes that affect the Tesseract Python API.
- `sdk`: for changes that affect the Python API.
- `example`: for changes in the examples.
- `runtime`: for changes in the Tesseract Runtime.
- `runtime`: for changes in the runtime.
- `deps`: for changes in the dependencies.

In case there are breaking changes in your code, this should be indicated in
Expand All @@ -152,12 +154,19 @@ or by adding a `BREAKING CHANGE:` trailer to the message.

## Versioning

The Tesseract project follows [semantic versioning](https://semver.org).
The Tesseract-JAX project follows [semantic versioning](https://semver.org).


## Changelog
## Release process
(code owners only)

This project [changelog](CHANGELOG.md) is generated by
[git-cliff](https://git-cliff.org). The changelog is generated by running
`git cliff --output CHANGELOG.md`. To bump the semantic version of the project
when generating the changelog: `git cliff --output CHANGELOG.md --bump`.
Releases are done via GitHub Actions, which automatically build the release
artifacts and publish them to the [GitHub Releases](https://github.com/pasteurlabs/tesseract-jax/releases) page. To create a new release, follow these steps:

1. Make sure the code is in a good state, all tests pass, and the documentation is up to date.
2. Trigger a new release action through the [GitHub UI](https://github.com/pasteurlabs/tesseract-jax/actions/workflows/release.yml). This opens a new pull request with the release notes and the version number.
3. Add any additional release notes to the pull request message. They will automatically be included at the top of the release notes.
4. In the meantime, you can add more commits to `main` (and update the release branch) which will trigger re-generation of the changelog and release notes.
5. Once the pull request is ready, merge it into `main`.
6. GitHub Actions will then automatically release the new version. Verify that the release artifacts are correctly built and published.
7. Make an announcement in the [Discourse Forum](https://si-tesseract.discourse.group/) and on social media, if applicable.