Skip to content

Commit

Permalink
build: use flit
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Jun 9, 2024
1 parent 560a66e commit 715328f
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 1,607 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip

- uses: trim21/setup-poetry@dist/v2

- uses: trim21/install-poetry-project@dist/v2
- run: pip install -e '.[dev]'

- name: test
run: coverage run -m pytest
Expand All @@ -53,3 +52,17 @@ jobs:
with:
flags: "${{ matrix.python }}"
token: ${{ secrets.CODECOV_TOKEN }}

dist-files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- run: pipx run flit build

- name: Check Files
run: pipx run twine check --strict dist/*
5 changes: 1 addition & 4 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"

- uses: trim21/setup-poetry@dist/v2

- uses: trim21/install-poetry-project@dist/v2
cache: pip

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"

- uses: trim21/setup-poetry@dist/v2

- uses: trim21/install-poetry-project@dist/v2
cache: pip

- uses: liskin/gh-problem-matcher-wrap@v3
with:
action: add
linters: mypy

- run: pip install -e '.[dev]'

- name: mypy
run: mypy --show-column-numbers transmission_rpc

Expand All @@ -38,9 +37,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip

- run: pip install -e '.[dev,docs]'

- uses: trim21/setup-poetry@dist/v2
- uses: trim21/install-poetry-project@dist/v2
- uses: trim21/actions/pre-commit@master


Expand All @@ -53,11 +53,8 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip

- uses: trim21/setup-poetry@dist/v2

- uses: trim21/install-poetry-project@dist/v2
with:
install_args: --with docs
- run: pip install -e '.[dev,docs]'

- run: sphinx-build -W docs/ dist/
28 changes: 18 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,35 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: trim21/setup-poetry@dist/v2
with:
python-version: '3.x'

- run: poetry publish --build
- run: pipx run flit publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
FLIT_USERNAME: '__token__'
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Get Previous Tag
id: tag
uses: trim21/changelog-previous-tag@master
with:
token: ${{ github.token }}
version-spec: pep440

- name: Generate Changelog
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1.10.2
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
fromTag: ${{ github.ref_name }}
toTag: ${{ env.previousTag }}
restrictToTypes: feat,fix,revert

- name: Upload Github Release
run: gh release create "${GITHUB_REF}" --notes "${CHANGELOG}"
run: gh release create "${GITHUB_REF}" --notes "${CHANGELOG}" $EXTRA_OPTS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHANGELOG: "${{ steps.changelog.outputs.changes }}"
EXTRA_OPTS: "${{ env.preRelease == 'true' && '-p' || '' }}"
19 changes: 12 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
default_stages: [commit]

repos:
- repo: https://github.com/python-poetry/poetry
rev: "1.8.3"
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.18
hooks:
- id: poetry-check
- id: poetry-lock
name: poetry-lock-check
args: ["--check"]
- id: validate-pyproject
# Optional extra validations from SchemaStore:
additional_dependencies: ["validate-pyproject-schema-store[all]"]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', '--preserve-quotes', --offset, '2']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -34,7 +39,7 @@ repos:
rev: v0.4.8
hooks:
- id: ruff
args: [ --fix ]
args: [--fix]

- repo: https://github.com/psf/black
rev: 24.4.2
Expand Down
Loading

0 comments on commit 715328f

Please sign in to comment.