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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @clintval
133 changes: 133 additions & 0 deletions .github/workflows/publish_multiqc_pivot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: publish multiqc-pivot

on:
push:
tags: '[0-9]+.[0-9]+.[0-9]+'

permissions: {}

env:
UV_VERSION: 0.11.16

jobs:
on-main-branch-check:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
on_main: ${{ steps.contains_tag.outputs.retval }}
steps:
# action-contains-tag lists remote branches to find the tag; current git follows the remote
# HEAD by default, which breaks that lookup: https://github.com/rickstaa/action-contains-tag/pull/18
- name: git config --global remote.origin.followRemoteHEAD never
shell: bash
run: git config --global remote.origin.followRemoteHEAD never

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: rickstaa/action-contains-tag@a9ff27d505ba2bf074a2ebb48b208e76d35ff308 # v1.2.10
id: contains_tag
with:
reference: "main"
tag: "${{ github.ref_name }}"

unit-tests:
needs: on-main-branch-check
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }}
permissions:
contents: read
uses: "./.github/workflows/tests.yml"

build-wheels:
needs: unit-tests
permissions:
contents: read
uses: "./.github/workflows/wheels.yml"

build-sdist:
name: build source distribution
needs: unit-tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: ${{ env.UV_VERSION }}
python-version: "3.11"
enable-cache: 'false'

- name: Build package
run: uv build --sdist --out-dir dist

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: multiqc-pivot-sdist
path: dist/*.tar.gz

publish-to-pypi:
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: packages
pattern: 'multiqc-pivot-*'
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
packages-dir: packages/
skip-existing: true
verbose: true

make-changelog:
runs-on: ubuntu-latest
needs: publish-to-pypi
permissions:
contents: read
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout the Repository at the Tagged Commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
persist-credentials: false

- name: Generate a Changelog
uses: orhun/git-cliff-action@3d96a18cc4ec17e9dc69ddcc424ccafaf1f78ce2 # v4.9.0
id: git-cliff
with:
config: pyproject.toml
args: --latest --verbose
env:
GITHUB_REPO: ${{ github.repository }}

make-github-release:
runs-on: ubuntu-latest
environment: github
permissions:
contents: write
pull-requests: read
needs: make-changelog
steps:
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
NOTES: ${{ needs.make-changelog.outputs.release_body }}
run: gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --title "$TAG" --notes "$NOTES"
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: tests

on:
push:
branches:
- "**"
tags:
- "!**"
workflow_call:

permissions:
contents: read

env:
UV_VERSION: 0.11.16

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ matrix.PYTHON_VERSION }}
enable-cache: 'false'

- name: Test the library
run: |
uv run --locked poe check-all
37 changes: 37 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: wheels

on:
pull_request:
workflow_call:
workflow_dispatch:

permissions:
contents: read

env:
UV_VERSION: 0.11.16

jobs:
build-wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: ${{ env.UV_VERSION }}
python-version: "3.11"
enable-cache: 'false'

- name: Build wheels
run: uv build --wheel --out-dir wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: multiqc-pivot-wheels
path: ./wheelhouse/multiqc_pivot*.whl
if-no-files-found: error
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data/
*.html
.DS_Store
.vscode/
Expand Down
125 changes: 125 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Development and Testing

## Primary Development Commands

To check and resolve linting issues in the codebase, run:

```console
uv run ruff check --fix
```

To check and resolve formatting issues in the codebase, run:

```console
uv run ruff format
```

To check the unit tests in the codebase, run:

```console
uv run pytest
```

To check the typing in the codebase, run:

```console
uv run mypy
```

To generate a code coverage report after testing locally, run:

```console
uv run coverage html
```

To check the lock file is up to date:

```console
uv lock --check
```

The lock file is resolved without any user-level uv configuration, which is how CI resolves it. If your `~/.config/uv/uv.toml` sets `exclude-newer` or similar, uv will want to re-resolve and will rewrite `uv.lock`. Set `UV_NO_CONFIG=1` in your shell while working here to match CI; the environment variable matters because `poe` runs each task through its own `uv run`, which a `--no-config` flag on the outer command does not reach.

## Shortcut Task Commands

###### For Running Individual Checks

```console
uv run poe check-format
uv run poe check-lint
uv run poe check-tests
uv run poe check-typing
```

###### For Running All Checks

```console
uv run poe check-all
```

###### For Running Individual Fixes

```console
uv run poe fix-format
uv run poe fix-lint
```

###### For Running All Fixes

```console
uv run poe fix-all
```

###### For Running All Fixes and Checks

```console
uv run poe fix-and-check-all
```

## Trying a change against a real report

Point MultiQC at any directory of QC outputs with a config that has a `sample_pivot` block. The
plugin is picked up automatically once the package is installed in the same environment:

```console
uv run multiqc --config my_config.yml ./path-to-data
```

## Creating a release on PyPI

> [!NOTE]
> This project follows [Semantic Versioning](https://semver.org/), aka SemVer. In brief:
>
> - MAJOR version when you make incompatible API changes
> - MINOR version when you add functionality in a backwards compatible manner
> - PATCH version when you make backwards compatible bug fixes

> [!IMPORTANT]
> Consider editing the changelog if there are any errors or necessary enhancements.

1. Clone the repository, ensure you are on the main branch, and that the working directory is clean.
2. Check out a new branch to prepare the library for release.
3. Bump the version of the library to the desired SemVer, e.g.:
```console
# Increment the minor segment
uv version --bump minor

# Update to a specific version number
uv version 0.2.0
```
4. Commit the version bump changes with a Git commit message like `chore(release): bump to #.#.#`.
5. Push the commit, open a PR, ensure tests pass, and seek reviews.
6. Squash merge the PR into the `main` branch.
7. Tag the new commit on the main branch with the bumped version number.

> [!WARNING]
> The tag **must** be a valid SemVer version number and **must** match the version set in (3). The [publishing GitHub Action](.github/workflows/publish_multiqc_pivot.yml) is activated by a new tag on the `main` branch containing a valid SemVer version.

GitHub Actions will take care of the remainder of the deployment and release process:

1. Unit tests will be re-run.
2. A source distribution will be built.
3. A wheel distribution will be built.
4. Assets will be deployed to PyPI with the new version.
5. A [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/)-aware changelog will be drafted.
6. A GitHub release will be created with the new version tag and the drafted changelog.
Loading