Skip to content

Commit

Permalink
Tag container by python version
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed Sep 16, 2023
1 parent 1fa5bcb commit ace88d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
uses: actions/cache@v3
with:
path: container-test-template-cache
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('containers/test-template/**') }}
key: ${{ runner.os }}-test-template-cache-${{ hashFiles('containers/test-template/**') }}

- name: Inject container-test-template-cache into docker
uses: reproducible-containers/[email protected]
Expand Down
3 changes: 2 additions & 1 deletion containers/test-template/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.11.5
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim

# Install and uninstall snakebids to cache it and it's dependences
RUN python -m pip install pipx && \
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,17 @@ pytest --doctest-modules --ignore=docs \
mkinit = "mkinit --recursive --nomods --black -i snakebids"
benchmark = "pytest --benchmark-only --benchmark-autosave"

[tool.poe.tasks._get_version]
imports = ["platform"]
expr = "platform.python_version()"

[tool.poe.tasks.build-container]
args = [{ name = "container_id", positional = true, required = true }]
uses = { VERSION = "_get_version"}
cmd = """
docker build 'containers/${container_id}' \
--tag 'snakebids/${container_id}:dev'
--tag 'snakebids/${container_id}:${VERSION}' \
--build-arg="PYTHON_VERSION=${VERSION}"
"""

[tool.isort]
Expand Down
3 changes: 2 additions & 1 deletion snakebids/tests/test_template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import platform
import subprocess as sp
from pathlib import Path

Expand All @@ -11,7 +12,7 @@
from snakebids.tests.helpers import needs_docker


@needs_docker("snakebids/test-template:dev")
@needs_docker(f"snakebids/test-template:{platform.python_version()}")
@pytest.mark.parametrize(
["build", "venv"],
[
Expand Down

0 comments on commit ace88d7

Please sign in to comment.