Skip to content

Commit

Permalink
Use Conda environment for testing and cancel stale jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Aug 11, 2021
1 parent 7ba3541 commit d800708
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
pull_request:
branches: [ main ]

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
changes:
name: "Check for changes"
Expand Down Expand Up @@ -55,21 +62,43 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
python-version: ${{ matrix.python-version }}
auto-update-conda: true

- name: Install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
mamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" theano-pymc mkl numpy scipy pip mkl-service
if [[ "${{ matrix.pymc3-version }}" != "stable" ]]; then pip install "pymc3 @ git+https://github.com/pymc-devs/pymc3.git@master"; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
mamba list && pip freeze
python -c 'import theano; print(theano.config.__str__(print_doc=False))'
python -c 'import theano; assert(theano.config.blas__ldflags != "")'
env:
PYTHON_VERSION: ${{ matrix.python-version }}

- name: Test with pytest
shell: bash -l {0}
run: |
pytest tests --cov=pymc3_hmm --cov-report=xml:./coverage.xml
pytest -x -r A --verbose tests --cov=pymc3_hmm --cov-report=xml:./coverage.xml
env:
MKL_THREADING_LAYER: GNU
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1

- name: Fetch main for coverage diff
shell: bash -l {0}
run: |
git fetch --no-tags --prune origin main
- name: Check coverage
shell: bash -l {0}
run: |
diff-cover ./coverage.xml --compare-branch=origin/main --fail-under=100 --diff-range-notation '..'

0 comments on commit d800708

Please sign in to comment.