Skip to content

Commit

Permalink
build: remove duty again
Browse files Browse the repository at this point in the history
  • Loading branch information
15r10nk committed Dec 31, 2024
1 parent 4170c03 commit 2628012
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 28 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{matrix.python-version}}

- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- uses: ./.github/actions/setup
with:
python-version: ${{matrix.python-version}}
architecture: x64
allow-prereleases: true
- run: uv run duty check_types
- run: uvx hatch run +py=${{matrix.python-version}} types:check

test:
runs-on: ubuntu-latest
Expand All @@ -34,15 +26,21 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', pypy3.9, pypy3.10]
os: [ubuntu-latest, windows-latest, macos-13]
extra_deps: ['"--with=pytest==8.3.3" "--with=pydantic<2"', '"--with=pytest>=8.3.4" "--with=pydantic>2"']
env:
TOP: ${{github.workspace}}
COVERAGE_PROCESS_START: ${{github.workspace}}/pyproject.toml
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
with:
python-version: ${{matrix.python-version}}

- run: |
uv run ${{matrix.extra_deps}} duty test ${{ matrix.os == 'ubuntu-latest' && 'coverage=True' }}
uv run ${{matrix.extra_deps}} -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto
- run: |
uv run -m coverage combine
mv .coverage .coverage.${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
if: matrix.os == 'ubuntu-latest'
- name: Upload coverage data
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
Expand All @@ -62,15 +60,7 @@ jobs:

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.12'

- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
# Use latest Python, so it understands all syntax.
python-version: '3.12'
- uses: ./.github/actions/setup

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand Down Expand Up @@ -114,6 +104,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: ./.github/actions/setup

- name: Check if the commit has a vx.y.z tag
id: check-version
Expand All @@ -126,7 +117,7 @@ jobs:
echo "should_continue=false" >> "$GITHUB_OUTPUT"
fi
- run: pip install hatch scriv
- run: uv pip install hatch scriv

- name: build package
run: hatch build
Expand Down
64 changes: 57 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ version = "0.18.1"

[dependency-groups]
dev = [
"duty>=1.4.2",
"hypothesis>=6.75.5",
"mypy>=1.2.0",
"pyright>=1.1.359",
Expand Down Expand Up @@ -104,6 +103,8 @@ dependencies = [
"pytest",
"black"
]
[tool.hatch.envs.default]
installer="uv"

[tool.hatch.envs.docs.scripts]
build = "mkdocs build --strict"
Expand All @@ -115,18 +116,73 @@ serve = "mkdocs serve"
dependencies=["cogapp","lxml","requests"]
scripts.update="cog -r docs/**.md"

[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.13", "3.12", "3.11", "3.8","pypy3.9","pypy3.10"]
extra-deps=["low","hight"]

[tool.hatch.envs.hatch-test.overrides]
matrix.extra-deps.dependencies = [
{ value = "pytest==8.3.3", if = ["low"] },
{ value = "pytest>=8.3.4", if = ["hight"] },
{ value = "pydantic<2", if = ["low"] },
{ value = "pydantic>=2", if = ["hight"] },
]

[tool.hatch.envs.hatch-test]
extra-dependencies = [
"dirty-equals>=0.7.0",
"hypothesis>=6.75.5",
"mypy>=1.2.0",
"pyright>=1.1.359",
"pytest-subtests>=0.11.0",
"pytest-freezer>=0.4.8",
"pytest-mock>=3.14.0"
]
env-vars.TOP = "{root}"

[tool.hatch.envs.hatch-test.scripts]
run = "pytest{env:HATCH_TEST_ARGS:} --use-uv {args}"
run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} --use-uv {args}"
cov-combine = "coverage combine"
cov-report=["coverage report","coverage html"]

[tool.hatch.envs.types]
extra-dependencies = [
"mypy>=1.0.0",
"pytest",
"hypothesis>=6.75.5",
"pydantic",
"attrs"
]

[[tool.hatch.envs.types.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12","3.13"]

[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:src/inline_snapshot tests}"

[tool.mypy]
exclude = "tests/.*_samples"

[tool.pyright]
venv = "test-3-12"
venvPath = ".nox"


[tool.hatch.envs.release]
detached=true
dependencies=[
"scriv",
"commitizen"
]

[tool.hatch.envs.release.scripts]
create=[
"scriv collect",
"- pre-commit run -a",
"cz bump"
]

publish=[
"git push --force-with-lease",
"git push --tags",
Expand All @@ -140,12 +196,6 @@ publish-package=[
"scriv github-release"
]

[tool.mypy]
exclude = "tests/.*_samples"

[tool.pyright]
venv = "test-3-12"
venvPath = ".nox"


[tool.scriv]
Expand Down

0 comments on commit 2628012

Please sign in to comment.