Skip to content

Add test

Add test #16

name: Python Package using Conda
on: [push, pull_request]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install lcov
run: sudo apt-get update && sudo apt-get install -y lcov
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true # Ensure conda is updated to the latest version
miniforge-variant: "Mambaforge"
- name: Create conda environment
run: |
source /usr/share/miniconda3/etc/profile.d/conda.sh
conda env create --file environment.yml --name qforte_env
echo "CONDA_ENV_NAME=qforte_env" >> $GITHUB_ENV
- name: Run pre-commit on all files
run: |
source /usr/share/miniconda3/etc/profile.d/conda.sh
conda activate $CONDA_ENV_NAME
pre-commit run --all-files
- name: Compile
run: |
source /usr/share/miniconda3/etc/profile.d/conda.sh
conda activate $CONDA_ENV_NAME
QFORTE_CODECOV=ON python setup.py develop
- name: Test with pytest
run: |
source /usr/share/miniconda3/etc/profile.d/conda.sh
conda activate $CONDA_ENV_NAME
lcov --directory . --zerocounters
cd tests
pytest
ls -la
cd ..
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
lcov --list coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}