-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (83 loc) · 2.59 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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