Skip to content

Commit

Permalink
Upgrade to V3 of CI base image.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpfleming committed Jun 5, 2024
1 parent c64ca1a commit d811795
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- id: details
uses: kpfleming/composite-actions/image-details@v2
with:
base_image: python:bookworm-main
base_image: python:v3-bookworm-main
- id: preflight
uses: kpfleming/composite-actions/ci-preflight@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: hatch build -t wheel
shell: bash
- name: install project
run: hatch run ci.py${{ inputs.python }}:pip install dist/*.whl
run: hatch run ci.py${{ inputs.python }}:uv pip install dist/*.whl
shell: bash
- name: run tests
run: hatch run ci.py${{ inputs.python }}:ci
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ packages = [

[tool.hatch.envs.default]
python = "3.12"
installer = "uv"
python-sources = [
"external",
]

[tool.hatch.envs.lint]
dependencies = [
Expand Down Expand Up @@ -123,12 +127,11 @@ python = [
"3.10",
"3.11",
"3.12",
"3.13",
]

[tool.hatch.envs.ci.scripts]
ci = [
"pip install ./plugin_example",
"uv pip install ./plugin_example",
"rm -f .coverage",
"pytest --verbose --cov-append --cov-branch --cov=jinjanator_plugins",
"coverage report --show-missing --fail-under=100",
Expand Down
28 changes: 10 additions & 18 deletions workflow-support/make_ci_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ image_name=${1}; shift
dist_name=${1}; shift

lint_deps=(shellcheck)
proj_deps=(libsqlite3-0)
proj_build_deps=(build-essential libc6-dev pkg-config)
proj_deps=()
proj_build_deps=()

hatchenvs=(lint ci)
cimatrix=(3.8 3.9 3.10 3.11 3.12 3.13)

c=$(buildah from "${base_image}")

Expand All @@ -41,27 +40,20 @@ build_cmd apt install --yes --quiet=2 "${lint_deps[@]}" "${proj_deps[@]}" "${pro
for env in "${hatchenvs[@]}"; do
# this looks weird... but it causes Hatch to create the env,
# install all of the project's dependencies and the project,
# then runs pip to uninstall the project, leaving the env
# then runs 'uv pip' to uninstall the project, leaving the env
# in place with the dependencies
case "${env}" in
ci*)
for py in "${cimatrix[@]}"; do
build_cmd_with_source hatch env create "${env}.py${py}"
build_cmd_with_source hatch -e "${env}.py${py}" run pip uninstall --yes "${dist_name}"
done
;;
*)
build_cmd_with_source hatch env create "${env}"
build_cmd_with_source hatch -e "${env}" run pip uninstall --yes "${dist_name}"
;;
esac
build_cmd_with_source hatch env create "${env}"
build_cmd_with_source hatch -e "${env}" run uv pip uninstall "${dist_name}"
done

build_cmd apt remove --yes --purge "${proj_build_deps[@]}"
if [ -n "${proj_build_deps[*]}" ]
then
build_cmd apt remove --yes --purge "${proj_build_deps[@]}"
fi
build_cmd apt autoremove --yes --purge
build_cmd apt clean autoclean
build_cmd sh -c "rm -rf /var/lib/apt/lists/*"
build_cmd rm -rf /root/.cache
build_cmd uv cache clean

if buildah images --quiet "${image_name}"; then
buildah rmi "${image_name}"
Expand Down
2 changes: 1 addition & 1 deletion workflow-support/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
versions={"python": ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]}
versions={"python": ["3.8", "3.9", "3.10", "3.11", "3.12"]}

0 comments on commit d811795

Please sign in to comment.