diff --git a/.github/workflows/ci_testing.yml b/.github/workflows/ci_testing.yml index fee3c9bff76bef7f10e4d932b4a7b9382f1cf909..ed7d7280ad8dc7c300d6ee1d1f58025e30233d08 100644 --- a/.github/workflows/ci_testing.yml +++ b/.github/workflows/ci_testing.yml @@ -4,30 +4,56 @@ on: pull_request: branches: - master + push: + branches: + - master jobs: - Continuous-Integration: - runs-on: ubuntu-latest + Build-and-Test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + python-version: ["3.7", "3.8", "3.9"] + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v2 + with: + submodules: true - uses: conda-incubator/setup-miniconda@v2 with: miniconda-version: "latest" activate-environment: ale environment-file: environment.yml + auto-activate-base: false + auto-update-conda: true + python-version: ${{ matrix.python-version }} + - name: Check build environment + run: | + conda list - name: Install Python Package run: | python setup.py install - name: Test Python Package run: | - pytest tests/pytests -vv + pytest --cov-report=xml --cov=ale tests/pytests -vv - name: Build C++ Package run: | mkdir -p build cd build - cmake -DCMAKE_BUILD_TYPE=RELEASE .. + cmake -DCMAKE_BUILD_TYPE=RELEASE -DCOVERAGE=ON .. cmake --build . - name: Test C++ Package run: | + cd build ctest -VV - + - name: Upload Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26de9b5d613ab227d2b3125234931fb84e6e3f4b..0000000000000000000000000000000000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -language: cpp -sudo: false - -branches: - only: - - master - -matrix: - include: - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-7 - env: - - MATRIX_EVAL="CXX=g++-7 && CC=gcc-7" - - os: osx - osx_image: xcode9.4 - env: - - MATRIX_EVAL="CXX=clang++ && CC=clang" - -before_install: - - echo "$TRAVIS_PULL_REQUEST" - - eval "${MATRIX_EVAL}" - - | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - pip install --user cpp-coveralls; - fi - -install: - # Install a supported cmake version (>= 3.10) - - | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - else - curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh; - fi - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - conda config --set always_yes yes - - conda env create -n ale - - conda env update -f environment.yml -n ale - - source activate ale - - conda install pytest - -script: - - PYTHONPATH=. pytest tests/pytests -vv - - python setup.py install # install to use python lib in c code - - mkdir -p build - - cd build - - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCOVERAGE=ON .. - - cmake --build . - - ctest -VV - -after_success: - - | - if [ "$TRAVIS_OS_NAME" == linux ]; then - coveralls --root $(dirname $PWD) -i src/ --verbose; - fi diff --git a/environment.yml b/environment.yml index b86dfe6e6ec425adb0a08075a661ed89ce021fbc..2d4e741ad2c6d4affc5376e729cb3b3440b6b933 100644 --- a/environment.yml +++ b/environment.yml @@ -18,5 +18,6 @@ dependencies: - spiceypy>=2.3.0 - pyyaml - pytest + - pytest-cov - networkx - breathe diff --git a/tests/pytests/conftest.py b/tests/pytests/conftest.py index 9c336380bda1c244f50fe1d4743800014e33d57d..ea183c9aab2f27be958d98805b061fe36cc7bb2b 100644 --- a/tests/pytests/conftest.py +++ b/tests/pytests/conftest.py @@ -5,13 +5,13 @@ import warnings import numpy as np import json import pvl +from glob import glob +from pathlib import Path import ale from ale.base.data_isis import read_table_data -from glob import glob - class SimpleSpice(): def scs2e(self, *args): return 0.1 @@ -73,8 +73,7 @@ def compare_dicts(ldict, rdict): differences.append(f'Values of key {key} are not equal {item} : {rdict[key]}.') return differences -ale_root = os.path.split(ale.__file__)[0] -data_root = os.path.join(ale_root, '../tests/pytests/data') +data_root = os.path.join(Path(__file__).parent.absolute(), 'data') dirs = next(os.walk(data_root, topdown=True))[1] dirs = [d for d in dirs if not d.startswith('.')] image_2_data = {}