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 04c359b commit bb0c672
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
26 changes: 25 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 All @@ -45,6 +60,12 @@ jobs:
cache: pip
cache-dependency-path: dev-requirements.txt

- name: Install nerdctl
if: matrix.container_engine == 'nerdctl'
run: |
NERDCTL_VERSION=1.7.4
curl -sfL https://github.com/containerd/nerdctl/releases/download/v$NERDCTL_VERSION/nerdctl-full-$NERDCTL_VERSION-linux-amd64.tar.gz | tar -zxvf - -C /usr/local
- name: Install
run: |
pip install -r dev-requirements.txt
Expand All @@ -67,7 +88,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 bb0c672

Please sign in to comment.