3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-15 11:45:41 +00:00
yosys/.github/workflows/release.yml
Mohamed Gaber 56dd057ab4
test/ci fixes
- fix incorrect repo_url output
- fix parsing in test_splitnets to match new format
- fix silimate-shell.nix referring to removed derivation
2026-07-02 18:56:25 +03:00

275 lines
9.7 KiB
YAML

name: Release (pyosys wheels)
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build-linux-wheel:
runs-on: ubuntu-latest
name: Build Linux amd64 wheel (musl)
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
persist-credentials: false
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Cache Dist Directory
uses: actions/cache@v6
with:
path: dist-x86_64-musllinux
key: ${{ github.run_id }}-x86_64-musllinux-wheel
enableCrossOsArchive: true
- name: Build wheel in Alpine container
run: |
docker run --rm \
-v "${{ github.workspace }}:/src" \
-w /src \
--platform linux/amd64 \
alpine:3.20 sh -c '
set -ex
apk add --no-cache \
build-base bison flex flex-dev gperf \
tcl-dev zlib-dev libffi-dev \
libdwarf-dev elfutils-dev \
python3 python3-dev py3-pip py3-setuptools py3-wheel \
git pkgconf cmake
git config --global --add safe.directory /src
git submodule foreach --recursive git config --global --add safe.directory \$toplevel/\$sm_path
# Alpine/musl compatibility shims for Verific tclmain link step
ln -sf /usr/lib/libtcl8.6.so /usr/lib/libtcl.so
echo "void dummy_nsl(void){}" | gcc -shared -o /usr/lib/libnsl.so -x c -
# Build Verific TCL main (needed before Yosys)
cd /src/verific/tclmain
make
cd /src
# Build the wheel via setup.py
pip install --break-system-packages pybind11 cxxheaderparser
mkdir -p /src/dist-x86_64-musllinux
python3 -m pip wheel . --wheel-dir /src/dist-x86_64-musllinux
'
build-manylinux-wheel:
runs-on: ubuntu-latest
name: Build Linux amd64 wheel (manylinux2014, glibc 2.17+)
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Cache Dist Directory
uses: actions/cache@v6
with:
path: dist-x86_64-manylinux
key: ${{ github.run_id }}-x86_64-manylinux-wheel
enableCrossOsArchive: true
- name: Build wheel in manylinux2014 container
run: |
docker run --rm \
-v "${{ github.workspace }}:/src" \
-w /src \
--platform linux/amd64 \
quay.io/pypa/manylinux2014_x86_64 bash -c '
set -ex
yum install -y tcl-devel zlib-devel libffi-devel \
devtoolset-11 gperf patchelf \
elfutils-devel elfutils-libelf-devel libdwarf-devel
source /opt/rh/devtoolset-11/enable
# Build bison >= 3.x from source (CentOS 7 ships an old version)
curl -L https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz | tar -xzC /tmp
cd /tmp/bison-3.8.2 && ./configure && make -j$(nproc) && make install
cd /src
# Build flex >= 2.6 from source (CentOS 7 ships 2.5.37, Yosys needs >= 2.6)
curl -L https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz | tar -xzC /tmp
cd /tmp/flex-2.6.4 && ./configure && make -j$(nproc) && make install
cd /src
# Use the manylinux2014 Python 3.13
export PATH=/opt/python/cp313-cp313/bin:$PATH
git config --global --add safe.directory /src
git submodule foreach --recursive git config --global --add safe.directory \$toplevel/\$sm_path
# musl/manylinux compatibility shim for Verific tclmain link step
echo "void dummy_nsl(void){}" | gcc -shared -o /usr/lib64/libnsl.so -x c - || true
# Build Verific TCL main
cd /src/verific/tclmain
make
cd /src
WHEEL_DIR=/src/dist-x86_64-manylinux
pip3 install --upgrade pip setuptools wheel pybind11 cxxheaderparser
mkdir -p dist-manylinux
python3 -m pip wheel . --wheel-dir $WHEEL_DIR
# Tag wheel as manylinux2014
pip3 install auditwheel || true
for whl in $WHEEL_DIR/*.whl; do
auditwheel repair "$whl" --plat manylinux2014_x86_64 -w $WHEEL_DIR/ 2>/dev/null || true
done
'
build-macos-wheel:
runs-on: macos-15
name: Build macOS arm64 wheel
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
persist-credentials: false
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
brew install bison flex gperf tcl-tk@8 libffi dwarfutils libelf ccache llvm
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
pip3 install pybind11 cxxheaderparser setuptools wheel
- name: Build Verific tclmain
run: |
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
export MACOSX_DEPLOYMENT_TARGET=11.0
cd verific/tclmain
make
- name: Cache Dist Directory
uses: actions/cache@v6
with:
path: dist-aarch64-macos
key: ${{ github.run_id }}-aarch64-macos-wheel
enableCrossOsArchive: true
- name: Build wheel
run: |
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
export MACOSX_DEPLOYMENT_TARGET=11.0
mkdir -p dist
python3 -m pip wheel . --wheel-dir dist-aarch64-macos
release:
# allow testing outside main branch
# if: github.ref_name == 'main'
runs-on: ubuntu-latest
needs: [build-linux-wheel, build-manylinux-wheel, build-macos-wheel]
name: Create GitHub releases
steps:
- uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
fetch-depth: 0
- id: meta
name: Get repo metadata and clean up
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
FULL_SHA=$(git rev-parse HEAD)
DATE=$(date -u +%Y-%m-%d)
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
echo "full_sha=$FULL_SHA" >> "$GITHUB_OUTPUT"
echo "date=$DATE" >> "$GITHUB_OUTPUT"
echo "repo_url=$REPO_URL" >> "$GITHUB_OUTPUT"
rm -rf ./* ./.*
- uses: actions/checkout@v6
with:
repository: silimate/yosys-wheels
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
fetch-depth: 0
- name: Restore dist from cache (x86_64-musllinux)
uses: actions/cache@v6
with:
path: dist-x86_64-musllinux
key: ${{ github.run_id }}-x86_64-musllinux-wheel
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Restore dist from cache (x86_64-manylinux)
uses: actions/cache@v6
with:
path: dist-x86_64-manylinux
key: ${{ github.run_id }}-x86_64-manylinux-wheel
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Restore dist from cache (aarch64-macos)
uses: actions/cache@v6
with:
path: dist-aarch64-macos
key: ${{ github.run_id }}-aarch64-macos-wheel
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Update release notes
run: |
printf '%s\n' \
"Automated build from \`main\` @ [\`${{ steps.meta.outputs.short_sha }}\`](${{ steps.meta.outputs.repo_url }}/commit/${{ steps.meta.outputs.full_sha }})" \
"" \
"**Built:** ${{ steps.meta.outputs.date }}" \
"" \
"### Assets" \
"| File | Platform |" \
"|------|----------|" \
"| \`pyosys-*-linux_x86_64.whl\` | Linux x86-64 (musl) |" \
"| \`pyosys-*-manylinux2014*.whl\` | Linux x86-64 (manylinux2014, glibc 2.17+) |" \
"| \`pyosys-*-macosx_*_arm64.whl\` | macOS Apple Silicon |" \
"" \
"### Installation" \
"\`\`\`bash" \
"pip install pyosys-*.whl" \
"\`\`\`" \
> release_notes.md
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit --all --message="Build for ${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}"
git push
- name: Create permanent release
run: |
TAG="build-${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}"
gh release create "$TAG" \
dist-*/*.whl \
--target "$(git rev-parse HEAD)" \
--title "Build ${{ steps.meta.outputs.date }} (${{ steps.meta.outputs.short_sha }})" \
--notes-file release_notes.md
env:
GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }}
- name: Update latest release
run: |
git tag -f latest HEAD
git push -f origin latest
gh release delete latest --yes 2>/dev/null || true
gh release create latest \
dist-*/*.whl \
--target "$(git rev-parse HEAD)" \
--title "Latest Build (${{ steps.meta.outputs.date }})" \
--notes-file release_notes.md \
--prerelease
env:
GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }}