Skip to content

Commit

Permalink
Merge pull request #110 from 15r10nk/3.13
Browse files Browse the repository at this point in the history
feat: 3.13 support
  • Loading branch information
15r10nk authored Sep 10, 2024
2 parents 9d67e5f + af77102 commit cfc0e47
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 35 deletions.
75 changes: 46 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,84 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{matrix.python-version}}
architecture: x64
allow-prereleases: true
- run: pip install hatch
- run: hatch run +py=${{matrix.python-version}} types:check

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{matrix.python-version}}
architecture: x64
allow-prereleases: true
- run: pip install hatch
- run: hatch test -cp -py ${{matrix.python-version}}

- name: rename coverage files
run: |
- run: |
hatch test -cp -py ${{matrix.python-version}}
mv .coverage .coverage.${{ matrix.python-version }}.${{matrix.os}}
if: matrix.os == 'ubuntu-latest'
- run: hatch test -p -py ${{matrix.python-version}}
if: matrix.os != 'ubuntu-latest'

- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: coverage
name: coverage-data-${{ matrix.python-version }}-${{matrix.os}}
path: .coverage.*
include-hidden-files: true
if-no-files-found: ignore

combine_coverage:
name: combine coverage and check for 100%
coverage:
name: Combine & check coverage
env:
TOP: ${{github.workspace}}
if: always()
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.11'
architecture: x64
# Use latest Python, so it understands all syntax.
python-version: '3.12'

- name: Download coverage data
uses: actions/download-artifact@v3
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: coverage
pattern: coverage-data-*
merge-multiple: true

- name: Combine data
env:
TOP: ${{github.workspace}}
- name: Combine coverage & fail if it's <100%
run: |
rm .coverage.*.windows-latest
rm .coverage.*.macos-13
pip install coverage
coverage combine
coverage html
coverage report --fail-under 100
python -Im pip install --upgrade coverage[toml]
python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
# Report and write to summary.
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
# Report again and fail if under 100%.
python -Im coverage report --fail-under=100
- name: Upload HTML report if check failed
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: html-report
path: htmlcov
if: ${{ failure() }}
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- run: pip install hatch
- run: hatch run docs:export-deps > doc_requirements.txt

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
uses: mhausenblas/mkdocs-deploy-gh-pages@d77dd03172e96abbcdb081d8c948224762033653 # 1.26
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
name: build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.12'
architecture: x64
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: MIT License",
Expand All @@ -26,7 +27,7 @@ dependencies = [
"asttokens>=2.0.5",
"black>=23.3.0",
"click>=8.1.4",
"executing>=2.0.0",
"executing>=2.1.0",
"rich>=13.7.1",
"toml>=0.10.2",
"types-toml>=0.10.8.7",
Expand Down Expand Up @@ -101,6 +102,9 @@ deploy = "mkdocs gh-deploy"
export-deps = "pip freeze"
serve = "mkdocs serve"

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

[tool.hatch.envs.hatch-test]
extra-dependencies = [
"dirty-equals>=0.7.0",
Expand All @@ -122,7 +126,7 @@ extra-dependencies = [
]

[[tool.hatch.envs.types.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
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}"
Expand Down
5 changes: 5 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import platform
import re
import sys
import textwrap
from pathlib import Path

Expand All @@ -11,6 +12,10 @@
platform.system() == "Windows",
reason="\\r in stdout can cause problems in snapshot strings",
)
@pytest.mark.skipif(
sys.version_info[:2] != (3, 12),
reason="\\r in stdout can cause problems in snapshot strings",
)
@pytest.mark.parametrize(
"file",
[
Expand Down

0 comments on commit cfc0e47

Please sign in to comment.