Skip to content

Commit

Permalink
Add requirements for testing/linting/docs and add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Sep 11, 2022
1 parent ff967d0 commit 88e8259
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Hades CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- name: Check out pycroft and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: ensure presence of `wheel`
run: pip install wheel
- name: install pip dependencies
run: >
pip install
vendor/arpreq
-e .
-r requirements.txt
-r requirements.doc.txt
-r requirements.lint.txt
-r requirements.test.txt
# TODO add script rendering mypy warnings as annotations
- name: Execute mypy
run: mypy

- name: execute unittests
run: pytest -v tests

- name: Build sphinx docs
run: make SPHINXOPTS="-EN -w sphinx.log" -C docs html
# TODO add script rendering annotations
# - name: Render sphinx warnings as annotations
# run: python ./scripts/render_sphinx_log.py docs/sphinx.log
- name: Publish sphinx docs as pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: docs/build/html

# see https://github.com/actions/deploy-pages#usage
deploy-docs:
if: (github.event_name == 'push') && github.ref == 'refs/heads/main'
# Add a dependency to the build job
needs: python-lint
# 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
# Deploy to the github-pages environment. see
# https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
# for general information abotu environments.
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy sphinx docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
5 changes: 5 additions & 0 deletions requirements.doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
guzzle-sphinx-theme~=0.7.11
sphinx~=5.1.1
sphinx-argparse~=0.3.1
sphinx-autobuild~=2021.3.14
sphinx-paramlinks~=0.5.4
3 changes: 3 additions & 0 deletions requirements.lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mypy~=0.971
types-docutils~=0.19.1
types-setuptools~=65.3.0
3 changes: 3 additions & 0 deletions requirements.test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest~=7.1.3
pytest-mock~=3.8.2
trio~=0.21.0

0 comments on commit 88e8259

Please sign in to comment.