Refactor cibuildwheel setup #429
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
name: Build | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/build.yml' | |
pull_request: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * 1' | |
jobs: | |
black: | |
name: black | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup | |
run: pip install black | |
- name: Lint with black | |
run: black --check --diff . | |
flake8: | |
name: flake8 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup | |
run: pip install flake8 | |
- name: Lint with flake8 | |
run: flake8 | |
isort: | |
name: isort | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup | |
run: pip install isort[colors] | |
- name: Lint with isort | |
run: isort --check --diff . | |
mypy: | |
name: mypy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup | |
run: pip install mypy pytest | |
- name: Lint with mypy | |
run: mypy . | |
conda: | |
name: Conda ${{ matrix.python-version }} - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
sidx-version: ['1.8.5','1.9.3'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
channels: conda-forge | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Setup | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge numpy libspatialindex=${{ matrix.sidx-version }} -y | |
- name: Install | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
- name: Test with pytest | |
shell: bash -l {0} | |
run: | | |
pip install pytest | |
python -m pytest --doctest-modules rtree tests | |
ubuntu: | |
name: Ubuntu Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Setup | |
shell: bash -l {0} | |
run: | | |
sudo apt install libspatialindex-c6 python3-pip | |
python3 -m pip install --upgrade pip | |
python3 -m pip install setuptools numpy pytest | |
- name: Build | |
shell: bash -l {0} | |
run: | | |
python3 -m pip install --user . | |
- name: Test with pytest | |
shell: bash -l {0} | |
run: | | |
python3 -m pytest --doctest-modules rtree tests | |
wheels: | |
name: Build wheel on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Run MacOS Preinstall Build | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
# provides sha256sum | |
brew install coreutils | |
pip install cmake | |
bash ci/install_libspatialindex.bash | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: startsWith(matrix.os, 'windows') | |
- name: Run Windows Preinstall Build | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
choco install vcpython27 -f -y | |
ci\install_libspatialindex.bat | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-whl | |
path: wheelhouse/*.whl | |
collect-artifacts: | |
name: Package and push release | |
#needs: [windows-wheel, linux-wheel, osx-wheel, conda, ubuntu] | |
needs: [conda, ubuntu, wheels] | |
runs-on: 'ubuntu-latest' | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Source | |
shell: bash -l {0} | |
run: | | |
sudo apt install libspatialindex-c6 python3-pip | |
python3 -m pip install --upgrade pip | |
python3 -m pip install setuptools numpy pytest wheel | |
export PATH=$PATH:/home/runner/.local/bin | |
python3 setup.py sdist | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
name: Download artifacts | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: dist | |
- name: Unpack | |
shell: bash -l {0} | |
working-directory: dist | |
run: | | |
for f in *whl | |
do | |
cd "$f" | |
cp *.whl .. | |
cd .. | |
done; | |
rm -rf *\-whl | |
ls -al | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
name: Publish package | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_token }} | |
packages_dir: ./dist |