Skip to content

[pre-commit.ci] pre-commit autoupdate #319

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #319

Workflow file for this run

name: Tests
# Test on all pushes, except when the push is literally just a tag (because we
# tag automatically via CI, and therefore there's no extra code in that push).
# Also, only test on pull requests into master.
on:
push:
tags-ignore:
- 'v*'
pull_request:
branches:
- 'master'
- 'main'
jobs:
tests:
if: "!contains(github.event.pull_request.labels.*.name, 'auto-pr')"
env:
ENV_NAME: test-suite
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
name: Testing
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9, "3.10", "3.11"]
defaults:
run:
# Adding -l {0} ensures conda can be found properly in each step
shell: bash -l {0}
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Cache conda
uses: actions/cache@v2
env:
# Increase this value to reset cache if ci/tests.yaml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ matrix.python-version }}-${{ hashFiles('ci/tests.yaml', 'setup.cfg') }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.2.0
with:
# auto-update-conda: true
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: ci/test-env.yml
activate-environment: ${{ env.ENV_NAME }}
channel-priority: strict
use-only-tar-bz2: true
- name: Conda Info
run: |
conda info -a
conda list
PYVER=`python -c "import sys; print('{:d}.{:d}'.format(sys.version_info.major, sys.version_info.minor))"`
if [[ $PYVER != $PYTHON ]]; then
exit 1;
fi
- name: Install 21CMMC
# if: matrix.os == 'ubuntu-latest'
run: |
echo $(which pip)
pip install .[test]
- name: List Environment
run: |
conda list
- name: Run Tests
run: |
python -m pytest --cov=py21cmmc --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}