TST: updating action scripts #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and coverage | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runs-on: [macos-latest, windows-latest, ubuntu-latest] | |
python-version: [3.8, 3.9, '3.10', '3.11'] | |
runs-on: ${{ matrix.runs-on }} | |
env: | |
MPLBACKEND: Agg | |
USE_COVERAGE: ${{ matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.10' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setting up OpenMP for Linux | |
if: matrix.runs-on == 'ubuntu-latest' | |
run: | | |
sudo apt-get update; sudo apt-get install -y libomp5 libomp-dev | |
- name: Setting up OpenMP for MAC-OS | |
if: matrix.runs-on == 'macos-latest' | |
run: | | |
brew update | |
brew install libomp | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r ci_requirements.txt | |
python3 -m pip install --upgrade -r ci_requirements.txt | |
- name: Install module for coverage | |
if: env.USE_COVERAGE == 'true' | |
run: | | |
export CYTHON_TRACE_NOGIL=1 | |
python3 setup.py build_ext --inplace --force --define CYTHON_TRACE_NOGIL | |
- name: Install module | |
if: env.USE_COVERAGE == 'false' | |
run: | | |
python3 -m pip install . | |
# - name: Lint with flake8 | |
# run: | | |
# pip install flake8 | |
# # stop the build if there are Python syntax errors or undefined names | |
# flake8 ./compmech --count --select=E9,F63,F7,F82 --show-source --statistics | |
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
# flake8 ./compmech --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest and coverage report | |
if: env.USE_COVERAGE == 'true' | |
run: | | |
coverage run -m pytest compmech | |
coverage report | |
- name: Test with pytest | |
if: env.USE_COVERAGE == 'false' | |
run: | | |
pytest compmech | |
- name: Upload coverage to Codecov | |
if: env.USE_COVERAGE == 'true' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true |