Skip to content

Build

Build #19

Workflow file for this run

name: Build
on:
push:
pull_request:
schedule:
- cron: '42 4 5,20 * *'
env:
CACHE_NUMBER: 0 # increase to reset cache manually
jobs:
run-tests:
name: Run tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ['3.5', '3.9.1', '3']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set cache date
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV
- uses: actions/cache@v3
id: pip-cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pip-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v3
id: cmdstan-cache
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan
restore-keys: |
${{ runner.os }}-cmdstan
- name: Install requirements
run: pip install -r pip-requirements.txt
- name: Install cmdstan
if: steps.cmdstan-cache.outputs.cache-hit != 'true'
run: install_cmdstan
- run: pip uninstall cmdstancache || true
- name: Lint
# stop the build if there are Python syntax errors or undefined names
run: flake8 cmdstancache.py --show-source
- name: Install
run: pip install .[plot]
- name: Test
run: coverage run -m pytest .
- name: Convert coverage output to lcov for coveralls
# coverage-lcov requires python 3.6, so we cannot upload results
# from python 2 and 3.5 builds :-(
if: ${{ !((matrix.python-version == '2.7') || (matrix.python-version == '3.5')) }}
run: |
coverage-lcov
# make paths relative
sed -i s,$PWD/,,g lcov.info
- name: prepare coveralls partial upload
if: ${{ !((matrix.python-version == '2.7') || (matrix.python-version == '3.5')) }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: lcov.info
flag-name: run-${{ matrix.python-version }}
parallel: true
finish:
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true