Skip to content

TST: Switch to pytest to get more info on test issues #404

TST: Switch to pytest to get more info on test issues

TST: Switch to pytest to get more info on test issues #404

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a
# variety of Python versions. For more information see:
# https://help.github.com/actions/language-and-framework-guides/
# using-python-with-github-actions
name: Pytest with Flake8
on:
pull_request:
push:
schedule:
- cron: "0 3 * * 1" # Runs 03:00 UT on Mondays
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
numpy_ver: ["latest"]
include:
# Support different GA Mac environments
- python-version: "3.9"
os: "macos-13"
numpy_ver: "latest"
- python-version: "3.12"
os: "macos-13"
numpy_ver: "latest"
- python-version: "3.9"
os: "macos-latest"
numpy_ver: "latest"
- python-version: "3.12"
os: "macos-latest"
numpy_ver: "latest"
# NEP29 compliance settings
- python-version: "3.10"
numpy_ver: "1.25"
os: "ubuntu-latest"
test_config: "NEP29"
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Windows-specific dependencies for non-pip install
if: ${{ matrix.os == 'windows-latest' }}
run: |
choco install ninja mingw
choco install rtools --no-progress
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
gfortran --version
pip install flake8 meson-python pytest pytest-cov pytest-xdist scipy
pip install "numpy>=1.19.5"
- name: Install standard dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install -r requirements.txt
- name: Install NEP29 dependencies
if: ${{ matrix.numpy_ver != 'latest'}}
run: |
pip install --no-binary :numpy: numpy==${{ matrix.numpy_ver }}
- name: Set up pysat
run: |
mkdir pysatData
python -c "import pysat; pysat.params['data_dirs'] = 'pysatData'"
- name: Test PEP8 compliance
run: flake8 . --count --select=D,E,F,H,W --show-source --statistics
- name: Evaluate complexity
run: flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Install on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
pip install --upgrade-strategy only-if-needed .
- name: Install on MacOS-13
if: ${{ matrix.os == 'macos-13' }}
run: |
brew reinstall gcc@14
CC=/usr/local/bin/gcc-14 pip install --upgrade-strategy only-if-needed .
- name: Install on MacOS-Latest
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew reinstall gcc@14
CC=/opt/homebrew/bin/gcc-14 pip install --upgrade-strategy only-if-needed .
- name: Install on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
meson setup build
ninja -j 2 -C build
cd build
meson install --destdir=${{ env.Python3_ROOT_DIR }}
- name: Run unit and integration tests Mac/Linux
if: ${{ matrix.os != 'windows-latest' }}
run: |
rm -rf ./OMMBV
cd ..
coverage run -m pytest
coverage report
coverage xml
mv coverage.xml ./OMMBV/.
- name: Run unit and integration tests on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
rm ./OMMBV -r -force
cd ..
pytest ./OMMBV/tests -v --cov
coverage report
coverage xml
mv coverage.xml .\OMMBV\.
- name: Publish results to coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
run: coveralls --rcfile=setup.cfg --service=github
finish:
name: Finish Coverage Analysis
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install --upgrade coveralls
coveralls --service=github --finish