-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 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
name: CI - Python
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.8", "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