Skip to content

build: use pyproject.toml #312

build: use pyproject.toml

build: use pyproject.toml #312

Workflow file for this run

name: Documentation
on:
workflow_dispatch:
release:
types: [published]
push:
branches:
- master
paths:
- apischema/**
- benchmark/**
- docs/**
- examples/**
- mkdocs.yml
- setup.py
pull_request:
paths:
- apischema/**
- benchmark/**
- docs/**
- examples/**
- mkdocs.yml
jobs:
run_benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3.0.11
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install apischema
run: pip install -e .
- name: Install requirements
run: pip install -r benchmark/requirements.txt
- name: Run benchmark
run: python benchmark/main.py
- uses: actions/upload-artifact@v3
with:
name: benchmark_table
path: examples/benchmark_table.md
- uses: actions/upload-artifact@v3
with:
name: benchmark_chart_light
path: docs/benchmark_chart_light.svg
- uses: actions/upload-artifact@v3
with:
name: benchmark_chart_dark
path: docs/benchmark_chart_dark.svg
upload_doc:
needs: [run_benchmark]
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3.0.11
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
name: benchmark_table
path: examples
- uses: actions/download-artifact@v3
with:
name: benchmark_chart_light
path: docs
- uses: actions/download-artifact@v3
with:
name: benchmark_chart_dark
path: docs
- name: Install requirements
run: pip install -r docs/requirements.txt
- name: Build documentation
run: mkdocs build
- uses: actions/upload-artifact@v3
with:
name: documentation
path: site/**
publish_doc:
needs: [run_benchmark]
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'release'
steps:
- uses: actions/cache@v3.0.11
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
name: benchmark_table
path: examples
- uses: actions/download-artifact@v3
with:
name: benchmark_chart_light
path: docs
- uses: actions/download-artifact@v3
with:
name: benchmark_chart_dark
path: docs
- name: Install requirements
run: pip install -r docs/requirements.txt
- name: Setup git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch origin gh-pages --depth=1
- name: Set environment variable
run: |
echo "version=$(python setup.py --version | cut -d. -f-2)" >> $GITHUB_ENV
echo "revision=$(python setup.py --version | cut -d. -f3)" >> $GITHUB_ENV
echo "latest=$(mike list latest -j | jq .version -r)" >> $GITHUB_ENV
- name: Publish dev documentation
if: github.event_name == 'push' && env.version != env.latest
run: mike deploy -p $version dev -t "$version (dev)" -u
- name: Publish latest documentation
if: github.event_name == 'release' && env.revision == '0'
run: |
mike retitle latest "$latest"
mike deploy -p $version latest -t "$version (latest)" -u
- name: Publish patch documentation
if: github.event_name == 'release' && env.revision != '0'
run: mike deploy -p $version