Skip to content

Unit tests

Unit tests #126

Workflow file for this run

# Workflow based on https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
name: Unit tests
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 9 * * 1,3,5"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.python-version }}; rpy2 ${{ matrix.config.rpy2 }})
strategy:
fail-fast: false
matrix:
config:
- {os: 'ubuntu-20.04', python-version: '3.7', rpy2: 'true'}
- {os: 'ubuntu-latest', python-version: '3.8', rpy2: 'true'}
- {os: 'ubuntu-latest', python-version: '3.8', rpy2: 'false'}
- {os: 'windows-latest', python-version: '3.8', rpy2: 'false'}
- {os: 'macOS-latest', python-version: '3.8', rpy2: 'true'}
- {os: 'ubuntu-latest', python-version: '3.9', rpy2: 'true'}
- {os: 'ubuntu-latest', python-version: '3.10', rpy2: 'true'}
# - {os: 'ubuntu-latest', python-version: '3.11', rpy2: 'true'}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python-version }}
- name: Install vineknockoffs and dependencies
run: |
pip install --editable .
pip install pytest
- name: Set up R
if: matrix.config.rpy2 == 'true'
uses: r-lib/actions/setup-r@v2
- name: Install R packages
if: matrix.config.rpy2 == 'true'
run: |
install.packages(c('glmnet', 'kde1d', 'TSP', 'VineCopula'))
shell: Rscript {0}
- name: Install rpy2
if: matrix.config.rpy2 == 'true'
run: |
pip install rpy2
- name: Test with pytest
if: |
matrix.config.os != 'ubuntu-latest' ||
matrix.config.python-version != '3.8' ||
matrix.config.rpy2 == 'false'
run: |
pytest
- name: Test with pytest and coverage
if: |
matrix.config.os == 'ubuntu-latest' &&
matrix.config.python-version == '3.8' &&
matrix.config.rpy2 == 'true'
run: |
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: |
matrix.config.os == 'ubuntu-latest' &&
matrix.config.python-version == '3.8'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests