Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 101 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,121 @@
name: build

env:
# Use the same ssh-agent socket value across all jobs
# Useful when a GH action is using SSH behind-the-scenes
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ '**' ]
branches: ['**']
workflow_dispatch:

jobs:
build:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.9'
experimental: false
- python-version: '3.10'
experimental: false
- python-version: '3.11'
experimental: false
- python-version: '3.12'
experimental: false
- python-version: '3.13'
experimental: false
- python-version: '3.14'
experimental: true
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v3
# Start ssh-agent but set it to use the same ssh_auth_sock value.
# The agent will be running in all steps after this, so it
# should be one of the first.
- name: Set up Python 3.8
uses: actions/setup-python@master
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: setup.py

- name: Install dependencies (Python 3.8-3.10)
if: contains(fromJSON('["3.8", "3.9", "3.10"]'), matrix.python-version)
run: |
python -m pip install --upgrade pip
pip install "numpy<2" matplotlib
pip install torch torchvision torchaudio
pip install .[dev]

- name: Install dependencies (Python 3.11+)
if: ${{ !contains(fromJSON('["3.8", "3.9", "3.10"]'), matrix.python-version) }}
run: |
python -m pip install --upgrade pip
pip install matplotlib
pip install numpy
pip install torch==1.11.0+cpu torchvision==0.12.0+cpu torchaudio==0.11.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install "numpy<2"
pip install torch torchvision torchaudio
pip install .[dev]
pip install sphinx
pip install sphinx-book-theme
pip install myst-nb
cd doc
make html linkcheck
- name: Test

- name: Run tests with coverage
run: |
coverage run -m pytest
coverage xml
- name: Codecov
uses: codecov/codecov-action@v3
coverage xml -o coverage-${{ matrix.python-version }}.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload to github pages 🚀
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
fail_ci_if_error: false
files: coverage-${{ matrix.python-version }}.xml
flags: py${{ matrix.python-version }}
name: tests-py${{ matrix.python-version }}

docs:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: setup.py

- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install sphinx sphinx-book-theme myst-nb

- name: Build docs and check links
run: make -C doc html linkcheck

- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
folder: doc/_build/html # The folder the action should deploy.
path: doc/_build/html

deploy-docs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: docs
permissions:
pages: write
id-token: write

environment:
name: github-pages

steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
Loading
Loading