Skip to content

Commit

Permalink
ci: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Feb 22, 2025
1 parent 62b757d commit ad0b9b5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 97 deletions.
84 changes: 78 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,90 @@
name: Deploy and Containerize
name: Release, Deploy, Containerize

env:
py: "3.11"

on:
release:
types: [created]
push:
tags:
- 'v*.*.*'

defaults:
run:
shell: bash -l {0}

permissions:
contents: write

jobs:


Test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ "3.9", "3.10", "3.11" ]
include:
- os: ubuntu-latest
# - os: windows-latest
# - os: macos-latest
runs-on: ${{ matrix.os }}

steps:

- name: 🧾 Checkout repository
uses: actions/checkout@v4

- name: 🛠️ Install Python ${{ matrix.python-version }} and deps with micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: metator.yaml
init-shell: bash
cache-environment: false
post-cleanup: 'none'
generate-run-shell: true
create-args: >-
python=${{ matrix.python-version }}
- name: 📦 Install package
run: |
pip install .[test]
shell: micromamba-shell {0}

- name: 🧪 Run tests with Python ${{ matrix.python-version }}
run: |
ruff check . --select=E9,F63,F7,F82
pytest --cov --cov-report=xml
codecov
shell: micromamba-shell {0}

Release:

needs: Test
runs-on: ubuntu-latest

steps:

- name: 🧾 Checkout repository
uses: actions/checkout@v4

- name: 🔍 Check version
run: |
tag_version=${GITHUB_REF#refs/tags/v}
pkg_version=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml)
if [ "$tag_version" != "$pkg_version" ]; then
echo "Version mismatch: tag version ($tag_version) does not match pyproject.toml version ($pkg_version)"
exit 1
else
echo "Version match: tag version ($tag_version) matches pyproject.toml version ($pkg_version)"
fi
- name: 📦 Create GitHub release
uses: softprops/action-gh-release@v2


Deploy:

needs: Test
runs-on: ubuntu-latest

steps:
Expand All @@ -36,7 +110,6 @@ jobs:
hatch build
twine upload dist/*
Containerize:

runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,4 +156,3 @@ jobs:
build-args: |
PKG_VERSION=${{ github.ref_name }}
PY_VERSION=${{ env.py }}
91 changes: 0 additions & 91 deletions .github/workflows/release.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ Unit tests are automatically run on GitHub for all pull requests.

Pull requests are welcome, once changes have been tested and pass all CI checks. Please make sure to include tests for any new functionality.

## Versioning

- We follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for versioning this project.
- We use [semantic versioning](https://semver.org) for this project.
- Whenever a version bump is needed, the maintainer will bump the version in [pyproject.toml](./pyproject.toml), and tag the commit. This will trigger:
- A new release on Github;
- Propagation of this release on PyPI;
- A new Docker image on [ghcr.io/koszullab/metator](https://ghcr.io/koszullab/metator).

## Acknowledgments

This document is based off of the [guidelines from the sparse project](https://github.com/pydata/sparse/blob/master/docs/contributing.rst).
Expand Down

0 comments on commit ad0b9b5

Please sign in to comment.