Skip to content

Bump github actions versions to silence node version warning #42

Bump github actions versions to silence node version warning

Bump github actions versions to silence node version warning #42

Workflow file for this run

name: Build Wheels
on:
pull_request:
workflow_dispatch:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up rust cache
uses: Swatinem/rust-cache@v2
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: install python dependencies
run: pip install -U setuptools wheel twine maturin build pkginfo>=1.10.0
- name: build sdist
run: |
python -m build --sdist -o wheelhouse
- name: List and check sdist
run: |
ls -lh wheelhouse/
twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.tar.gz
build_wheels:
name: >
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
${{ (matrix.arch) || '' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
python-version: ['cp312', 'cp311', 'cp310', 'cp39']
include:
- os: ubuntu
platform: linux
pip_cache: ~/.cache/pip
- os: windows
ls: dir
pip_cache: ~\AppData\Local\pip\Cache
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- if: matrix.os == 'macos' || matrix.os == 'windows'
name: Set up rust toolchain
uses: dtolnay/rust-toolchain@stable
- if: matrix.os == 'macos' || matrix.os == 'windows'
name: Set up rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.arch }}
# Set up rust toolchain on mac os and windows (linux containers handled below)
- if: matrix.os == 'macos'
name: Add aarch64-apple-darwin target
run: rustup target add aarch64-apple-darwin
- if: matrix.os == 'windows'
name: Add i686-pc-windows-msvc target
run: |
# Disable self-update on windows to prevent race condition; see https://github.com/rust-lang/rustup/issues/2441
rustup toolchain install stable-i686-pc-windows-msvc --no-self-update
rustup target add i686-pc-windows-msvc
- name: Build ${{ matrix.platform || matrix.os }} binaries
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: '${{ matrix.python-version }}-*'
# rust doesn't seem to be available for musl linux on i686
CIBW_SKIP: '*-musllinux_i686'
# we build for matrix.arch (only exists on macos), else 'auto'
CIBW_ARCHS: ${{ matrix.arch || 'auto' }}
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD: rustup show
# Linux wheels are built in manylinux containers; set up rust toolchain here
CIBW_BEFORE_BUILD_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y &&
rustup show
CIBW_BUILD_VERBOSITY: 1
- name: List and check wheels
run: |
pip install twine pkginfo>=1.10.0
${{ matrix.ls || 'ls -lh' }} wheelhouse/
twine check wheelhouse/*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.whl
upload_to_pypi:
name: Upload to PYPI
runs-on: ubuntu-latest
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
needs: [build_wheels, build_sdist]
environment:
name: pypi
url: https://pypi.org/p/nbstripout-fast
permissions:
id-token: write
steps:
- name: Retrieve wheels and sdist
uses: actions/download-artifact@v4
- name: List the build artifacts
run: |
ls -lAs wheels/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
packages_dir: wheels/