Skip to content

gptools

gptools #104

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
# Our tests may contain a number of stochastic elements. Setting a seed will make sure they are
# not flaky (but also hide potential issues).
SEED: "0"
cmdstanVersion: "2.31.0"
jobs:
build:
strategy:
fail-fast: false
matrix:
module: ["stan", "torch", "util"]
python-version: ["3.9", "3.10", "3.11"]
name: Package tests and linting
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: |
${{ env.pythonLocation }}
/home/runner/.cmdstan
key: ${{ env.pythonLocation }}-${{ hashFiles(format('{0}/test_requirements.txt', matrix.module)) }}-${{ env.cmdstanVersion }}-v1
- name: Install python dependencies
run: pip install -r ${{ matrix.module }}/test_requirements.txt
- name: Install cmdstanpy
run: python -m cmdstanpy.install_cmdstan --version ${{ env.cmdstanVersion }}
if: matrix.module == 'stan'
- name: Run the tests
run: doit tests:${{ matrix.module }}
- name: Lint the code
run: doit lint:${{ matrix.module }}
- name: Build the documentation
run: doit docs:${{ matrix.module }}
- name: Run doctests
run: doit doctest:${{ matrix.module }}
- name: Build the package
run: doit package:${{ matrix.module }}
- name: Upload the package to test pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
packages_dir: ${{ matrix.module }}/dist
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Upload the package to pypi on `main` only
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'onnela-lab'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ${{ matrix.module }}/dist
skip_existing: true