This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
Bump actions/upload-artifact from 3 to 4 #793
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
# Automatically build binary wheels and source packages. | |
name: cibuildwheel | |
# Build on every branch push, tag push, and pull request change: | |
on: [push, pull_request] | |
# Do not build Python <=2.7, <=3.5, or PyPy. | |
# Install Linux and MacOS required libraries / tools. | |
env: | |
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6" | |
CIBW_SKIP: "cp27-* cp35-* pp*" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: "pytest {project}" | |
CIBW_DEPENDENCY_VERSIONS: "pinned" | |
CIBW_ARCHS: auto | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macOS-10.15] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Prepare Windows x86 builds | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
toolset: "14.0" | |
arch: "x86" | |
- name: Build Windows x86 wheels | |
if: runner.os == 'Windows' | |
uses: pypa/cibuildwheel@v2.11.2 | |
env: | |
CIBW_BUILD: "*win32" | |
CIBW_BEFORE_BUILD_WINDOWS: "call xmlstarlet\\setup_msvc.bat" | |
CIBW_ENVIRONMENT_WINDOWS: > | |
CIBW_ARCHS_WINDOWS=auto32 | |
PLATFORM_NAME=x86 | |
DISTUTILS_USE_SDK=1 | |
MSSdk=1 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
- name: Prepare Windows x64 builds | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
toolset: "14.0" | |
arch: "x64" | |
- name: Build Windows x86 wheels | |
if: runner.os == 'Windows' | |
uses: pypa/cibuildwheel@v2.11.2 | |
env: | |
CIBW_BUILD: "*win_amd64" | |
CIBW_BEFORE_BUILD_WINDOWS: "call xmlstarlet\\setup_msvc.bat" | |
CIBW_ENVIRONMENT_WINDOWS: > | |
CIBW_ARCHS_WINDOWS=auto64 | |
PLATFORM_NAME=amd64 | |
DISTUTILS_USE_SDK=1 | |
MSSdk=1 | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
- name: Build Linux and MacOS wheels | |
if: runner.os != 'Windows' | |
uses: pypa/cibuildwheel@v2.11.2 | |
env: | |
CIBW_SKIP: "*win*" | |
CIBW_BEFORE_ALL_LINUX: > | |
yum install -y libxslt-devel || | |
apt-get -y install libxslt1-dev libxml2-dev || | |
apk add libxml2-dev libxslt-dev | |
CIBW_BEFORE_ALL_MACOS: > | |
brew uninstall --force --ignore-dependencies libxml2 libxslt libffi && | |
brew cleanup -s libxml2 libxslt libffi && | |
brew cleanup --prune-prefix && | |
brew install libxml2 libxslt automake pkg-config | |
CIBW_ENVIRONMENT_MACOS: > | |
ARCHFLAGS="-arch x86_64" | |
PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libxslt/lib/pkgconfig" | |
LDFLAGS="-L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib" | |
CPPFLAGS="-I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libffi/include" | |
PATH="/usr/local/opt/libxslt/bin:/usr/local/opt/libxml2/bin:$PATH" | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist_and_test: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.7' | |
- name: Build sdist and run tests | |
run: | | |
sudo apt-get install -yqq libxslt1-dev libxml2-dev | |
pip install --upgrade pip setuptools wheel "cibuildwheel>=2.8.1" | |
pip --disable-pip-version-check install -r requirements.txt | |
pip --disable-pip-version-check install -r requirements_dev.txt | |
invoke test coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist_and_test] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |