diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..abd62f20 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: ci + +on: [push, pull_request] + +jobs: + + tests: + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + matrix: + python-version: ['3.9','3.10','3.11','3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Install poetry + run: pipx install poetry + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install python dependencies + run: | + poetry install --with dev + + - name: Run test suite + env: + # show timings of tests + PYTEST_ADDOPTS: "--durations=0" + run: poetry run pytest --cov janus_core --cov-append . + + docs: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + + - name: Install poetry + run: pipx install poetry + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install python dependencies + run: poetry install --with docs + + - name: Build docs + run: cd docs && poetry run make + + pre-commit: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + + - name: Install poetry + run: pipx install poetry + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install python dependencies + run: poetry install --with pre-commit,docs,dev + + - name: Run pre-commit + run: | + poetry run pre-commit install + poetry run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..53c54bfd --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,52 @@ +name: docs + +on: + push: + branches: [main] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + docs-deploy: + if: github.ref == 'refs/heads/main' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + container: sphinxdoc/sphinx + + steps: + - uses: actions/checkout@v4 + + - name: Install poetry + run: | + apt update + apt upgrade -y + apt install -y pipx + pipx install poetry + + - name: sphinx + run: | + export PATH="$HOME/.local/bin:$PATH" + poetry install --with docs + cd docs + poetry run make html + + - name: upload + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './docs/build/html/.' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4