Skip to content

Commit f85233f

Browse files
authored
Fix ci (#154)
* Migrate to pyproject.toml and Git versioning * Use shared PyPi release workflow * Remove release drafter config * add ci.yml * add requirements_test.txt * add matchers * fix py3.12 tests * fix ci.yml * increase minimum coverage * Update PYTHON_VERSION_DEFAULT
1 parent 685a664 commit f85233f

16 files changed

+181
-125
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
# yamllint disable-line rule:truthy
4+
on:
5+
push:
6+
pull_request: ~
7+
8+
jobs:
9+
shared-ci:
10+
uses: zigpy/workflows/.github/workflows/ci.yml@main
11+
with:
12+
CODE_FOLDER: zigpy_xbee
13+
CACHE_VERSION: 2
14+
PYTHON_VERSION_DEFAULT: 3.9.15
15+
PRE_COMMIT_CACHE_PATH: ~/.cache/pre-commit
16+
MINIMUM_COVERAGE_PERCENTAGE: 99
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codespell",
5+
"severity": "warning",
6+
"pattern": [
7+
{
8+
"regexp": "^(.+):(\\d+):\\s(.+)$",
9+
"file": 1,
10+
"line": 2,
11+
"message": 3
12+
}
13+
]
14+
}
15+
]
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "flake8-error",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(.*):(\\d+):(\\d+):\\s([EF]\\d{3}\\s.*)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"message": 4
13+
}
14+
]
15+
},
16+
{
17+
"owner": "flake8-warning",
18+
"severity": "warning",
19+
"pattern": [
20+
{
21+
"regexp": "^(.*):(\\d+):(\\d+):\\s([CDNW]\\d{3}\\s.*)$",
22+
"file": 1,
23+
"line": 2,
24+
"column": 3,
25+
"message": 4
26+
}
27+
]
28+
}
29+
]
30+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "python",
5+
"pattern": [
6+
{
7+
"regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$",
8+
"file": 1,
9+
"line": 2
10+
},
11+
{
12+
"regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
13+
"message": 2
14+
}
15+
]
16+
}
17+
]
18+
}
Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
1-
name: Publish distributions to PyPI and TestPyPI
1+
name: Publish distributions to PyPI
22
on:
3-
push:
4-
tags:
5-
- "*"
3+
release:
4+
types:
5+
- published
66

77
jobs:
8-
build-and-publish:
9-
name: Build and publish distributions to PyPI and TestPyPI
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python 3.8
14-
uses: actions/setup-python@v1
15-
with:
16-
version: 3.8
17-
- name: Install wheel
18-
run: >-
19-
pip install wheel
20-
- name: Build
21-
run: >-
22-
python3 setup.py sdist bdist_wheel
23-
- name: Publish distribution to PyPI
24-
uses: pypa/gh-action-pypi-publish@master
25-
with:
26-
password: ${{ secrets.PYPI_TOKEN }}
8+
shared-build-and-publish:
9+
uses: zigpy/workflows/.github/workflows/publish-to-pypi.yml@main
10+
secrets:
11+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/release-management.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ ENV/
6868

6969
# Editor temp files
7070
.*.swp
71+
tags
7172

7273
# Visual Studio Code
73-
.vscode
74+
.vscode

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ repos:
1010
rev: 6.0.0
1111
hooks:
1212
- id: flake8
13+
additional_dependencies:
14+
- Flake8-pyproject==1.2.3
1315
- repo: https://github.com/PyCQA/isort
1416
rev: 5.12.0
1517
hooks:

pyproject.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0.0", "wheel", "setuptools-git-versioning<2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "zigpy-xbee"
7+
dynamic = ["version"]
8+
description = "A library which communicates with XBee radios for zigpy"
9+
urls = {repository = "https://github.com/zigpy/zigpy-xbee"}
10+
authors = [
11+
{name = "Russell Cloran", email = "rcloran@gmail.com"}
12+
]
13+
readme = "README.md"
14+
license = {text = "GPL-3.0"}
15+
requires-python = ">=3.8"
16+
dependencies = [
17+
"zigpy>=0.56.0",
18+
]
19+
20+
[tool.setuptools.packages.find]
21+
exclude = ["tests", "tests.*"]
22+
23+
[project.optional-dependencies]
24+
testing = [
25+
"pytest>=7.1.2",
26+
"asynctest>=0.13.0",
27+
"pytest-asyncio>=0.19.0",
28+
]
29+
30+
[tool.setuptools-git-versioning]
31+
enabled = true
32+
33+
[tool.isort]
34+
profile = "black"
35+
# will group `import x` and `from x import` of the same module.
36+
force_sort_within_sections = true
37+
known_first_party = ["zigpy_xbee", "tests"]
38+
forced_separate = "tests"
39+
combine_as_imports = true
40+
41+
[tool.mypy]
42+
ignore_errors = true
43+
44+
[tool.pytest.ini_options]
45+
asyncio_mode = "auto"
46+
47+
[tool.flake8]
48+
exclude = [".venv", ".git", ".tox", "docs", "venv", "bin", "lib", "deps", "build"]
49+
# To work with Black
50+
max-line-length = 88
51+
# W503: Line break occurred before a binary operator
52+
# E203: Whitespace before ':'
53+
# D202 No blank lines allowed after function docstring
54+
ignore = ["W503", "E203", "D202"]

0 commit comments

Comments
 (0)