mirror of https://github.com/YosysHQ/yosys.git
122 lines
4.2 KiB
YAML
122 lines
4.2 KiB
YAML
name: Release (anylinux amd64 wheel)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
name: Build anylinux amd64 wheel
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: false
|
|
ssh-key: ${{ secrets.VERIFIC_DEPLOY_KEY }}
|
|
|
|
- name: Initialize submodules
|
|
run: |
|
|
git submodule update --init --recursive
|
|
|
|
- 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 gperf \
|
|
tcl-dev readline-dev zlib-dev libffi-dev \
|
|
python3 python3-dev py3-pip py3-setuptools py3-wheel \
|
|
git pkgconf ccache
|
|
|
|
git config --global --add safe.directory /src
|
|
git submodule foreach --recursive git config --global --add safe.directory \$toplevel/\$sm_path
|
|
|
|
# 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
|
|
_PYOSYS_OVERRIDE_VER=$(
|
|
grep "^YOSYS_VER " Makefile | head -1 | sed "s/.*:= *//" | tr "+" "."
|
|
) python3 setup.py bdist_wheel --dist-dir /src/dist
|
|
|
|
# Also build the yosys binary + install tarball
|
|
make -j$(nproc) SMALL=1 ENABLE_PLUGINS=0 PREFIX=/usr/local install
|
|
make DESTDIR=/tmp/install PREFIX=/usr/local install
|
|
cd /tmp/install
|
|
tar czf /src/yosys-anylinux-amd64.tar.gz .
|
|
'
|
|
|
|
- name: Generate release notes
|
|
id: meta
|
|
run: |
|
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
|
FULL_SHA=$(git rev-parse HEAD)
|
|
DATE=$(date -u +%Y-%m-%d)
|
|
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
|
|
echo "date=$DATE" >> "$GITHUB_OUTPUT"
|
|
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
|
|
WHEEL=$(ls dist/*.whl | head -1)
|
|
WHEEL_NAME=$(basename "$WHEEL")
|
|
echo "wheel_name=$WHEEL_NAME" >> "$GITHUB_OUTPUT"
|
|
printf '%s\n' \
|
|
"Automated build from \`main\` @ [\`${SHORT_SHA}\`](${REPO_URL}/commit/${FULL_SHA})" \
|
|
"" \
|
|
"**Platform:** Linux amd64 (Alpine-based, portable across Linux distros)" \
|
|
"**Built:** ${DATE}" \
|
|
"" \
|
|
"### Assets" \
|
|
"- \`yosys-anylinux-amd64.tar.gz\` — standalone tarball" \
|
|
"- \`${WHEEL_NAME}\` — Python wheel (pyosys)" \
|
|
"" \
|
|
"### Installation (tarball)" \
|
|
"\`\`\`bash" \
|
|
"sudo tar xzf yosys-anylinux-amd64.tar.gz -C /" \
|
|
"\`\`\`" \
|
|
"" \
|
|
"### Installation (wheel)" \
|
|
"\`\`\`bash" \
|
|
"pip install ${WHEEL_NAME}" \
|
|
"\`\`\`" \
|
|
> release_notes.md
|
|
|
|
- name: Create permanent release
|
|
run: |
|
|
TAG="build-${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}"
|
|
gh release create "$TAG" \
|
|
yosys-anylinux-amd64.tar.gz \
|
|
dist/*.whl \
|
|
--target "${{ github.sha }}" \
|
|
--title "Build ${{ steps.meta.outputs.date }} (${{ steps.meta.outputs.short_sha }})" \
|
|
--notes-file release_notes.md
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_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 \
|
|
yosys-anylinux-amd64.tar.gz \
|
|
dist/*.whl \
|
|
--target "${{ github.sha }}" \
|
|
--title "Latest Build (${{ steps.meta.outputs.date }})" \
|
|
--notes-file release_notes.md \
|
|
--prerelease
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|