Skip to content

Commit

Permalink
build: move to tox (#29)
Browse files Browse the repository at this point in the history
* chore: add pre-commits

* build: add tox

* build: test macos and Windows

* chore: test tox-uv

* chore: move tox-uv

* chore: fixup
  • Loading branch information
GabDug committed Apr 1, 2024
1 parent 7e08191 commit d7aeec6
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 91 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
# Empty is latest, head is latest from GitHub
pdm-version: ["", "head", "2.7.4", "2.8.2", "2.9.3", "2.10.4", "2.11.2", "2.12.2"]
pdm-version: [""]
os: [ubuntu-latest]
include:
- os: macOS-latest
python-version: '3.12'
pdm-version: ""
- os: windows-latest
python-version: '3.12'
pdm-version: ""

steps:
- uses: actions/checkout@v4
Expand All @@ -30,13 +38,12 @@ jobs:
with:
cache: true
python-version: ${{ matrix.python-version }} # Version range or exact version of a Python version to use, the same as actions/setup-python
architecture: x64 # The target architecture (x86, x64) of the Python interpreter. the same as actions/setup-python
version: ${{ matrix.pdm-version }} # The version of PDM to install. Leave it as empty to use the latest version from PyPI, or 'head' to use the latest version from GitHub
prerelease: true # Allow prerelease versions of PDM to be installed
enable-pep582: false # Enable PEP 582 package loading globally
allow-python-prereleases: true # Allow prerelease versions of Python to be installed. For example if only 3.12-dev is available, 3.12 will fall back to 3.12-dev
- name: Set Cache Variables
id: set_variables
shell: bash
run: |
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT
echo "PDM_CACHE=$(pdm config cache_dir)" >> $GITHUB_OUTPUT
Expand All @@ -50,24 +57,11 @@ jobs:

- name: Install dependencies
run: |
pdm config venv.with_pip True
pdm install -G :all --dev
pdm venv activate in-project
source .venv/bin/activate
# Get the pip command to run depending on matrix.pdm-version
# We force reinstall of pdm in the virtualenv
if [[ "${{ matrix.pdm-version }}" == "head" ]]; then
pip install "pdm @ git+https://github.com/pdm-project/pdm"
elif [[ "${{ matrix.pdm-version }}" == "" ]]; then
pip install pdm
else
pip install pdm==${{ matrix.pdm-version }}
fi
- name: Run Test with tox
run: pdm run tox

- name: Test with pytest
run: |
pdm run test-cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand All @@ -86,3 +80,9 @@ jobs:
pdm build
# Do not upload to PyPI, here we only want to check that the build works
# XXX Check valid wheels?


- name: Check Python package
uses: hynek/build-and-inspect-python-package@v2
with:
upload-name-suffix: -${{ matrix.python-version }}-${{ matrix.os }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ cython_debug/
junit
.pdm-build
src/sync_pre_commit_lock/_version.py
requirements-tox.txt
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ repos:
- id: check-merge-conflict
- id: fix-byte-order-marker

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-github-workflows
args: ["--verbose"]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--write-changes", "--skip=pdm.lock"]

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.1"
hooks:
- id: tox-ini-fmt

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.7.0"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.14.1"]

- repo: local
hooks:
- id: export-supported-packages-to-readme
Expand All @@ -28,3 +51,9 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pdm-project/pdm
rev: 2.13.2
hooks:
- id: pdm-lock-check
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pdm 2.12.2
python 3.12.1
pdm 2.13.2
python 3.12.2 3.11.8 3.10.13 3.9.18
155 changes: 139 additions & 16 deletions pdm.lock

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

Loading

0 comments on commit d7aeec6

Please sign in to comment.