Skip to content

Commit

Permalink
Test docker and nerdctl
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Mar 2, 2024
1 parent c714b06 commit 9e2ef33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
fail-fast: false
matrix:
python_version: ["3.9"]
container_engine:
- podman
repo_type:
# Only test a subset of the repo2docker tests since we're testing podman,
# not the full repo2docker functionality
Expand All @@ -33,6 +35,19 @@ jobs:
# - r
- unit
- venv/default
include:
- python_version: "3.11"
container_engine: docker
repo_type: base
- python_version: "3.11"
container_engine: docker
repo_type: venv/default
- python_version: "3.11"
container_engine: nerdctl
repo_type: base
- python_version: "3.11"
container_engine: nerdctl
repo_type: venv/default

steps:
- name: Checkout repo
Expand Down Expand Up @@ -67,7 +82,10 @@ jobs:
done
- name: Run tests
run: pytest -v tests/${{ matrix.repo_type }}
run: |
export CONTAINER_ENGINE=${{ matrix.container_engine }}
which $CONTAINER_ENGINE
pytest -v tests/${{ matrix.repo_type }}
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
publish-pypi:
Expand Down
8 changes: 6 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from repo2docker.__main__ import make_r2d


CONTAINER_ENGINE = os.getenv("CONTAINER_ENGINE")


def pytest_collect_file(parent, path):
if path.basename == "verify":
return LocalRepo.from_parent(parent, fspath=path)
Expand Down Expand Up @@ -99,9 +102,10 @@ def collect(self):
args = [
"--appendix",
'RUN echo "appendix" > /tmp/appendix',
"--engine",
"podman",
"--engine=podman",
]
if CONTAINER_ENGINE:
args.append(f"--PodmanEngine.podman_executable={CONTAINER_ENGINE}")
# If there's an extra-args.yaml file in a test dir, assume it contains
# a yaml list with extra arguments to be passed to repo2docker
extra_args_path = os.path.join(self.fspath.dirname, "extra-args.yaml")
Expand Down

0 comments on commit 9e2ef33

Please sign in to comment.