Skip to content

Merge pull request #67 from amangupta17/fix-macos-wheel-build #99

Merge pull request #67 from amangupta17/fix-macos-wheel-build

Merge pull request #67 from amangupta17/fix-macos-wheel-build #99

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
build-and-test-ubuntu:
name: Ubuntu (python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ libxerces-c-dev
- name: Install package
run: pip install .
- name: Install pytest
run: pip install pytest
- name: Run tests
run: python -m pytest tests
build-and-test-windows:
name: Windows (python ${{ matrix.python-version }})
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: pye57
channels: conda-forge
miniconda-version: "latest"
- name: Install Dependencies
shell: pwsh
run: |
conda install -y xerces-c
- name: Configure MSVC console
uses: ilammy/msvc-dev-cmd@v1
- name: Install package
shell: pwsh
run: pip install .
- name: Install pytest
shell: pwsh
run: pip install pytest
- name: Run tests
shell: pwsh
run: python -m pytest tests
build-and-test-macos:
name: macOS (python ${{ matrix.python-version }})
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
working-directory: ./scripts
run: |
bash install_xerces_c.sh
- name: Install package
run: pip install .
- name: Install pytest
run: pip install pytest
- name: Run tests
run: python -m pytest tests
build_wheels:
name: Build wheels
runs-on: ${{ matrix.os }}
needs:
- build-and-test-ubuntu
- build-and-test-windows
- build-and-test-macos
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
os: ["ubuntu-latest", "windows-2019", "macos-latest"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
python -m cibuildwheel --platform linux --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_LINUX: "bash scripts/install_xerces_c.sh"
- name: Build wheels (Windows)
if: matrix.os == 'windows-2019'
run: |
python -m cibuildwheel --platform windows --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_WINDOWS: "powershell scripts/install_xerces_c.ps1"
- name: Build wheels (macOS)
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --platform macos --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_MACOS: "bash scripts/install_xerces_c.sh"
- uses: actions/upload-artifact@v2
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
make_sdist:
name: Make sdist
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build-and-test-ubuntu
- build-and-test-windows
- build-and-test-macos
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v2
with:
name: sdist
path: dist/*.tar.gz
upload_all:
name: Upload to pypi
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: wheels-macos-latest
path: dist
- uses: actions/download-artifact@v2
with:
name: sdist
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}