bug: make file paths platform-independent #632
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
# This file was initially generated by maturin v1.2.0, using: | |
# | |
# maturin generate-ci github --pytest -o ../.github/workflows/ci_python.yml | |
# | |
# TODO: | |
# - `safety` | |
# - `typeguard` | |
# - `xdoctest` | |
# | |
# Currently, `mypy` and `pytest` are running as part of building the rules. | |
# We could (in theory) use a matrix to do these in parallel fetching the | |
# built wheels, but it doesn't seem likely to provide a significant speedup. | |
name: Python CI | |
# Only one job per-ref | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
working-directory: python | |
permissions: | |
contents: read | |
jobs: | |
# Run lint separately from the build -- it doesn't need the built Rust code. | |
# | |
# Also, only do it on one machine. | |
lint: | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
cache: poetry | |
- name: install deps | |
run: | | |
poetry install --only=main --only=lint | |
- name: black | |
run: | | |
poetry run black --diff pysrc pytests docs/source | |
- name: flake8 | |
run: | | |
poetry run flake8 pysrc pytests docs/source | |
- name: isort | |
run: | | |
poetry run isort --filter-files --diff pysrc pytests docs/source | |
- name: pydocstyle | |
run: | | |
poetry run pydocstyle pysrc | |
debug: | |
if: | | |
github.event_name == 'pull_request' || | |
github.event_name == 'merge_group' || | |
(github.event_name == 'push' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: | | |
3.9 | |
3.10 | |
3.11 | |
cache: poetry | |
- name: Build debug wheels | |
uses: messense/maturin-action@v1 | |
with: | |
target: x86_64 | |
manylinux: 2_28 | |
args: --out dist --profile dev | |
working-directory: python | |
before-script-linux: | | |
set -e | |
dnf -y install clang protobuf-devel lld | |
clang --version | |
protoc --version | |
- name: Determine Version | |
if: github.event_name != 'release' | |
run: | | |
pip install tomlkit packaging | |
VERSION=$(python ../scripts/version.py get --normalize pyproject.toml project.version) | |
WHEEL=dist/kaskada-${VERSION}-cp38-abi3-manylinux_2_28_x86_64.whl | |
echo "WHEEL: ${WHEEL}" | |
echo "WHEEL=${WHEEL}" >> $GITHUB_ENV | |
- name: pytest and mypy | |
# This installs the kaskada package using the wheel. | |
# This ensures that we don't accidentally install the version from pypi. | |
run: | | |
for V in 3.9 3.10 3.11; do | |
echo "::group::Install for Python $V" | |
poetry env use $V | |
poetry env info | |
source $(poetry env info --path)/bin/activate | |
poetry install --only=test --only=typecheck | |
pip install ${WHEEL} --force-reinstall | |
echo "::endgroup::" | |
echo "::group::Test Python $V" | |
poetry run pytest | |
echo "::endgroup::" | |
echo "::group::MyPy Python $V" | |
poetry run mypy -- --install-types --non-interactive pysrc pytests | |
echo "::endgroup::" | |
deactivate | |
done | |
- name: Setup QT | |
# Needed by sphinx-social-cards. | |
# https://github.com/2bndy5/sphinx-social-cards/blob/main/.github/workflows/build.yml#L54 | |
run: | | |
sudo apt-get install -y libgl1-mesa-dev libxkbcommon-x11-0 | |
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV" | |
- name: Build docs | |
# ablog doesn't currently indicate whether it supports parallel reads, | |
# leading to a warning. | |
# when possible, add `"-j", "auto",` to do parallel builds (and in nox). | |
run: | | |
poetry env use 3.11 | |
source $(poetry env info --path)/bin/activate | |
poetry install --with=docs | |
pip install ${WHEEL} --force-reinstall | |
sphinx-build docs/source docs/_build -W # -j auto | |
deactivate | |
- name: Upload docs | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Automatically uploads an artifact from the './_site' directory by default | |
path: ${{ github.workspace }}/python/docs/_build | |
docs-deploy: | |
# Deploy docs on push to main. | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# Deployment job | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
runs-on: ubuntu-latest | |
needs: [debug] | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |