Skip to content

Commit

Permalink
Add GitHub Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Feb 7, 2024
1 parent 6255604 commit 7083480
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 )
52 changes: 52 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7083480

Please sign in to comment.