-
Notifications
You must be signed in to change notification settings - Fork 8
159 lines (157 loc) · 6.24 KB
/
run_tests.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
name: Test package & measure coverage
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
tests:
#####----- RUN FULL TEST SUITE WITHOUT COVERAGE
# Test through actual installations for end-to-end testing including
# packaging.
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-12, macos-13, macos-14]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
env:
CLONE_PATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OpenMPI
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
sudo apt-get update
sudo apt-get -y install openmpi-bin
elif [ "${{ runner.os }}" == "macOS" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install open-mpi
fi
- name: Setup base Python environment
run: |
$CLONE_PATH/.github/workflows/setup_base_python.sh ${{ runner.os }}
python -m pip install build
- name: Run tests without coverage
run: |
which mpirun
which mpicxx
mpicxx -show
echo " "
pushd $CLONE_PATH
# Since the package is pure Python, the binary wheel should be
# universal. Therefore, all pip installs from PyPI should get the
# wheel rather than the source distribution and we test the wheel.
python -m build --wheel
python -m pip install dist/Taweret-*-py3-none-any.whl
python -c "import Taweret ; Taweret.__version__ ; Taweret.test()"
pushd $(dirname $(which python))/../lib/python*/site-packages/openbtmixing/.libs
echo " "
if [ "${{ matrix.os }}" == "ubuntu-20.04" ]; then
ldd openbtcli
# For 20.04/OpenMPI 4.0.3,
# mpicxx uses -L/usr/lib/x86_64-linux-gnu/openmpi/lib.
# However ldd uses /lib/x86_64-linux-gnu/libmpi.so.40.
# Ultimately, it looks like we use
# /lib/x86_64-linux-gnu/openmpi/lib/libmpi.so.40.20.3
# Note that there is a
# /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so.40.20.3
# that has the same size (1124440) as the system version.
#
# My best guess is that the OpenMPI install is going to both
# /lib and /usr/lib. Indeed, if you don't install OpenMPI Taweret
# fails, which suggests no system MPI.
#
# These lines can be used to confirm that OpenMPI is being used
# correctly at build and execution time.
#echo " "
#ls -la /usr/lib/x86_64-linux-gnu/openmpi/lib
#echo " "
#ls -la /lib/x86_64-linux-gnu/libmpi*
#echo " "
#ls -la /lib/x86_64-linux-gnu/openmpi/lib
#echo " "
elif [ "${{ matrix.os }}" == "ubuntu-22.04" ]; then
ldd openbtcli
# For 22.04/OpenMPI 4.1.2,
# mpicxx uses -L/usr/lib/x86_64-linux-gnu/openmpi/lib.
# However ldd uses /lib/x86_64-linux-gnu/libmpi.so.40.
# Ultimately, it looks like we use
# /lib/x86_64-linux-gnu/libmpi.so.40.30.2
# and I don't find any general MPI libraries in the locations
# specified by mpicxx.
#
# My best guess is that the OpenMPI install is going to just
# /lib and that there are being found by the compiler
# automatically. Indeed, if you don't install OpenMPI Taweret
# fails, which suggests no system MPI. This would imply that
# mpicxx is assuming that the system install will be found but it
# needs to identify where the (mostly) mca libs are.
#
# These lines can be used to confirm that OpenMPI is being used
# correctly at build and execution time.
#echo " "
#ls -la /usr/lib/x86_64-linux-gnu/openmpi/lib/openmpi3
#echo " "
#ls -la /lib/x86_64-linux-gnu/libmpi*
#echo " "
#ls -la /lib/x86_64-linux-gnu/openmpi/lib/openmpi3
#echo " "
elif [ "${{ runner.os }}" == "macOS" ]; then
otool -L openbtcli
fi
echo " "
objdump -p openbtcli
echo " "
popd
popd
coverage:
#####----- RUN FULL TEST SUITE WITH COVERAGE
# Use local editable/developer mode installation so that we are testing such
# installations. For some code coverage services, this can also improve
# the information that they present through their web interface.
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
env:
CLONE_PATH: ${{ github.workspace }}
# These two are used internally by tox
COVERAGE_XML: ${{ github.workspace }}/coverage.xml
COVERAGE_HTML: ${{ github.workspace }}/htmlcov
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OpenMPI
run: |
sudo apt-get update
sudo apt-get -y install openmpi-bin
- name: Setup base Python environment
run: |
$CLONE_PATH/.github/workflows/setup_base_python.sh ${{ matrix.os }}
- name: Run tests with coverage
run: |
pushd $CLONE_PATH
tox -r -e coverage,report
popd
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.KEVIN_CODECOV_TOKEN }}
slug: bandframework/Taweret
file: ${{ env.COVERAGE_XML }}
fail_ci_if_error: true
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-results
path: |
${{ env.COVERAGE_XML }}
${{ env.COVERAGE_HTML }}