-
Notifications
You must be signed in to change notification settings - Fork 2
175 lines (147 loc) · 5.26 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
165
166
167
168
169
170
171
172
173
174
175
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
name: test${{ matrix.name-suffix }} (${{ matrix.os }}, ${{ matrix.build-type }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release, Debug]
name-suffix: [""]
include:
- build-type: Debug
env:
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON
BUILD_TYPE: ${{ matrix.build-type }}
steps:
- uses: actions/checkout@v2
- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy
- name: 📁 Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]
then
export CMAKE_FLAGS="$CMAKE_FLAGS -DOVF_BUILD_FORTRAN_BINDINGS=ON"
fi
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: 🧪 Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --output-on-failure --verbose
test-coverage:
runs-on: ubuntu-latest
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=ON
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: 📁 Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config Release -j 2
- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install coverage numpy 'coveralls<3' wheel
sudo apt update
sudo apt install lcov
- name: Generate C++ coverage
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -i --no-external --directory . --base-directory $GITHUB_WORKSPACE -o baseline.info
make test
lcov -c --no-external --directory . --base-directory $GITHUB_WORKSPACE -o after_test.info
lcov -a baseline.info -a after_test.info -o total_test.info
lcov -r total_test.info \*thirdparty\* \*/test/\* \*Collection\* \*DLL_\* -o coverage.info
- name: Upload C++ coverage
uses: codecov/codecov-action@v1
with:
files: ${{runner.workspace}}/build/coverage.info
- name: Python API coverage
working-directory: ./python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage run --source ovf --omit=ovf/ovflib.py setup.py test > cov.txt
head cov.txt
coverage report -m
coverage xml
coveralls
deploy-pypi:
if: github.event_name != 'pull_request'
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=OFF
OVF_ADD_VERSION_SUFFIX: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Configure environment
shell: bash
if: github.ref == 'refs/heads/master'
run: echo "OVF_ADD_VERSION_SUFFIX=false" >> $GITHUB_ENV
- name: Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy setuptools wheel twine
- name: Build python package
shell: bash
working-directory: ./python
run: |
echo "Python package build"
echo "Add suffix to ovf version tag for python package $OVF_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel
- name: 🚀 Deploy to TestPyPI
working-directory: ./python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*
- name: 🚀 Deploy to PyPI
working-directory: ./python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*