Skip to content

Commit 1435560

Browse files
bkalashnikovbogdandm
bkalashnikov
authored andcommittedOct 24, 2024
Modernize project setup and setup cron action job
1 parent e2606e8 commit 1435560

File tree

7 files changed

+115
-24
lines changed

7 files changed

+115
-24
lines changed
 

‎.github/actions/test/action.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Test'
2+
3+
inputs:
4+
python-version:
5+
description: 'Python version to test with'
6+
required: true
7+
type: string
8+
pytest-args:
9+
description: 'pytest args to test with'
10+
required: false
11+
default: ''
12+
type: string
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Set up Python ${{ inputs.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ inputs.python-version }}
21+
- name: Install dependencies
22+
shell: bash
23+
run: |
24+
python -m pip install --upgrade pip build
25+
python -m build
26+
python -m pip install '.[test]'
27+
python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage
28+
pip install --ignore-installed pytest>=4.4.0
29+
pytest --version
30+
- name: Test with pytest
31+
shell: bash
32+
run: |
33+
pytest ${{ inputs.pytest-args }} -m "not no_expected" test/

‎.github/workflows/test_and_release.yml

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
name: Build 📦
22

3-
on: [ push, pull_request ]
3+
on:
4+
- push
5+
- pull_request
46

57
jobs:
68
test:
79
runs-on: ubuntu-latest
810
strategy:
911
fail-fast: false
1012
matrix:
11-
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
13+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
1214

1315
steps:
1416
- uses: actions/checkout@v2
15-
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
17+
- name: Test
18+
uses: ./.github/actions/test
1719
with:
1820
python-version: ${{ matrix.python-version }}
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
python setup.py sdist
23-
python setup.py install
24-
python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage
25-
pip install --ignore-installed pytest>=4.4.0
26-
pytest --version
27-
- name: Test with pytest
28-
run: |
29-
python setup.py test -a '--cov-config .coveragerc --cov=json_to_models -m "not no_expected" test/'
21+
pytest-args: '--cov-config .coveragerc --cov=json_to_models'
3022
- name: Coverage
3123
env:
3224
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/test_every_week.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test every month
2+
3+
on:
4+
schedule:
5+
- cron: "0 * * * *"
6+
# - cron: "0 0 1 * *"
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Test
19+
uses: ./.github/actions/test
20+
with:
21+
python-version: ${{ matrix.python-version }}

‎pyproject.toml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "json2python-models"
7+
description = "Python models (pydantic, attrs, dataclasses or custom) generator from JSON data with typing module support"
8+
readme = "README.md"
9+
license = { text = "MIT" }
10+
requires-python = ">=3.8"
11+
authors = [
12+
{ name = "bogdandm (Bogdan Kalashnikov)", email = "bogdan.dm1995@yandex.ru" }
13+
]
14+
dynamic = ['version', 'dependencies']
15+
16+
[project.urls]
17+
"Repository" = "https://github.com/bogdandm/json2python-models"
18+
19+
[project.optional-dependencies]
20+
test = [
21+
"pytest>=4.4.0",
22+
"pytest-xdist",
23+
"requests",
24+
"attrs",
25+
"pydantic>=1.3",
26+
"ruamel.yaml"
27+
]
28+
29+
[project.scripts]
30+
json2models = "json_to_models.cli:main"
31+
32+
[tool.setuptools]
33+
packages = { find = { exclude = ["test", "testing_tools"] } }
34+
35+
[tool.setuptools.dynamic]
36+
dependencies = { file = ["requirements.txt"] }
37+
version = { attr = "json_to_models.__version__" }
38+
readme = { file = ['README.md'] }
39+
40+
[tool.setuptools.package-data]
41+
"*" = ['*.txt.', '*.ini', ".coveragerc", "LICENSE", "*.md"]
42+
43+
[tool.pytest.ini_options]
44+
#addopts = "-n 4"
45+
testpaths = ["tests"]
46+
markers = [
47+
"no_expected: testing data has no expected value",
48+
"slow_http: api that provides testing data is slow"
49+
]

‎pytest.ini

-4
This file was deleted.

‎requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
python-dateutil>=2.7.*
2-
inflection>=0.3.*
3-
unidecode>=1.0.*
4-
Jinja2>=2.10.*
1+
python-dateutil>=2.7
2+
inflection>=0.3
3+
unidecode>=1.0
4+
Jinja2>=2.10
55
ordered-set==4.*
6-
typing-extensions>=3.1.*
6+
typing-extensions>=3.1

‎setup.py ‎setup.py.backup

File renamed without changes.

0 commit comments

Comments
 (0)
Failed to load comments.