Nightly #379
This file contains hidden or 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: Nightly | |
on: | |
schedule: | |
# Every night at 3 am. | |
- cron: '0 6 * * *' | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Linting with Python 3.12 | |
runs-on: 'ubuntu-24.04' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python 3.12 (default) | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
cache: 'pip' | |
python-version: 3.12 | |
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
test: | |
name: Run tests with Python ${{ matrix.python-version }} | |
runs-on: 'ubuntu-24.04' | |
strategy: | |
matrix: | |
python-version: ['3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install Typst binary | |
env: | |
TYPST_RELEASE: 'https://github.com/typst/typst/releases/download' | |
TYPST_VERSION: '0.13.0' | |
run: | | |
mkdir -p "$HOME/.cache/typst" | |
cd "$HOME/.cache/typst" | |
wget "$TYPST_RELEASE/v$TYPST_VERSION/typst-x86_64-unknown-linux-musl.tar.xz" | |
tar xf typst-x86_64-unknown-linux-musl.tar.xz | |
install -Dm 755 -t "$HOME/.local/bin" typst-x86_64-unknown-linux-musl/typst | |
rm -rfv typst-x86_64-unknown-linux-musl.tar.xz | |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" # XXX Magic. | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
cache: 'pip' | |
python-version: ${{ matrix.python-version }} | |
# TODO(@daskol): Clean up and prepare `pyproject.toml` for packaging and | |
# proper dependency resolution. We must reuse dependency list from | |
# `pyproject.toml`. | |
- name: Install Python dependencies | |
run: | | |
# Mandatory dependencies. | |
python -m pip install matplotlib 'numpy>=2' | |
# Testing dependencies. | |
python -m pip install mypy 'pytest>=8.2' pytest-cov pytest-dirty | |
- name: Run all tests with PyTest | |
run: | | |
export PYTHON_TAG=$( | |
python -c 'import sys; print(sys.implementation.cache_tag)') | |
export PYTHONPATH=$PWD:$PYTHONPATH | |
pytest -vv \ | |
--cov=mpl_typst \ | |
--cov-report=html:coverage/html/${PYTHON_TAG} \ | |
--cov-report=xml:coverage/xml/report.${PYTHON_TAG}.xml \ | |
--junitxml=pytest/report.${PYTHON_TAG}.xml | |
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: pytest-report-${{ matrix.python-version }} | |
path: | | |
coverage | |
pytest | |
# This step never fails but it is useful to monitor status of type | |
# corectness. | |
- name: Check typing | |
run: mypy mpl_typst || true |