Skip to content

Commit

Permalink
added worksflows for testing and building docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SiebeLeDe committed Oct 7, 2024
1 parent 71a8129 commit 8cc436d
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 'Documentation'

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true

on:
push:
branches:
- main
pull_request:
types: [closed]
branches: [main]
release:
types: [published]

jobs:
build_and_deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get git tags
run: git fetch --prune --unshallow --tags

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Build package
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Install sphinx
run: pip install sphinx sphinx-tabs sphinx-copybutton sphinx-autodoc-typehints sphinx-argparse

- name: Install sphinx theme
run: pip install pydata-sphinx-theme

- name: Install other dependencies
run: pip install plams

- name: Run sphinx-apidoc
run: cd docs; sphinx-apidoc -f -o ./api ../src/pyfrag

- name: Build the docs
run: cd docs; make html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/
force_orphan: true
38 changes: 38 additions & 0 deletions .github/workflows/perform_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Testing

on: [push]

concurrency:
group: "testing"
cancel-in-progress: true

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff==0.6.9 pytest pytest-cov
pip install -e .
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
# Note, line length is put on a very high margin (200). PEP8 prefers a value of 79
ruff --format=github --select=E9,F63,F7,F82 --target-version=py38 --line-length=250 .
# default set of ruff rules with GitHub Annotations
ruff --format=github --target-version=py38 --line-length=250 .
- name: Test with pytest
run: |
pytest --cov
coverage html

0 comments on commit 8cc436d

Please sign in to comment.