From 0d514193d032bfc0552795eadc3ea79ffbd20ff4 Mon Sep 17 00:00:00 2001 From: Lukas Juhrich Date: Sun, 11 Sep 2022 23:31:29 +0200 Subject: [PATCH] Add requirements for testing/linting/docs and add CI workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Additionally, pin sqlalchemy to <1.4 as this would be included in the “compatible release” matcher `~=`. --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++ requirements.doc.txt | 5 +++ requirements.lint.txt | 3 ++ requirements.test.txt | 3 ++ 4 files changed, 80 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 requirements.doc.txt create mode 100644 requirements.lint.txt create mode 100644 requirements.test.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..c34d9099 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 --no-use-pep517 + 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 diff --git a/requirements.doc.txt b/requirements.doc.txt new file mode 100644 index 00000000..635313ac --- /dev/null +++ b/requirements.doc.txt @@ -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 diff --git a/requirements.lint.txt b/requirements.lint.txt new file mode 100644 index 00000000..38fd9570 --- /dev/null +++ b/requirements.lint.txt @@ -0,0 +1,3 @@ +mypy~=0.971 +types-docutils~=0.19.1 +types-setuptools~=65.3.0 diff --git a/requirements.test.txt b/requirements.test.txt new file mode 100644 index 00000000..2bbcfa2c --- /dev/null +++ b/requirements.test.txt @@ -0,0 +1,3 @@ +pytest~=7.1.3 +pytest-mock~=3.8.2 +trio~=0.21.0