-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (62 loc) · 2.23 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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