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
17 changes: 0 additions & 17 deletions .bumpversion.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions .github/next_steps/02_citation.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/next_steps/03_readthedocs.md

This file was deleted.

22 changes: 0 additions & 22 deletions .github/next_steps/04_zenodo_integration.md

This file was deleted.

17 changes: 0 additions & 17 deletions .github/next_steps/05_linting.md

This file was deleted.

117 changes: 117 additions & 0 deletions .github/workflows/release_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Draft GitHub Release

on:
workflow_dispatch:
inputs:
version_level:
description: "Semantic version level increase."
required: true
type: choice
options:
- patch
- minor
- major
release_branch:
description: "Branch to use for releasing."
type: string
default: "test_protected_develop"

permissions:
contents: write
pull-requests: write

jobs:
github_release:
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}

- name: Configure git
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git pull

- name: Merge changes into main
run: |
git switch test_protected_main
git merge ${{ github.event.inputs.release_branch }} --no-ff --no-commit
git merge --continue

- name: Bump version
id: bump
run: |
echo "-- install bump-my-version"
python3 -m pip install bump-my-version
echo "-- bump the version"
bump-my-version bump ${{ github.event.inputs.version_level }} --commit --tag
echo "-- push bumped version"
echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
git push --tags -f
git push

- name: Create GitHub Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.bump.outputs.RELEASE_TAG }} \
--title="Release ${{ steps.bump.outputs.RELEASE_TAG }}" \
--generate-notes \
--draft

tidy_workspace:
# only run if action above succeeds
needs: github_release
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}

- name: Configure git
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git pull

- name: Close PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "-- searching for associated PR"
branch_name=${{ github.event.inputs.release_branch }}
pr_number=$(gh pr list --head $branch_name --json number --jq '.[0].number')
if [ -n "$pr_number" ]; then
echo "-- closing PR #$pr_number"
gh pr close $pr_number
else
echo "-- no open pull request found for branch $branch_name"
fi

- name: Merge updates into develop
run: |
git switch test_protected_develop
git merge origin/test_protected_main
git push

- name: Delete release branch other than main or develop
run: |
if [[ ${{ github.event.inputs.release_branch}} != "test_protected_main" && ${{ github.event.inputs.release_branch}} != "test_protected_develop" ]]; then
echo "-- deleting branch '${{ github.event.inputs.release_branch }}'"
git push origin -d ${{ github.event.inputs.release_branch }}
else
echo "-- branch '${{ github.event.inputs.release_branch}}' will not be deleted from remote"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ name: Build and upload to PyPI

on:
workflow_dispatch:
# release:
# types:
# - published
release:
types:
- published

jobs:
build:
name: Build universal wheel and source distribution
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10"]
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v3
Expand Down
100 changes: 62 additions & 38 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ E.g., `feat: added module to calculate the answer to life, the universe, and eve

### Creating a PR

#### Branching strategy

We use a workflow where `main` always contains the latest stable release version of `eitprocessing` and where `develop` contains the next release version under construction.

When creating a new feature, one should branch from `develop`.
When a feature is finished, a PR to pull the feature into `develop` should be created. After one or multiple features
have been pulled into `develop`, the [release workflow](#making-a-release) can be triggered to automatically create the
new feature (minor) release originating from `develop`.

For bug fixes that can't wait on a feature release, one should branch from `main`.
When the bug fix is finished, the [release workflow](#making-a-release) can be triggered originating from
the created branch, usually with a patch update.

In principle, no releases should originate from branches other than `develop` and bug fix branches.

#### Code review and continuous integration

All contributions to the project are subject to code review and require at least one
Expand Down Expand Up @@ -111,54 +126,63 @@ Otherwise, please ensure check both linting (`ruff fix .`) and formatting (`ruff

