Skip to content

cibuildwheel

cibuildwheel #751

Workflow file for this run

name: cibuildwheel
on:
push:
paths:
- '.github/workflows/cibuildwheel.yml'
- 'build_config/pyproject/*.toml'
workflow_dispatch:
inputs:
os:
type: string
description: "comma separated list of OS"
required: false
workflow_call:
inputs:
os:
type: string
required: false
schedule:
- cron: '5 0 * * *'
jobs:
generate-matrix:
uses: ./.github/workflows/generate-matrix.yml
with:
os: ${{ inputs.os }}
###################
# building pure python wheels
###################
pure-python-wheels:
runs-on: ubuntu-latest
steps:
- name: Cloning SUMO
uses: actions/checkout@v7
with:
fetch-depth: 0
filter: tree:0
# to work around actions/checkout#1467
ref: ${{ github.ref }}
- name: Building sumolib and traci wheels
run: |
sudo apt-get update
sudo apt-get install $(cat build_config/build_req_deb.txt)
python tools/build_config/version.py --pep440 build_config/pyproject/sumolib.toml pyproject.toml
python -m build
python tools/build_config/version.py --pep440 build_config/pyproject/traci.toml pyproject.toml
python -m build
python tools/build_config/version.py --pep440 build_config/pyproject/sumo-data.toml pyproject.toml
python -m build --wheel
- uses: actions/upload-artifact@v7
with:
name: cibw-pure-wheels
path: ./dist/*
###################
# building wheels with cibuildwheel
###################
build-wheels:
needs: [generate-matrix]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.generate-matrix.outputs.build_matrix) }}
runs-on: ${{ matrix.os }}
env:
SUMO_LIBRARIES: D:\a\sumo\sumo\SUMOLibraries
steps:
- name: Cloning SUMO
uses: actions/checkout@v7
with:
fetch-depth: 0
filter: tree:0
# to work around actions/checkout#1467
ref: ${{ github.ref }}
- name: Cloning SUMO Libraries
if: matrix.os == 'windows-latest'
uses: actions/checkout@v7
with:
repository: DLR-TS/SUMOLibraries
path: SUMOLibraries
- name: "Set up MSVC Developer Command Prompt"
if: matrix.os == 'windows-latest'
uses: compnerd/gha-setup-vsdevenv@v7
- name: "Set up macOS environment"
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
echo 'CIBW_PROJECT_REQUIRES_PYTHON=>=3.9' >> $GITHUB_ENV
echo 'MACOSX_DEPLOYMENT_TARGET=14.0' >> $GITHUB_ENV
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.23
with:
key: ${{ matrix.os }}-${{ matrix.manylinux }}
variant: ${{ matrix.os == 'windows-latest' && 'sccache' || 'ccache' }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Preparing wheel eclipse-sumo
run: python tools/build_config/version.py --pep440 build_config/pyproject/eclipse-sumo.toml pyproject.toml
# run: |
# git checkout v1_26_0
# git checkout 74027d742c62e3faa47b512dd2f4e2cedae1d987 build_config/pyproject CMakeLists.txt tools/build_config/version.py
# python tools/build_config/version.py --pep440 build_config/pyproject/eclipse-sumo.toml pyproject.toml
- name: Building wheel eclipse-sumo
uses: pypa/cibuildwheel@v4.1.0
env:
CIBW_ENVIRONMENT_LINUX: CCACHE_DIR=/host/home/runner/work/sumo/sumo/.ccache
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR=Ninja PATH="D:\\a\\sumo\\sumo\\bin;$PATH"
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }}
- name: Building windows / macos platform wheel sumo-data
if: ${{ startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos') }}
run: |
python -m pip install -r tools/req_dev.txt
python tools/build_config/version.py --pep440plat build_config/pyproject/sumo-data.toml pyproject.toml
python -m build --wheel -o wheelhouse
- name: Preparing wheel libsumo
run: python tools/build_config/version.py --pep440 build_config/pyproject/libsumo.toml pyproject.toml
- name: Building wheel libsumo
uses: pypa/cibuildwheel@v4.1.0
env:
CIBW_ENVIRONMENT_LINUX: CCACHE_DIR=/host/home/runner/work/sumo/sumo/.ccache
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR=Ninja PATH="D:\\a\\sumo\\sumo\\bin;$PATH"
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }}
# CIBW_REPAIR_WHEEL_COMMAND: "" # disable repair process to inspect the wheel
# CIBW_BUILD_VERBOSITY: 2
- name: Relocating libs in macos wheels to sumo-data
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
python tools/build_config/relocate.py wheelhouse
mv wheelhouse ci_wheelhouse
mv ci_wheelhouse/relocate wheelhouse
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.manylinux }}
path: ./wheelhouse/*.whl
# to download the unrepaired wheels, use the "dist" path
###################
# testing wheels
###################
test-wheels:
needs: [pure-python-wheels, build-wheels]
uses: ./.github/workflows/test-wheels.yml
with:
os: ${{ inputs.os }}
wheel_source: 'python-wheels'