Skip to content

Commit

Permalink
wheels: convert versions to match pypa spec, add uploading
Browse files Browse the repository at this point in the history
* wheel versions now replace `+` with `.post` to match spec at https://packaging.python.org/en/latest/specifications/version-specifiers/
* CI updates:
  * Bump action versions
  * Disabled Windows for now and documented why
  * Added a new job to upload all wheels
  * Added new variable, `PYPI_INDEX`: fallback 'https://pypi.org/' if unset
  * Added new secret, `PYPI_TOKEN`
* .editorconfig now uses 2 spaces for YML (it kept setting mine to tabs
  and GitHub Actions doesn't like that)
  • Loading branch information
donn committed Oct 4, 2024
1 parent 45c3afa commit aec42ca
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
49 changes: 35 additions & 14 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Build Wheels for PyPI
on:
workflow_dispatch:
push:
# tags: ["yosys-*"]

jobs:
build_wheels:
strategy:
Expand Down Expand Up @@ -37,24 +36,27 @@ jobs:
runner: "macos-14",
archs: "arm64",
},
{
name: "Windows Server 2019",
family: "windows",
runner: "windows-2019",
archs: "AMD64",
},
## Windows is disabled because of an issue with compiling FFI as
## under MinGW in the GitHub Actions environment (SHELL variable has
## whitespace.)
# {
# name: "Windows Server 2019",
# family: "windows",
# runner: "windows-2019",
# archs: "AMD64",
# },
]
name: Build Wheels | ${{ matrix.os.name }} | ${{ matrix.os.archs }}
runs-on: ${{ matrix.os.runner }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- if: ${{ matrix.os.family == 'linux' }}
name: "[Linux] Set up QEMU"
uses: docker/setup-qemu-action@v2
- uses: actions/setup-python@v3
uses: docker/setup-qemu-action@v3
- uses: actions/setup-python@v5
- name: Get Boost Source
shell: bash
run: |
Expand All @@ -73,7 +75,7 @@ jobs:
brew install flex bison
echo "PATH=$(brew --prefix flex)/bin:$PATH" >> $GITHUB_ENV
echo "PATH=$(brew --prefix bison)/bin:$PATH" >> $GITHUB_ENV
- if : ${{ matrix.os.family == 'windows' }}
- if: ${{ matrix.os.family == 'windows' }}
name: "[Windows] Flex/Bison"
run: |
choco install winflexbison3
Expand All @@ -86,7 +88,7 @@ jobs:
uses: pypa/[email protected]
env:
# * APIs not supported by PyPy
# * Musllinux temporarily disabled because it takes too much time
# * Musllinux disabled because it increases build time from 48m to ~3h
CIBW_SKIP: >
pp*
*musllinux*
Expand All @@ -109,6 +111,25 @@ jobs:
makeFlags='BOOST_PYTHON_LIB=./boost/pfx/lib/libboost_python*.a CONFIG=clang'
CIBW_BEFORE_BUILD: bash ./.github/workflows/wheels/cibw_before_build.sh
CIBW_TEST_COMMAND: python3 -c "from pyosys import libyosys as ys;d=ys.Design();ys.run_pass('help', d)"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: python-wheels
path: ./wheelhouse/*.whl
upload_wheels:
name: Upload Wheels
runs-on: ubuntu-latest
needs: build_wheels
steps:
- uses: actions/download-artifact@v4
with:
name: python-wheels
path: "."
- run: |
ls
mkdir -p ./dist
mv *.whl ./dist
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
repository-url: ${{ vars.PYPI_INDEX || 'https://upload.pypi.org/legacy/' }}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

version = yosys_version_rx.search(
open(os.path.join(__dir__, "Makefile"), encoding="utf8").read()
)[1]
)[1].replace("+", ".post")


class libyosys_so_ext(Extension):
Expand Down

0 comments on commit aec42ca

Please sign in to comment.