[pre-commit.ci] pre-commit autoupdate #535
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: CI | |
on: | |
push: | |
branches: | |
- dev | |
tags: | |
- "*" | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
merge_group: | |
defaults: | |
run: | |
shell: sh | |
env: | |
# NOTE: The default Python version is installed with actions/setup-python. | |
DEFAULT_PYTHON_VERSION: "3.12" | |
jobs: | |
################################################################################ | |
# Build source distribution | |
################################################################################ | |
build-sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get source | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
cache-dependency-path: "./requirements-ci.txt" | |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup dependencies | |
run: pip install -r "./requirements-ci.txt" | |
- name: Build sdist | |
run: pipx run --spec build pyproject-build --sdist --outdir dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "dist-sdist" | |
path: "./dist/*.tar.gz" | |
################################################################################ | |
# Build binary distribution | |
################################################################################ | |
build-wheel: | |
name: Build wheel / ${{ matrix.os.name }} | |
runs-on: ${{ matrix.os.type }} | |
strategy: | |
matrix: | |
os: | |
- name: "Linux" | |
type: "ubuntu-latest" | |
- name: "macOS" | |
type: "macos-latest" | |
- name: "Windows" | |
type: "windows-latest" | |
steps: | |
- name: Get source | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
cache-dependency-path: "./requirements-ci.txt" | |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup dependencies | |
run: pip install -r "./requirements-ci.txt" | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: "./dist" | |
config-file: "{package}/pyproject.toml" | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "11.0" | |
CIBW_TEST_SKIP: "cp38-macosx_*:arm64" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "dist-wheelhouse-${{ matrix.os.name }}" | |
path: "./dist/*.whl" | |
################################################################################ | |
# Test package with Tox | |
################################################################################ | |
test: | |
name: Test / ${{ matrix.os.name }} | |
runs-on: ${{ matrix.os.type }} | |
strategy: | |
matrix: | |
os: | |
- name: "Linux" | |
type: "ubuntu-latest" | |
- name: "macOS" | |
type: "macos-latest" | |
- name: "Windows" | |
type: "windows-latest" | |
steps: | |
- name: Get source | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
cache-dependency-path: "./requirements-ci.txt" | |
python-version: | | |
3.8 | |
3.9 | |
3.10 | |
3.11 | |
3.12 | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup dependencies | |
run: pip install -r "./requirements-ci.txt" | |
- name: Test | |
run: pipx run tox | |
################################################################################ | |
# Publish docs to GitHub Pages | |
################################################################################ | |
publish-docs-to-github-pages: | |
name: Publish docs to GitHub Pages | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
steps: | |
- name: Get source | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- # Required to run job via act: https://github.com/nektos/act | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
cache-dependency-path: "./pyproject.toml" | |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} | |
- name: Setup dependencies | |
run: pip install .[docs] | |
- name: Build docs | |
run: sphinx-build -M html docs docs/_build | |
- name: Deploy doc | |
uses: JamesIves/[email protected] | |
with: | |
branch: docs | |
folder: docs/_build/html | |
################################################################################ | |
# Publish package to GitHub Releases | |
################################################################################ | |
publish-package-to-github-releases: | |
name: Publish package to GitHub Releases | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build-sdist, build-wheel, test] | |
permissions: | |
contents: write | |
steps: | |
- name: Download dist | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "dist-*" | |
path: dist | |
merge-multiple: true | |
- name: Publish to GitHub Releases | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dist/*.tar.gz | |
dist/*.whl | |
fail_on_unmatched_files: true | |
################################################################################ | |
# Publish package to PyPI | |
################################################################################ | |
publish-package-to-pypi: | |
name: Publish package to PyPI | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build-sdist, build-wheel, test] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/tree-sitter-talon | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download dist | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "dist-*" | |
path: dist | |
merge-multiple: true | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist |