Skip to content

Commit

Permalink
Merge pull request #1 from Klavionik/better-release-ci
Browse files Browse the repository at this point in the history
Better release CI
  • Loading branch information
Klavionik authored Aug 26, 2024
2 parents 9110c7f + 4ee9a49 commit 12f15f2
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 25 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- "main"
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "Taskfile.yaml"
pull_request:
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "Taskfile.yaml"
release:
types:
- published

env:
POETRY_VERSION: "1.8.3"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
with:
extra_args: "--hook-stage manual"

test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
needs: [lint]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox-gh>=1.3
- name: Setup test suite
run: tox -v --notest
- name: Run test suite
run: tox --skip-pkg-install
- name: Upload test coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

publish:
name: Publish package
runs-on: ubuntu-latest
needs: [lint, test]
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Publish release ${{ github.ref }}
run: |
pip install poetry==${{ env.POETRY_VERSION }}
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
26 changes: 10 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,73 +13,67 @@ repos:
rev: 7.1.0
hooks:
- id: flake8
stages:
- commit
- manual
stages: [commit, manual]
additional_dependencies: [flake8-bugbear]
types: [python]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
stages:
- commit
stages: [commit]
types: [python]

- id: black
name: black-check
args:
- --check
- --diff
stages:
- manual
stages: [manual]
types: [python]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
stages:
- commit
stages: [commit]
types: [python]

- id: isort
name: isort-check
args:
- --check-only
stages:
- manual
stages: [manual]
types: [python]

- repo: local
hooks:
- id: mypy
stages: [commit]
exclude: "^tests/"
name: mypy
entry: mypy
args:
- --strict
- --no-warn-no-return
exclude: "^tests/"
language: system
types: [python]
require_serial: true

- repo: local
hooks:
- id: pytest
stages: [commit]
name: pytest-no-snap
entry: pytest
args: ["-m", "not snap"]
pass_filenames: false
language: system
types: [ python ]
types: [python]
require_serial: true

- repo: https://github.com/python-poetry/poetry
rev: '1.8.3'
hooks:
- id: poetry-export
stages: [commit]
name: poetry-export-server
args:
- --output=requirements-server.txt
Expand Down
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async-timeout = { version = "^4.0.3", markers = "python_version < '3.11'" }
backports-strenum = { version = "^1.2.8", markers = "python_version < '3.11'" }
sentry-sdk = "^2.8.0"
aioprometheus = {version = "^23.3.0", optional = true}
copykitten = { version = "^1.2.0", optional = true }
copykitten = { version = "^1.2.1", optional = true }
tenacity = { version = "^8.4.1", optional = true }
pymitter = "^0.5.1"
sentry-offline-transport = { version = "^1.0.0", optional = true }
Expand All @@ -67,6 +67,8 @@ line-length = 100
profile = "black"

[tool.mypy]
strict = true
warn_no_return = false
plugins = [
"pydantic.mypy"
]
Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ pass_env =
DISPLAY
commands =
pytest tests/

[gh]
python =
3.12 = py312
3.11 = py311
3.10 = py310

0 comments on commit 12f15f2

Please sign in to comment.