Skip to content
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

feat: Update project #14

Merged
merged 5 commits into from
Oct 12, 2024
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
14 changes: 14 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Bump version

on:
push:
branches:
- main

jobs:
bump-version:
uses: janw/workflows/.github/workflows/commitizen-bump-version.yaml@main
secrets:
personal-access-token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
74 changes: 74 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Linters

on:
pull_request:

jobs:
commitizen:
uses: janw/workflows/.github/workflows/commitizen.yaml@main

pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}

- name: Install poetry
run: pipx install poetry

- name: Set up python environment
uses: actions/setup-python@v5
with:
cache: poetry
python-version: 3.x

- name: Install dependencies
run: poetry install --no-root --sync

- id: cache-restore
uses: actions/cache/restore@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-v0|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- id: pre-commit
shell: bash
run: |
set +e
set -o pipefail

echo -e '### Pre-commit results 🤖\n```plain' > pre-commit.log

poetry run pre-commit run --show-diff-on-failure --color=never --all-files \
| tee -a pre-commit.log
result=$?

echo -e '```' >> pre-commit.log
exit $result

- id: cache-save
uses: actions/cache/save@v4
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
path: ~/.cache/pre-commit

- name: Create results comment
uses: thollander/actions-comment-pull-request@v3
if: always()
with:
file-path: pre-commit.log
mode: recreate
github-token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
comment-tag: pre_commit_results

- uses: stefanzweifel/git-auto-commit-action@v5
if: always() && github.actor != 'janw-bot'
with:
commit_message: "build(lint): Auto-fix linting issues"
commit_user_name: "Jan Willhaus [bot]"
commit_user_email: "bot@janw.xyz"
commit_author: Jan Willhaus [bot] <bot@janw.xyz>
add_options: '-u'
47 changes: 0 additions & 47 deletions .github/workflows/mypy.yaml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
push:
tags:
- "v*.*.*"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Build package
run: poetry build -vvv

- uses: actions/upload-artifact@v4
with:
name: package
path: |
README.md
pyproject.toml
dist/*
if-no-files-found: error
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: package

- run: ls dist/*

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # cspell: disable-line
28 changes: 0 additions & 28 deletions .github/workflows/release.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"

name: pytest-${{ matrix.os }}-${{ matrix.python-version }}
steps:
Expand Down
29 changes: 20 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,37 @@ ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/janw/pre-commit-hooks
rev: v0.1.0
hooks:
- id: sync_ruff_version

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.9'
rev: 'v0.6.9'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
hooks:
- id: mypy

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.5.0'
rev: 'v5.0.0'
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/python-poetry/poetry
rev: '1.7.0'
rev: '1.8.0'
hooks:
- id: poetry-lock
args:
- --no-update
- id: poetry-check
- id: poetry-export

- repo: local
hooks:
- id: mypy
name: mypy
entry: poetry run mypy
language: system
require_serial: true
pass_filenames: false
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.13.0
7 changes: 1 addition & 6 deletions drmeter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import importlib.metadata as importlib_metadata

from drmeter.algorithm import dynamic_range
from drmeter.compat import calc_drscore

Expand All @@ -8,7 +6,4 @@
"dynamic_range",
]

try:
__version__ = importlib_metadata.version(__name__)
except importlib_metadata.PackageNotFoundError: # pragma: no cover
__version__ = "dev"
__version__ = "0.2.2"
Loading
Loading