Files
yosys/.github/workflows/wheels.yml
T
Mohamed Gaber 07dcadbf10 wheels: also build flex
- also build flex because the default flex on macOS, while up-to-date, is customized and incompatible with Yosys (yep)
2026-10-03 15:16:32 +03:00

115 lines
3.7 KiB
YAML

name: Build Wheels for PyPI
# run every Sunday at 10 AM
on:
workflow_dispatch:
schedule:
- cron: "0 10 * * 0"
jobs:
build_wheels:
strategy:
fail-fast: false
matrix:
os: [
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04",
archs: "x86_64",
},
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04-arm",
archs: "aarch64",
},
{
name: "macOS 15 x64",
family: "macos",
runner: "macos-15-intel",
archs: "x86_64",
},
{
name: "macOS 15 arm64",
family: "macos",
runner: "macos-15",
archs: "arm64",
},
## Windows still needs to be tested.
# {
# name: "Windows Server 2025",
# family: "windows",
# runner: "windows-2025",
# archs: "AMD64",
# },
]
name: Build Wheels | ${{ matrix.os.name }} | ${{ matrix.os.archs }}
runs-on: ${{ matrix.os.runner }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: true
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: "3.x"
## Software installed by default in GitHub Action Runner VMs:
## https://github.com/actions/runner-images
- if: ${{ matrix.os.family == 'windows' }}
name: "[Windows] Flex/Bison"
run: |
choco install winflexbison3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
# * APIs not supported by PyPy
# * Musllinux disabled because it increases build time from 48m to ~3h
CIBW_SKIP: >
*musllinux*
CIBW_ARCHS: ${{ matrix.os.archs }}
CIBW_BUILD_VERBOSITY: "1"
# manylinux2014 (default) does not have a modern enough C++ compiler for Yosys
# update: it technically does, devtoolset-11, but it's a matter of
# time before it doesn't
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL: bash ./.github/workflows/wheels/cibw_before_all.sh
CIBW_CONFIG_SETTINGS: >
cmake="-DCMAKE_BUILD_TYPE=Release -DYOSYS_ENABLE_HOMEBREW:BOOL=OFF"
CIBW_ENVIRONMENT: >
OPTFLAGS=-O3
PKG_CONFIG_PATH="$PWD/ffi/pfx/lib/pkgconfig:$PKG_CONFIG_PATH"
PATH="$PWD/bison/pfx/bin:$PWD/flex/pfx/bin:$PATH"
MACOSX_DEPLOYMENT_TARGET=11
CIBW_BEFORE_BUILD: bash ./.github/workflows/wheels/cibw_before_build.sh
CIBW_TEST_COMMAND: python3 {project}/tests/pyosys/run_tests.py
- uses: actions/upload-artifact@v7
with:
name: python-wheels-${{ matrix.os.runner }}
path: ./wheelhouse/*.whl
upload_wheels:
name: Upload Wheels
if: (github.repository == 'YosysHQ/yosys') && (github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
needs: build_wheels
steps:
- uses: actions/download-artifact@v8
with:
path: "."
pattern: python-wheels-*
merge-multiple: true
- run: |
ls
mkdir -p ./dist
mv *.whl ./dist
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1