Refactor stats #350
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to build and test wheels | |
name: najaeda Wheel builder | |
on: | |
# Save CI by only running this on release branches or tags. | |
push: | |
branches: | |
- main | |
- v[0-9]+.[0-9]+.x | |
tags: | |
- v* | |
# Also allow running this action on PRs if requested by applying the | |
# "Run cibuildwheel" label. | |
pull_request: | |
# Manual run | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
include: | |
# Linux 64 bit manylinux2014 | |
- os: ubuntu-latest | |
python: 39 | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
- os: ubuntu-latest | |
python: 310 | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
- os: ubuntu-latest | |
python: 311 | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
- os: ubuntu-latest | |
python: 312 | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
- os: ubuntu-latest | |
python: 313 | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
- os: ubuntu-latest | |
python: 313t | |
platform_id: manylinux_x86_64 | |
manylinux_image: manylinux2014 | |
free_threaded_support: True | |
# MacOS arm64 | |
- os: macos-14 | |
python: 39 | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: 310 | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: 311 | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: 312 | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: 313 | |
platform_id: macosx_arm64 | |
- os: macos-14 | |
python: 313t | |
platform_id: macosx_arm64 | |
free_threaded_support: True | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: 3.13 | |
- run: python preprocessor.py --source_dir ../examples --source_rst README.rst --dest_rst ${{github.workspace}}/README.rst | |
working-directory: ${{github.workspace}}/src/najaeda/README | |
- name: Configure macOS Environment | |
if: runner.os == 'macOS' | |
run: | | |
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_NO_ENV_HINTS=1 | |
eval "$(brew shellenv)" | |
brew install -q boost flex bison | |
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH; echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH; | |
echo "/opt/homebrew/opt/flex/bin" >> $GITHUB_PATH; echo "/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.22.0 | |
- name: Build wheels | |
env: | |
CIBW_FREE_THREADED_SUPPORT: ${{ matrix.free_threaded_support }} | |
CIBW_ENVIRONMENT: SKLEARN_SKIP_NETWORK_TESTS=1 | |
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
CIBW_ARCHS: all | |
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} | |
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} | |
CIBW_TEST_REQUIRES: "pytest" | |
CIBW_TEST_COMMAND: | | |
export VERILOG_BENCHMARKS_PATH='{project}/test/snl/formats/verilog/benchmarks' && | |
export LIBERTY_BENCHMARKS_PATH='{project}/test/snl/formats/liberty/benchmarks' && | |
export NAJAEDA_TEST_PATH='{project}/test/najaeda' && | |
python -m pytest {project}/test/najaeda && | |
cd {project}/src/najaeda/examples && python run_regress.py | |
run: python -m cibuildwheel --output-dir wheelhouse | |
#Reminder!!: actions/upload-artifact and actions/download-artifact | |
#need to have same version | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }} | |
path: ./wheelhouse/*.whl | |
test_upload_pypi: | |
# TODO: create an sdist that can build without a custom environment | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
#environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
#Reminder!!: actions/upload-artifact and actions/download-artifact | |
#need to have same version | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@v1.12.2 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
pypi-publish: | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
needs: [test_upload_pypi] | |
name: Upload release to PyPI | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@v1.12.2 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip-existing: true |