Maintenance for continuous integration. #106
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gptools | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
# Needed for pypi using trusted publisher setup. | |
permissions: | |
id-token: write | |
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@v4" | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
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: | |
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' && matrix.python-version == '3.10' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages_dir: ${{ matrix.module }}/dist | |
skip_existing: true |