Use latest hatch, with `hatch fmt` and `hatch test`
Also, just use Python 3.11.x - not a specific version - in CI. Signed-off-by: Nic Cope <nicc@rk0n.org>
This commit is contained in:
parent
34ed177048
commit
3268b9c0dc
|
@ -14,7 +14,8 @@ on:
|
|||
|
||||
env:
|
||||
# Common versions
|
||||
PYTHON_VERSION: '3.11.5'
|
||||
PYTHON_VERSION: '3.11'
|
||||
HATCH_VERSION: '1.12.0'
|
||||
DOCKER_BUILDX_VERSION: 'v0.11.2'
|
||||
|
||||
# These environment variables are important to the Crossplane CLI install.sh
|
||||
|
@ -47,10 +48,10 @@ jobs:
|
|||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Setup Hatch
|
||||
run: pipx install hatch==1.7.0
|
||||
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||
|
||||
- name: Lint
|
||||
run: hatch run lint:check
|
||||
run: hatch fmt
|
||||
|
||||
unit-test:
|
||||
runs-on: ubuntu-22.04
|
||||
|
@ -64,10 +65,10 @@ jobs:
|
|||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Setup Hatch
|
||||
run: pipx install hatch==1.7.0
|
||||
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: hatch run test:unit
|
||||
run: hatch test --all --randomize
|
||||
|
||||
# We want to build most packages for the amd64 and arm64 architectures. To
|
||||
# speed this up we build single-platform packages in parallel. We then upload
|
||||
|
|
|
@ -25,11 +25,11 @@ CLI][cli] to build functions.
|
|||
# Run the code in development mode, for crossplane beta render
|
||||
hatch run development
|
||||
|
||||
# Lint the code - see pyproject.toml
|
||||
hatch run lint:check
|
||||
# Lint and format the code - see pyproject.toml
|
||||
hatch fmt
|
||||
|
||||
# Run unit tests - see tests/test_fn.py
|
||||
hatch run test:unit
|
||||
hatch test
|
||||
|
||||
# Build the function's runtime image - see Dockerfile
|
||||
$ docker build . --tag=runtime
|
||||
|
|
|
@ -48,21 +48,10 @@ dependencies = ["ipython==8.28.0"]
|
|||
[tool.hatch.envs.default.scripts]
|
||||
development = "python function/main.py --insecure --debug"
|
||||
|
||||
[tool.hatch.envs.lint]
|
||||
type = "virtual"
|
||||
detached = true
|
||||
path = ".venv-lint"
|
||||
# This special environment is used by hatch fmt.
|
||||
[tool.hatch.envs.hatch-static-analysis]
|
||||
dependencies = ["ruff==0.6.9"]
|
||||
|
||||
[tool.hatch.envs.lint.scripts]
|
||||
check = "ruff check function tests && ruff format --diff function tests"
|
||||
|
||||
[tool.hatch.envs.test]
|
||||
type = "virtual"
|
||||
path = ".venv-test"
|
||||
|
||||
[tool.hatch.envs.test.scripts]
|
||||
unit = "python -m unittest tests/*.py"
|
||||
config-path = "none" # Disable Hatch's default Ruff config.
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py311"
|
||||
|
|
Loading…
Reference in New Issue