[pre-commit.ci] pre-commit autoupdate #174
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: | |
pull_request: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
# disable concurrent runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# fail fast and early to avoid clogging GH Actions | |
smoke_testing: | |
runs-on: ubuntu-latest | |
name: Smoke Testing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install OS packages | |
run: | | |
sudo apt update | |
sudo apt install libgl1-mesa-glx | |
- name: Build and validate wheel | |
run: | | |
pip install build twine | |
python -m build | |
twine check dist/* | |
- name: Install | |
run: pip install dist/*.whl | |
- name: Test | |
run: | | |
pip install -r requirements_test.txt | |
cd tests && python -m pytest -v | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/*.tar.gz | |
name: fast-simplification-sdist | |
docs_build: | |
name: Build Documentation | |
runs-on: ubuntu-latest | |
needs: smoke_testing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install OS packages | |
run: | | |
sudo apt update | |
sudo apt install libgl1-mesa-glx xvfb | |
- name: Install library | |
run: pip install . | |
- name: Build Documentation | |
run: | | |
pip install -r requirements_docs.txt | |
xvfb-run make -C doc html | |
- name: Deploy on tag | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: doc/_build/html | |
build_wheels: | |
needs: smoke_testing | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-2019, macos-14, macos-13] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- name: List generated wheels | |
run: ls ./wheelhouse/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: fast-simplification-wheel-${{ matrix.os }} | |
release: | |
name: Release | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [build_wheels, docs_build] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/fast-simplification | |
permissions: | |
id-token: write # this permission is mandatory for trusted publishing | |
contents: write # required to create a release | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Flatten directory structure | |
run: | | |
mkdir -p dist/ | |
find . -name '*.whl' -exec mv {} dist/ \; | |
find . -name '*.tar.gz' -exec mv {} dist/ \; | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
files: | | |
./**/*.whl |