-
Notifications
You must be signed in to change notification settings - Fork 15
131 lines (112 loc) · 3.49 KB
/
build.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
# -----------------------
#
# Run a full build-and-test from the git repo
# using a combination of conda and pip to install
# all optional dependencies.
#
# This is the 'full' test suite.
#
# -----------------------
name: Build and test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
conda:
name: Python ${{ matrix.python-version }} (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os:
- macOS
- Ubuntu
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ${{ matrix.os }}-latest
# this is needed for conda environments to activate automatically
defaults:
run:
shell: bash -el {0}
steps:
- name: Get source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache conda packages
uses: actions/cache@v1
env:
# increment to reset cache
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ matrix.python-version}}-${{ env.CACHE_NUMBER }}
- name: Configure conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
channels: conda-forge
python-version: ${{ matrix.python-version }}
# this is needed for caching to work properly:
use-only-tar-bz2: true
- name: Conda info
run: conda info --all
- name: Install build dependencies
run: |
conda install --quiet --yes \
c-compiler \
coverage \
cython \
lalsuite \
numpy \
pip \
setuptools \
;
python -m pip install -r requirements.txt
- name: Install SBank
# notes:
# - `--coverage` enables coverage reporting for the C library
# - CYTHON_LINETRACE=1 enables coverage reporting for the Cython library
# - we use `--editable .` so that the Cython library is installed in-place,
# which helps with the coverage
# - `-vv` gives us verbose output for the compilation,
# - `--no-build-isolation` tells pip not to ignore the already-installed
# build requirements, which greatly cuts down on the output from `-vv`
run: CFLAGS="${CFLAGS} --coverage" CYTHON_LINETRACE=1 python -m pip install --editable . --no-build-isolation -vv
- name: Package list
run: conda list --name test
- name: Run test suite
run: python -m pytest -ra --color yes --pyargs sbank --cov sbank --cov-report= --junitxml=pytest.xml
- name: Run command-line tests
run: |
for script in ${CONDA_PREFIX}/bin/sbank*; do
python -m coverage run \
--append \
--source=sbank \
${script} --help
done
- name: Run short sbank executable tests
run: bash tools/test_sbank.sh
- name: Coverage report
run: python -m coverage report --show-missing
- name: Prepare codecov upload
run: |
# covert report to XML (codecov can't handle sqlite, probably)
python -m coverage xml
rm -fv .coverage
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v2
with:
flags: ${{ runner.os }},python${{ matrix.python-version }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: pytest-${{ matrix.os }}-${{ matrix.python-version }}
path: pytest.xml