Skip to content

Commit

Permalink
Merge branch 'ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Oct 22, 2022
2 parents 83ac857 + 62052e8 commit 8955fdb
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 1 deletion.
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Hades CI

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

jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- name: Check out hades and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: install dev dependencies
# libgirepository1.0-dev required for PyGObject setup
run: >
sudo apt update
&& sudo apt install
bash
build-essential
libsystemd-dev
libgirepository1.0-dev
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: print pip cache information
run: pip cache info && pip cache list
- 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
- name: run configure script
run: >
./configure.mk
IFDOWN=
IFUP=
IPSET=
KEEPALIVED=
RADIUSD=
UNBOUND=
UNBOUND_ANCHOR=
UNBOUND_CHECKCONF=
UNBOUND_CONTROL=
UWSGI=
# TODO add script rendering mypy warnings as annotations
- name: Execute mypy
run: mypy

- name: execute unittests
run: pytest -v tests -m "not needs_build"

- 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
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ requires = ["setuptools", "wheel"]
# when used with `--no-use-pep517`:
# pip install --no-use-pep517 -e .

[tool.pytest.ini_options]
addopts = [
"--strict-markers",
]
markers = [
"needs_build: marks tests which need programs compiled with C",
]


[tool.mypy]
python_version = "3.9"
follow_imports = "silent"
Expand Down
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
8 changes: 7 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# These requirements should be `install_requires`,
# pinned to the versions packaged in the respective debian release.
arpreq~=0.3.4
Babel~=2.8.0
celery~=5.0.0
Flask~=1.1.2
Flask-Babel~=0.12.2
Jinja2~=2.11.3
# transitive pin, because Jinja2~=2.11.3 does not work with MarkupSafe>=2.1.0
# Pinning a little more strict (1.x instead of 2.0.x) to be consistent with
# the rule of pinning to the versions packaged in debian.
MarkupSafe~=1.1.1,<2.1.0
kombu~=5.0.2
netaddr~=0.7.19
psycopg2-binary~=2.8.6
Expand All @@ -13,5 +19,5 @@ PyNaCl~=1.4.0
pyrad~=2.1
pyroute2~=0.5.14
pysnmp~=4.4.12
SQLAlchemy~=1.3.22
SQLAlchemy~=1.3.22,<1.4
systemd-python==234
3 changes: 3 additions & 0 deletions tests/test_lease_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
from hades.leases.server import Mode, Server


pytestmark = pytest.mark.needs_build


# Available since CPython 3.10
F_GETPIPE_SZ = getattr(fcntl, "F_GETPIPE_SZ", 1032)
AncillaryData = List[Tuple[int, int, bytes]]
Expand Down

0 comments on commit 8955fdb

Please sign in to comment.