File tree Expand file tree Collapse file tree 3 files changed +12
-22
lines changed
Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change 1414
1515env :
1616 # Common versions
17- PYTHON_VERSION : ' 3.11.5'
17+ PYTHON_VERSION : ' 3.11'
18+ HATCH_VERSION : ' 1.12.0'
1819 DOCKER_BUILDX_VERSION : ' v0.11.2'
1920
2021 # These environment variables are important to the Crossplane CLI install.sh
@@ -47,10 +48,10 @@ jobs:
4748 python-version : ${{ env.PYTHON_VERSION }}
4849
4950 - name : Setup Hatch
50- run : pipx install hatch==1.7.0
51+ run : pipx install hatch==${{ env.HATCH_VERSION }}
5152
5253 - name : Lint
53- run : hatch run lint:check
54+ run : hatch fmt
5455
5556 unit-test :
5657 runs-on : ubuntu-22.04
@@ -64,10 +65,10 @@ jobs:
6465 python-version : ${{ env.PYTHON_VERSION }}
6566
6667 - name : Setup Hatch
67- run : pipx install hatch==1.7.0
68+ run : pipx install hatch==${{ env.HATCH_VERSION }}
6869
6970 - name : Run Unit Tests
70- run : hatch run test:unit
71+ run : hatch test --all --randomize
7172
7273 # We want to build most packages for the amd64 and arm64 architectures. To
7374 # speed this up we build single-platform packages in parallel. We then upload
Original file line number Diff line number Diff line change @@ -25,11 +25,11 @@ CLI][cli] to build functions.
2525# Run the code in development mode, for crossplane beta render
2626hatch run development
2727
28- # Lint the code - see pyproject.toml
29- hatch run lint:check
28+ # Lint and format the code - see pyproject.toml
29+ hatch fmt
3030
3131# Run unit tests - see tests/test_fn.py
32- hatch run test:unit
32+ hatch test
3333
3434# Build the function's runtime image - see Dockerfile
3535$ docker build . --tag=runtime
Original file line number Diff line number Diff line change @@ -48,21 +48,10 @@ dependencies = ["ipython==8.28.0"]
4848[tool .hatch .envs .default .scripts ]
4949development = " python function/main.py --insecure --debug"
5050
51- [tool .hatch .envs .lint ]
52- type = " virtual"
53- detached = true
54- path = " .venv-lint"
51+ # This special environment is used by hatch fmt.
52+ [tool .hatch .envs .hatch-static-analysis ]
5553dependencies = [" ruff==0.6.9" ]
56-
57- [tool .hatch .envs .lint .scripts ]
58- check = " ruff check function tests && ruff format --diff function tests"
59-
60- [tool .hatch .envs .test ]
61- type = " virtual"
62- path = " .venv-test"
63-
64- [tool .hatch .envs .test .scripts ]
65- unit = " python -m unittest tests/*.py"
54+ config-path = " none" # Disable Hatch's default Ruff config.
6655
6756[tool .ruff ]
6857target-version = " py311"
You can’t perform that action at this time.
0 commit comments