We use [prettier](https://prettier.io/) for formatting most other files. If you are editing or adding non-python files and using VS code, the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) can be installed to auto-format these files as well.

# The following sections are untested

## Generating the API docs

```shell
cd docs
make html
```

The documentation will be in `docs/_build/html`

If you do not have `make` use

```shell
sphinx-build -b html docs docs/_build/html
```

To find undocumented Python objects run

```shell
cd docs
make coverage
cat _build/coverage/python.txt
```

To [test snippets](https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html) in documentation run

```shell
cd docs
make doctest
```

## Making a release

0. Make sure you have all required developers tools installed `pip install -e .'[dev]'`
1. Branch from `main` and prepare the branch for the release (e.g., removing the unnecessary files, fix minor bugs if necessary).
### Automated release workflow:

0. **IMP0RTANT:** [Create a PR](#creating-a-pr) for the release branch (usually `develop`) and make sure that all checks pass!
- if everything goes well, this PR will automatically be closed after the draft release is created.
1. Navigate to [Draft Github Release](https://github.com/EIT-ALIVE/eitprocessing/actions/workflows/release_github.yml)
on the [Actions](https://github.com/EIT-ALIVE/eitprocessing/actions) tab.
2. On the right hand side, you can select the level increase (patch, minor, or major) and which branch to release from.
- if released from a different branch than `develop`, then the workflow will attempt to merge the changes into develop
as well. If succesfull, the release branch will be deleted from the remote repository.
- [follow semantic versioning conventions](https://semver.org/) to chose the level increase:
- `patch`: when backward compatible bug fixes were made
- `minor`: when functionality was added in a backward compatible manner
- `major`: when API-incompatible changes have been made
3. Visit [Actions](https://github.com/EIT-ALIVE/eitprocessing/actions) tab to check whether everything went as expected.
4. Navigate to the [Releases](https://github.com/EIT-ALIVE/eitprocessing/releases) tab and click on the newest draft
release that was just generated.
5. Click on the edit (pencil) icon on the right side of the draft release.
6. Check/adapt the release notes and make sure that everything is as expected.
7. Check that "Set as the latest release is checked".
8. Click green "Publish Release" button to convert the draft to a published release on GitHub.
- This will automatically trigger [another GitHub workflow](https://github.com/EIT-ALIVE/eitprocessing/actions/workflows/release.yml) that will take care of publishing the package on PyPi.

#### Updating the token:

NOTE: the current token (associated to @DaniBodor) allowing to bypass branch protection will expire on June 20th, 2025. To update the token do the following:

1. [Create a personal access token](https://github.com/settings/tokens/new) from a GitHub user account with admin
priviliges for this repo.
2. Check all the "repo" boxes and the "workflow" box, set an expiration date, and give the token a note.
3. Click green "Generate token" button on the bottom
4. Copy the token immediately, as it will not be visible again later.
5. Navigate to the [secrets settings](https://github.com/EIT-ALIVE/eitprocessing/settings/secrets/actions).
6. Edit the `GH_PAT` key giving your access token as the new value.

### Manually create a release:

0. Make sure you have all required developers tools installed `pip install -e .'[dev]'`.
1. Create a `release` branch from `main` and merge the changes into this branch.
- Ensure that the `release` branch is ready to be merged back into `main` (e.g., removing the unnecessary files, fix minor bugs if necessary).
- Also see our [branching strategy](#branching-strategy) above.
2. Ensure all tests pass `pytest -v` and that linting (`ruff check`) and formatting (`ruff format --check`) conventions
are adhered to.
3. Bump the version using [bumpversion](https://github.com/c4urself/bump2version): `bumpversion <level>`
3. Bump the version using [bump-my-version](https://github.com/callowayproject/bump-my-version): `bump-my-version bump <level>`
where level must be one of the following ([following semantic versioning conventions](https://semver.org/)):
- `major`: when API-incompatible changes have been made
- `minor`: when functionality was added in a backward compatible manner
- `patch`: when backward compatible bug fixes were made
4. Merge the release branch into `main`.
4. Merge the release branch into `main` and `develop`.
5. On the [Releases page](https://github.com/EIT-ALIVE/eitprocessing/releases):
1. Click "Draft a new release"
2. By convention, use `v<version number>` as both the release title and as a tag for the release.
3. Click "Generate release notes" to automatically load release notes from merged PRs since the last release.
4. Adjust the notes as required
4. Adjust the notes as required.
5. Ensure that "Set as latest release" is checked and that both other boxes are unchecked.
6. Hit "Publish release". This will automatically trigger [the GitHub action](https://github.com/EIT-ALIVE/eitprocessing/actions/workflows/release.yml) that will take care of publishing the package on PyPi.
6. Hit "Publish release".
- This will automatically trigger a [GitHub
workflow](https://github.com/EIT-ALIVE/eitprocessing/actions/workflows/release.yml) that will take care of publishing
the package on PyPi.
2 changes: 1 addition & 1 deletion eitprocessing/datahandling/eitdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ class Vendor(LowercaseStrEnum):
TIMPEL = auto()
SENTEC = auto()
DRAGER = DRAEGER
DRÄGER = DRAEGER
DRÄGER = DRAEGER # noqa: PLC2401
Loading