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: Build and Test, and Deploy MkDocs (for develop only) | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: mypy | |
run: | | |
python -m mypy --explicit-package-bases --exclude=visualization.py src tests | |
- name: Test with `pytest` | |
if: success() || failure() | |
run: | | |
python -B -m pytest -sv tests | |
- name: Ruff check | |
run: | | |
ruff check --select=E,W,F,PL --ignore=E501,E701,E731,E402,PLR0911,PLR0912,PLR0913,PLR0915,PLR2004,PLW0603,PLW2901,PLR1714,PLR5501 --exclude=__init__.py --output-format=github . | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build # This ensures that the deployment job runs after the build job | |
if: github.ref == 'refs/heads/develop' # Only deployed for the develop branch | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
mkdocs-bibtex- | |
- name: Install Python dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build MKDocs Documentation | |
run: mkdocs build --verbose | |
- name: Deploy MKDocs to GitHub Pages | |
run: | | |
if [ -n "$GITHUB_TOKEN" ]; then | |
mkdocs gh-deploy --force | |
else | |
echo "Set the GH_PAGES_TOKEN secret in your repository for deploying to GitHub Pages." | |
exit 1 | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAGES_TOKEN }} |