Skip to content

Add type stubs

Add type stubs #189

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- v*
pull_request:
schedule:
- cron: '17 3 * * 0'
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
rust-toolchain: stable
args: --release --sdist -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux
path: dist/*
linux-cross:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64, armv7]
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
manylinux: auto
target: ${{ matrix.target }}
command: build
rust-toolchain: stable
args: --release -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist/*.whl
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
rust-toolchain: stable
args: --release -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist/*.whl
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
rust-toolchain: stable
args: --release -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist/*.whl
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux, linux-cross ]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing dist/*.whl dist/*.tar.gz
pytest:
name: Pytest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.10', '3.x']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'
- name: Create virtual environment
run: |
python -m venv venv
echo "$GITHUB_WORKSPACE/venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install
run: |
source activate
maturin develop
- name: Run tests
run: pytest --tb=native test
- name: Validate stubs
run: python -m mypy.stubtest --ignore-missing-stub starlark
- name: Run example
run: |
cd examples
for f in *.py; do
python "$f"
done
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'
- name: Create virtual environment
run: |
python -m venv venv
echo "$GITHUB_WORKSPACE/venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install and build docs
run: |
source activate
maturin develop
cd doc
make html SPHINXOPTS="-W --keep-going -n"
- name: Upload docs
run: |
if test "$GITHUB_REF" = "refs/heads/main"; then
cat > doc_upload_ssh_config <<END
Host doc-upload
User doc
IdentityFile doc_upload_key
IdentitiesOnly yes
Hostname documen.tician.de
StrictHostKeyChecking false
Port 2222
END
echo "${DOC_UPLOAD_KEY}" > doc_upload_key
chmod 0600 doc_upload_key
RSYNC_RSH="ssh -F doc_upload_ssh_config" rsync --verbose --archive --delete doc/_build/html/* doc-upload:doc/starlark-pyo3
fi
env:
DOC_UPLOAD_KEY: ${{ secrets.DOC_UPLOAD_KEY }}
flake8:
name: Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
-
uses: actions/setup-python@v5
with:
# matches compat target in pyproject.toml
python-version: '3.8'
- name: "Main Script"
run: |
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/prepare-and-run-flake8.sh
. ./prepare-and-run-flake8.sh test examples