From 2812f8b5885e328f1c3cfec796e954e1359baed8 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Sun, 24 Jul 2022 01:19:30 +0200 Subject: [PATCH] Add a minimal example --- docs/options.md | 10 +++++ docs/setup.md | 14 +++++++ examples/cirrus-ci-minimal.yml | 70 ++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 examples/cirrus-ci-minimal.yml diff --git a/docs/options.md b/docs/options.md index b6e0b0c5..4f304b12 100644 --- a/docs/options.md +++ b/docs/options.md @@ -73,6 +73,16 @@ cibuildwheel to run tests, add the following YAML to your CI config file: CIBW_TEST_COMMAND: "pytest {project}/tests" ``` +!!! tab "Cirrus CI" + + > .cirrus.yml ([docs](https://cirrus-ci.org/guide/writing-tasks/#environment-variables)) + + ```yaml + env: + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: "pytest {project}/tests" + ``` + ### Configuration file {: #configuration-file} You can configure cibuildwheel with a config file, such as `pyproject.toml`. diff --git a/docs/setup.md b/docs/setup.md index 2dce1f5b..37b9d42c 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -312,6 +312,20 @@ Commit this file, and push to Gitlab. The pipeline should start automatically. Gitlab will store the built wheels for you - you can access them from the Pipelines view. Check out the Gitlab [docs](https://docs.gitlab.com/ee/ci/yaml/) for more info on this config file. +## Cirrus CI [linux/mac/windows] {: #cirrus-ci} + +To build Linux, Mac, and Windows wheels on Cirrus CI, create a `.cirrus.yml` file in your repo, + +> .cirrus.yml + +```yaml +{% include "../examples/cirrus-ci-minimal.yml" %} +``` + +Commit this file, enable building of your repo on Cirrus CI, and push. + +Cirrus CI will store the built wheels for you - you can access them from the individual task view. Check out the Cirrus CI [docs](https://cirrus-ci.org/guide/writing-tasks/) for more info on this config file. + > ⚠️ Got an error? Check the [FAQ](faq.md). # Next steps diff --git a/examples/cirrus-ci-minimal.yml b/examples/cirrus-ci-minimal.yml new file mode 100644 index 00000000..777da56d --- /dev/null +++ b/examples/cirrus-ci-minimal.yml @@ -0,0 +1,70 @@ +build_and_store_wheels: &BUILD_AND_STORE_WHEELS + install_cibuildwheel_script: + - python -m pip install cibuildwheel==2.9.0 + run_cibuildwheel_script: + - cibuildwheel + wheels_artifacts: + path: "wheelhouse/*" + + +linux_x86_task: + name: Build Linux x86 wheels. + compute_engine_instance: + image_project: cirrus-images + image: family/docker-builder + platform: linux + cpu: 4 + memory: 4G + + install_pre_requirements_script: + - apt install -y python3-venv python-is-python3 + <<: *BUILD_AND_STORE_WHEELS + +linux_arm64_task: + name: Build Linux arm64 wheels. + arm_container: + image: python:3.10 + cpu: 1 + memory: 1G + additional_containers: + - name: dockerdaemon + privileged: true + cpu: 3 + memory: 3G + image: docker:dind + command: dockerd + port: 2375 + env: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + env: + DOCKER_HOST: tcp://localhost:2375 + + install_pre_requirements_script: + - curl -sSL https://get.docker.com/ | sh + <<: *BUILD_AND_STORE_WHEELS + +windows_x86_task: + name: Build Windows x86 wheels. + windows_container: + image: cirrusci/windowsservercore:visualstudio2022 + cpu: 4 + memory: 4G + + install_pre_requirements_script: + - choco install -y --no-progress python3 --version 3.10.6 + - refreshenv + - echo PATH=%PATH% >> "%CIRRUS_ENV%" + <<: *BUILD_AND_STORE_WHEELS + +macos_arm64_task: + name: Build macOS arm64 wheels. + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode + + env: + PATH: /opt/homebrew/opt/python@3.10/bin:$PATH + install_pre_requirements_script: + - brew install python@3.10 + - ln -s python3 /opt/homebrew/opt/python@3.10/bin/python + <<: *BUILD_AND_STORE_WHEELS