Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman support on Linux #966

Merged
merged 35 commits into from Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
df317a9
Flattened podman support commits
Erotemic Jun 16, 2022
8dd76aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2022
08bf6bf
Fix bad fmtstring
Erotemic Jun 23, 2022
9c188d7
Merge branch 'new_podman_support' of github.com:Erotemic/cibuildwheel…
Erotemic Jun 23, 2022
65d7068
have doctest use a pinned docker images
Erotemic Jun 23, 2022
90945a3
reworks
Erotemic Jun 26, 2022
4a7d89b
Does podman work with the original host args
Erotemic Jun 26, 2022
1599383
Cleanup
Erotemic Jun 26, 2022
9401c90
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2022
c68223b
Make mypy happy
Erotemic Jun 26, 2022
086ead0
remove missing imports
Erotemic Jun 26, 2022
a86cabc
forgot to monkeypatch a test
Erotemic Jun 26, 2022
fc0db95
more mypy fixes
Erotemic Jun 26, 2022
8d38946
Switch to the simpler podman cp implementation
joerick Jun 27, 2022
d9b4644
Don't need shell for this command
joerick Jun 27, 2022
6a371ac
Refactor the tests to use --run-docker and --run-podman
joerick Jun 27, 2022
38faa27
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2022
de3144a
Remove unused imports
joerick Jun 27, 2022
3bd759f
Add some type safety to the container_engine option
joerick Jun 27, 2022
2457006
Make container-engine a global option, since that's how its being used
joerick Jun 27, 2022
1d2e5d5
Rename DockerContainer -> OCIContainer, and a few other things
joerick Jun 27, 2022
d66c1e9
Lots more naming changes to reflect that containers are not necessari…
joerick Jun 27, 2022
e5ef3c1
Tweak test config to remove always-skipped test
joerick Jun 27, 2022
f23d8aa
Add an integration test for a podman build
joerick Jun 27, 2022
b612a6c
Actually run the podman integration test on podman :)
joerick Jun 27, 2022
22ba00b
Fix missing rename
joerick Jun 27, 2022
12a3fa2
Use tomli_w instead of toml
Erotemic Jun 27, 2022
46678e2
Inlined podman install
Erotemic Jun 27, 2022
062ab6c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2022
f182ed3
Fix spelling
Erotemic Jun 28, 2022
f69fa19
Run podman tests only on linux
joerick Jun 29, 2022
7c56b98
Merge remote-tracking branch 'origin/main' into new_podman_support
joerick Jun 29, 2022
c4bb045
Add docs for CIBW_CONTAINER_ENGINE
joerick Jun 29, 2022
a361670
Pass cwd to first two calls
Erotemic Jun 30, 2022
5e2d02d
Merge branch 'main' into new_podman_support
henryiii Jul 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/test.yml
Expand Up @@ -45,6 +45,18 @@ jobs:
with:
python-version: ${{ matrix.python_version }}

# Install podman on this CI instance for podman tests on linux
# Snippet from: https://github.com/redhat-actions/podman-login/blob/main/.github/workflows/example.yml
- name: Install latest podman
if: runner.os == 'Linux'
run: |
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman

- name: Install dependencies
run: |
python -m pip install ".[test]"
Expand All @@ -68,7 +80,7 @@ jobs:

- name: Test cibuildwheel
run: |
python ./bin/run_tests.py
python ./bin/run_tests.py --run-podman

test-emulated:
name: Test emulated cibuildwheel using qemu
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Expand Up @@ -61,6 +61,7 @@ repos:
- pygithub
- rich
- tomli
- tomli_w
- types-certifi
- types-click
- types-dataclasses
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -130,6 +130,7 @@ Options
| | [`CIBW_BEFORE_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-build) | Execute a shell command preparing each wheel's build |
| | [`CIBW_REPAIR_WHEEL_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command) | Execute a shell command to repair each built wheel |
| | [`CIBW_MANYLINUX_*_IMAGE`<br/>`CIBW_MUSLLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) | Specify alternative manylinux / musllinux Docker images |
| | [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.readthedocs.io/en/stable/options/#container-engine) | Specify which container engine to use when building Linux wheels |
| | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses |
| **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel |
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |
Expand Down
48 changes: 31 additions & 17 deletions bin/run_tests.py
@@ -1,33 +1,47 @@
#!/usr/bin/env python3

import argparse
import os
import subprocess
import sys
from pathlib import Path

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--run-podman", action="store_true", default=False, help="run podman tests (linux only)"
)
args = parser.parse_args()

# move cwd to the project root
os.chdir(Path(__file__).resolve().parents[1])

# run the unit tests
# unit tests
unit_test_args = [sys.executable, "-m", "pytest", "unit_test"]
# run the docker unit tests only on Linux

if sys.platform.startswith("linux"):
# run the docker unit tests only on Linux
unit_test_args += ["--run-docker"]

if args.run_podman:
unit_test_args += ["--run-podman"]

subprocess.run(unit_test_args, check=True)

# run the integration tests
subprocess.run(
[
sys.executable,
"-m",
"pytest",
"--numprocesses=2",
"-x",
"--durations",
"0",
"--timeout=2400",
"test",
],
check=True,
)
# integration tests
integration_test_args = [
sys.executable,
"-m",
"pytest",
"--numprocesses=2",
"-x",
"--durations",
"0",
"--timeout=2400",
"test",
]

if sys.platform.startswith("linux") and args.run_podman:
integration_test_args += ["--run-podman"]

subprocess.run(integration_test_args, check=True)
5 changes: 2 additions & 3 deletions cibuildwheel/__main__.py
Expand Up @@ -46,7 +46,7 @@ def main() -> None:
auto-detected platform or to run cibuildwheel on your development
machine. Specifying "macos" or "windows" only works on that
operating system, but "linux" works on all three, as long as
Docker is installed. Default: auto.
Docker/Podman is installed. Default: auto.
""",
)

Expand Down Expand Up @@ -91,7 +91,7 @@ def main() -> None:
Path to the package that you want wheels for. Default: the working
directory. Can be a directory inside the working directory, or an
sdist. When set to a directory, the working directory is still
considered the 'project' and is copied into the Docker container
considered the 'project' and is copied into the build container
on Linux. When set to a tar.gz sdist file, --config-file
and --output-dir are relative to the current directory, and other
paths are relative to the expanded SDist directory.
Expand Down Expand Up @@ -208,7 +208,6 @@ def build_in_directory(args: CommandLineArguments) -> None:
sys.exit(0)

# Add CIBUILDWHEEL environment variable
# This needs to be passed on to the docker container in linux.py
os.environ["CIBUILDWHEEL"] = "1"

# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/architecture.py
Expand Up @@ -59,7 +59,7 @@ def auto_archs(platform: PlatformName) -> "Set[Architecture]":
result = {native_architecture}

if platform == "linux" and native_architecture == Architecture.x86_64:
# x86_64 machines can run i686 docker containers
# x86_64 machines can run i686 containers
result.add(Architecture.i686)

if platform == "windows" and native_architecture == Architecture.AMD64:
Expand Down