-
Notifications
You must be signed in to change notification settings - Fork 6
157 lines (132 loc) · 4.75 KB
/
ubuntu.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
name: UbuntuStressTest
on:
pull_request:
jobs:
test_ubuntu:
name: Ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [ 3.8, 3.9, "3.10", "3.11" ]
os: [ ubuntu-22.04 ]
compiler: [gcc, clang14]
rust: [1.62.1]
defaults:
run:
shell: bash
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Install apt dependencies
run: |
sudo apt install --fix-missing -y libgsl-dev cmake autoconf libboost-test-dev libboost-program-options-dev
- name: Install cbindgen
uses: baptiste0928/cargo-install@v2
with:
crate: cbindgen
version: "=0.24.3"
- name: rustc version
run: |
rustc --version
- name: cbindgen version
run: |
cbindgen --version
- name: Edit PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set GCC as compiler
if: matrix.compiler == 'gcc'
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Install clang-14
if: matrix.compiler == 'clang14'
run: |
sudo apt-get install clang-14 clang++-14
echo "CC=clang-14" >> $GITHUB_ENV
echo "CXX=clang++-14" >> $GITHUB_ENV
- name: Discover llvm-config
run: |
dpkg -S llvm-config
- name: Set LLVM_CONFIG on 22.04
if: matrix.os == 'ubuntu-22.04'
run: |
echo "LLVM_CONFIG=/usr/bin/llvm-config" >> $GITHUB_ENV
# - name: Set LLVM_CONFIG on 18.04
# if: matrix.os == 'ubuntu-18.04'
# run: |
# echo "LLVM_CONFIG=/usr/lib/llvm-9/bin/llvm-config" >> $GITHUB_ENV
- name: Python version
run: |
python --version
- name: Cache pip dependancies
id: cache
uses: actions/cache@v3
with:
path: |
~/.local
key: ${{ runner.os }}-${{ matrix.python }}-ubuntu-V3-${{ hashFiles('requirements/development.txt') }}
- name: Install pip dependencies
# if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --user --upgrade pip
# These are needed to install black:
python -m pip install --user --upgrade setuptools wheel
python -m pip install --user -r requirements/development.txt
# For sdist validation
python -m pip install --user --upgrade twine
# Needed so that we don't affect building any pip dependencies with these flags
- name: Set CPPFLAGS for C++ builds
run: |
echo "CPPFLAGS=-Wextra -Weffc++ -Woverloaded-virtual -Wold-style-cast -Werror=effc++ -Werror=old-style-cast -Werror=overloaded-virtual -Werror=unused-parameter" >> $GITHUB_ENV
- name: Build
run: |
cmake -E env CPPFLAGS="$CPPFLAGS" \
cmake -E env CC="$CC" \
cmake -E env CXX="$CXX" cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_CPP_UNIT_TESTS=ON -DBUILD_CPP_BENCHMARK=ON -DBUILD_PYTHON_UNIT_TESTS=ON -DDISABLE_LTO=ON
cmake --build build -j 4
- name: Run C++ tests
run: |
cmake --build build -t test
- name: Manualy run setuptools_scm
run: |
python -m setuptools_scm
- name: Run Python tests
run: |
python -m pytest -n 2 tests
python -m pytest -n 2 tests_with_cpp
- name: Build and run examples/plugin
run: |
CPPFLAGS=$CPPFLAGS CC=$CC CXX=$CXX PYTHONPATH=. cmake examples/plugin
make
PYTHONPATH=. python examples/plugin/test_plugin.py
- name: Validate the sdist
run: |
python setup.py sdist
python setup.py check
python -m twine check dist/*.tar.gz
rm -rf dist/*.tar.gz
- name: Test pip install from dist in fresh venv
run: |
python -m pip install --upgrade setuptools pip wheel build
python -m build . --config-setting=--disable_lto
cd dist
python -m venv venv
source venv/bin/activate
which python
python -m pip install --no-cache-dir ./fwdpy11*-linux*.whl
python -m fwdpy11 --includes
python -c "import fwdpy11;print(fwdpy11.__version__)"
python -c "import fwdpy11;print(fwdpy11.__file__)"