STAR-future's picture
add chips/yosys
2d66860 verified
Raw History Blame Contribute Delete
4.69 kB
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 26.04",
family: "linux",
runner: "ubuntu-26.04",
archs: "x86_64",
},
{
name: "Ubuntu 26.04",
family: "linux",
runner: "ubuntu-26.04-arm",
archs: "aarch64",
},
{
name: "macOS 26",
family: "macos",
runner: "macos-26",
archs: "arm64",
},
## Windows still has a couple issues.
# {
# 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
- id: get-ccache-dir
name: Set Ccache Directory
if: ${{ matrix.os.family != 'windows' }}
run: |
if test "$(uname)" = "Darwin"; then
echo "ccache_dir=$HOME/Library/Caches/ccache/" | tee -a $GITHUB_OUTPUT
else
echo "ccache_dir=$HOME/.cache/ccache/" | tee -a $GITHUB_OUTPUT
fi
- name: Cache Ccache Directory
uses: actions/cache@v6
with:
path: ${{ steps.get-ccache-dir.outputs.ccache_dir }}
key: pyosys-ccache-${{ matrix.os.family }}-${{ matrix.os.archs }}
- if: ${{ matrix.os.family == 'windows' }}
name: "[Windows] Flex/Bison"
run: |
choco install winflexbison3
- name: Build wheels
uses: pypa/cibuildwheel@v4.1.0
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="
-DYOSYS_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DYOSYS_ENABLE_HOMEBREW:BOOL=OFF
-DSLANG_USE_SYSTEM_FMT:BOOL=OFF
"
CIBW_ENVIRONMENT_MACOS: >
OPTFLAGS=-O3
PKG_CONFIG_PATH="$PWD/ffi/pfx/lib/pkgconfig:$PKG_CONFIG_PATH"
PATH="$PWD/ccache/bin:$PWD/bison/pfx/bin:$PWD/flex/pfx/bin:$PATH"
MACOSX_DEPLOYMENT_TARGET=11
CIBW_ENVIRONMENT_LINUX: >
OPTFLAGS=-O3
PKG_CONFIG_PATH="$PWD/ffi/pfx/lib/pkgconfig:$PKG_CONFIG_PATH"
PATH="$PWD/ccache/bin:$PWD/bison/pfx/bin:$PWD/flex/pfx/bin:$PATH"
CCACHE_CONFIGPATH=/host/home/runner/.config/ccache/ccache.conf
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