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

Feature/switch to hatch #31

Merged
merged 1 commit into from
Nov 3, 2023
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
20 changes: 11 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install poetry
run: pipx install poetry==1.3.2

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
python-version: "3.11"

- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -27,11 +29,11 @@ jobs:
python3-gi \
gobject-introspection \
libgtk-3-dev
- name: Poetry install
run: poetry install
- name: Pytest
run: poetry run pytest --cov --cov-report=xml

- name: Run pytest
run: hatch run test

- name: Coveralls
run: poetry run coveralls
run: hatch run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
72 changes: 29 additions & 43 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install poetry
run: pipx install poetry==1.3.2

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
python-version: "3.11"

- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -26,18 +28,9 @@ jobs:
python3-gi \
gobject-introspection \
libgtk-4-dev
- name: Poetry install
run: poetry install
- name: Ruff
run: poetry run ruff check .
- name: Ruff format
run: poetry run ruff format --check --diff .
- name: Mypy
run: poetry run mypy
- name: Pytest
run: poetry run pytest
- name: Test AppImage build
run: poetry run make clean-build

- name: Run project checks
run: hatch run check

publish:
name: Build & Publish
Expand All @@ -46,12 +39,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install poetry
run: pipx install poetry==1.3.2

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
python-version: "3.11"

- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -61,27 +56,18 @@ jobs:
python3-gi \
gobject-introspection \
libgtk-4-dev
- name: Poetry install
run: poetry install
# Prepare Release
- name: Build AppImage
run: poetry run make clean-build
- name: Draft release
uses: softprops/action-gh-release@v1

- name: Build Python package
run: hatch build

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
files: |
*.AppImage
body:
See [CHANGELOG](https://github.com/dynobo/keyhint/blob/main/CHANGELOG.md)
for details.
draft: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish to PyPi
- name: Build and publish to PyPi
run: |
poetry publish \
--build \
--username __token__ \
--password ${{ secrets.PYPI_KEYHINT_TOKEN }}
verbose: true
print-hash: true

- name: Sign published artifacts
uses: sigstore/gh-action-sigstore-python@v2.1.0
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
cheatsheet.jpeg
.venv
.virtualenvs
.vscode
run.sh
*.*~
*.AppImage
*.bin
keyhint.dist-info/
app.build
app.onefile-build
app.dist
.envrc
.ruff_cache


# Byte-compiled / optimized / DLL files
Expand Down
57 changes: 8 additions & 49 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# See https://pre-commit.com/ for usage and config
fail_fast: true

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.1.1
rev: v2.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.5.0
hooks:
- id: check-ast
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
Expand All @@ -17,53 +20,9 @@ repos:
- id: mixed-line-ending
- repo: local
hooks:
- id: mdformat
name: mdformat
stages: [commit]
language: system
entry: poetry run mdformat --wrap 88
types: [markdown]

- id: ruff-format
name: ruff-format
stages: [commit]
language: system
entry: poetry run ruff format .
types: [python]

- id: pip-audit
name: pip-audit
stages: [commit]
language: system
entry:
bash -c "poetry run pip-audit --strict -r <(poetry export -f requirements.txt
--with dev | sed 's/\[.*\]//g' | sed -z 's/\n\W//g' | sed -z 's/\\//g' | uniq
)"
# First `sed` removes potential "[<extra>]" after package names
# Second `sed` removes "\n" in front of "--hash" to get one line per package
# Final `uniq` is the used to de-duplicated those lines
pass_filenames: false

- id: ruff
name: ruff
stages: [commit]
language: system
entry: poetry run ruff --fix .
types: [python]
pass_filenames: false

- id: mypy
name: mypy
stages: [commit]
language: system
entry: poetry run mypy
types: [python]
pass_filenames: false

- id: pytest
name: pytest
- id: check
name: run project checks
stages: [commit]
language: system
entry: poetry run pytest tests/ -vv --cov --cov-report html
types: [python]
entry: hatch run pre-commit
pass_filenames: false
23 changes: 0 additions & 23 deletions Makefile

This file was deleted.

Loading
Loading