diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 0324015..f7b075c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -9,12 +9,17 @@ on: pull_request: types: [ opened, synchronize, reopened ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -22,18 +27,20 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + cache: pip - name: Install make run: sudo apt-get install make - name: Install Hatch uses: pypa/hatch@install - name: unit test run: | - make test + hatch test -py ${{ matrix.python-version }} + - name: lint + run: | + hatch run +py=${{ matrix.python-version }} e2e:lint - name: e2e test run: | - hatch env create - . "$(hatch env find)/bin/activate" + hatch env create "e2e.py${{ matrix.python-version }}" + . "$(hatch env find "e2e.py${{ matrix.python-version }}")/bin/activate" + python -V make ci - - name: lint - run: | - make lint diff --git a/Makefile b/Makefile index 9dcfc4c..edfb2ef 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # Run tests using the 'test' environment defined in pyproject.toml test: - hatch run test + hatch test # Build the documentation using the 'docs' environment docs: diff --git a/pyproject.toml b/pyproject.toml index 012c66f..36b6781 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,24 +33,11 @@ jsonknife = "dictknife.commands.jsonknife:main" swaggerknife = "dictknife.commands.swaggerknife:main" [project.optional-dependencies] -testing = [ - "ruamel.yaml", - "jsonpatch", - "pytest", -] lint = ["flake8", "black", "mypy"] docs = ["sphinx", "recommonmark", "sphinx_rtd_theme"] load = ["ruamel.yaml", "tomlkit"] command = ["ruamel.yaml", "magicalimport", "prestring"] spreadsheet = ["google-api-python-client", "google-auth-oauthlib"] -dev = [ - "dictknife[testing]", - "dictknife[lint]", - "dictknife[load]", - "dictknife[command]", -# "dictknife[docs]", -# "dictknife[spreadsheet]", -] [tool.hatch.version] path = "src/dictknife/__version__.py" @@ -63,10 +50,13 @@ packages = ["src/dictknife"] [tool.hatch.envs.default] description = "Default environment for everyday tasks" dependencies = [ - "dictknife[dev]", + "dictknife[lint]", + "dictknife[load]", + "dictknife[command]", +# "dictknife[docs]", +# "dictknife[spreadsheet]", ] [tool.hatch.envs.default.scripts] -test = "pytest {args:src/dictknife/tests}" lint = "flake8 --show-source --ignore=E501,E121,W503 src/dictknife" type-check = "mypy --ignore-missing-imports --check-untyped-defs --no-strict-optional src/dictknife" format = "black src/dictknife" @@ -79,12 +69,21 @@ all = [ "test", ] -[tool.hatch.envs.test] +[tool.hatch.envs.hatch-test] dependencies = [ - "dictknife[testing]" + "ruamel.yaml", + "jsonpatch", + "pytest", ] +default-args = ["src/dictknife/tests"] + +[[tool.hatch.envs.hatch-test.matrix]] +python = ["3.10", "3.11", "3.12", "3.13"] + +# e2e +[tool.hatch.envs.e2e] -[[tool.hatch.envs.test.matrix]] +[[tool.hatch.envs.e2e.matrix]] python = ["3.10", "3.11", "3.12", "3.13"] # TODO: remove