-
Notifications
You must be signed in to change notification settings - Fork 6
164 lines (155 loc) · 4.93 KB
/
ci.yml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: CI/CD
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- created
jobs:
tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python:
- 3.8
pypi_build:
- complete
- only_plotting
- only_postgres
- only_r
- basic
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: before_install
run: |
echo "PYPI_BUILD=${{ matrix.pypi_build }}" >> $GITHUB_ENV
echo "BOTO_CONFIG=/dev/null" >> $GITHUB_ENV
echo "BUILD_OS=${{ matrix.os }}" >> $GITHUB_ENV
pip install wheel
- name: install_linux
if: matrix.os == 'ubuntu-latest'
run: |
bash scripts/linux_install.sh
- name: install_mac
if : matrix.os == 'macos-latest'
run: |
bash scripts/mac_install.sh
- name: install R
if: matrix.pypi_build == 'complete' || matrix.pypi_build == 'only_r'
uses: r-lib/actions/setup-r@v2
with:
r-version: 4.2.0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
- name: python install
run: |
pip install .[test]
mkdir cache
if [ $PYPI_BUILD = 'complete' ]; then
echo "Installing postgres and plotting requirements"
if [ $BUILD_OS = 'macos-latest' ]; then
export LDFLAGS="-L/usr/local/opt/graphviz/lib"
export CPPFLAGS="-I/usr/local/opt/graphviz/include"
elif [ $BUILD_OS = 'ubuntu-latest' ]; then
export LDFLAGS="-L/usr/lib/aarch64-linux-gnu"
export CPPFLAGS="-I/usr/include"
fi
python -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz>=1.10
unset LDFLAGS
unset CPPFLAGS
pip install .[postgres]
pip install .[R]
elif [ $PYPI_BUILD = 'only_postgres' ]; then
echo "Installing postgres requirements"
pip install .[postgres]
elif [ $PYPI_BUILD = 'only_plotting' ]; then
echo "Installing plotting requirements"
if [ $BUILD_OS = 'macos-latest' ]; then
export LDFLAGS="-L/usr/local/opt/graphviz/lib"
export CPPFLAGS="-I/usr/local/opt/graphviz/include"
elif [ $BUILD_OS = 'ubuntu-latest' ]; then
export LDFLAGS="-L/usr/lib/aarch64-linux-gnu"
export CPPFLAGS="-I/usr/include"
fi
python -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz>=1.10
unset LDFLAGS
unset CPPFLAGS
elif [ $PYPI_BUILD = 'only_r' ]; then
echo "Installing R requirements"
pip install .[R]
fi
- name: tests
run: |
if [ $PYPI_BUILD = 'complete' ]; then
python -m pytest
elif [ $PYPI_BUILD = 'only_plotting' ]; then
python -m pytest -m "not postgres"
elif [ $PYPI_BUILD = 'only_postgres' ]; then
python -m pytest -m "not plotting"
elif [ $PYPI_BUILD = 'only_r' ]; then
# r skipif handled internally - only need to specify not postgres or plotting
python -m pytest -m "not postgres and not plotting"
else
python -m pytest -m "not optional"
fi
build-and-publish:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: 'x64'
- name: Install pypa/build
run: |
python -m \
pip install \
build \
sphinx \
myst_parser \
sphinx-rtd-theme \
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: publish to pypi
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: build docs
run: bash scripts/generate_docs.sh || exit 1
- name: publish github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs