Skip to content

updated github action #141

updated github action

updated github action #141

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y graphviz libgraphviz-dev
- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: brew install graphviz
- name: Install pygraphviz on Ubuntu
if: runner.os == 'Linux'
run: python -m pip install pygraphviz
- name: Install pygraphviz on macOS
if: runner.os == 'macOS'
env:
BREW_GRAPHVIZ_PREFIX: $(brew --prefix graphviz)
CFLAGS: -I${BREW_GRAPHVIZ_PREFIX}/include
LDFLAGS: -L${BREW_GRAPHVIZ_PREFIX}/lib
ARCHFLAGS: "-arch x86_64"
run: |
echo "Graphviz is installed at: $BREW_GRAPHVIZ_PREFIX"
echo "CFLAGS: $CFLAGS"
echo "LDFLAGS: $LDFLAGS"
echo "ARCHFLAGS: $ARCHFLAGS"
python -m pip install pygraphviz --no-binary pygraphviz
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
pip install pytest pytest-cov codecov
- name: Check for test files
id: check_tests
run: |
if ls tests/*_test.py 1> /dev/null 2>&1; then
echo "Tests found."
echo "tests-found=true" >> $GITHUB_ENV
else
echo "No tests found. Skipping pytest."
echo "tests-found=false" >> $GITHUB_ENV
fi
- name: Run tests
if: env.tests-found == 'true'
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
run: |
pytest -v --cov=./ --cov-report=xml
- name: Check for coverage report
if: env.tests-found == 'true'
run: |
if [ -f ./coverage.xml ]; then
echo "coverage-found=true" >> $GITHUB_ENV
else
echo "coverage-found=false" >> $GITHUB_ENV
fi
- name: Upload coverage to Codecov
if: env.coverage-found == 'true'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true