-
Notifications
You must be signed in to change notification settings - Fork 146
151 lines (139 loc) · 5.41 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
name: CI
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
test-on-ubuntu:
if: github.event.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
python: [python3.8, python3.9, python3.10, python3.11]
compiler:
- C: gcc-11
CXX: g++-11
package: g++-11
repos: ['"ppa:ubuntu-toolchain-r/test"']
include:
# gcc 5
- os: ubuntu-20.04
python: python3.8
compiler:
C: gcc-5
CXX: g++-5
package: g++-5
repos:
- '"deb http://us.archive.ubuntu.com/ubuntu/ bionic main"'
- '"deb http://us.archive.ubuntu.com/ubuntu/ bionic universe"'
# Clang 7
- os: ubuntu-20.04
python: python3.8
compiler:
C: clang-7
CXX: clang++-7
package: clang-7
repos: []
# Clang 15
- os: ubuntu-22.04
python: python3.10
compiler:
C: clang-15
CXX: clang++-15
package: clang-15
repos: []
steps:
- name: Checkout
uses: actions/checkout@v3
# - Installing software-properties-common adds add-apt-repository
- name: Update install tools
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common curl
# - Adding matrix.compiler.repos is needed to have compiler available on all ubuntu versions
- name: Install C and CXX compilers
run: |
for repo in ${{ join(matrix.compiler.repos, ' ') }}
do
sudo add-apt-repository -y "$repo"
done
sudo apt-get install -y ${{ matrix.compiler.package }}
# - ppa:deadsnakes/ppa is needed to have python3.x-dev available on all ubuntu versions
# - python3.x-dev is used instead of python3.x because the -dev version includes python header
# files needed to compile C extension modules
- name: Install python
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get install -y \
${{ matrix.python }}-dev \
${{ matrix.python }}-distutils \
${{ matrix.python }}-venv
curl https://bootstrap.pypa.io/get-pip.py | ${{ matrix.python }}
pip install --upgrade setuptools
- name: Install general build dependencies
run: |
sudo apt-get install -y \
doxygen \
libgmp-dev \
pandoc
# NOTE(brad): libunwind-dev is a broken dependency of libgoogle-glog-dev, itself
# a dependency of ceres. Without this step on jammy, apt-get install libgoogle-glog-dev
# would fail. If this step could be removed and still have the build succeed, it should.
- name: Fix libunwind-dev install on jammy
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get install -yf libunwind-dev
- name: Install build dependencies for SymForce benchmarks
run: |
sudo apt-get install -y \
libboost-dev \
libboost-serialization-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libboost-program-options-dev \
libboost-date-time-dev \
libboost-timer-dev \
libboost-chrono-dev \
libboost-regex-dev \
libgoogle-glog-dev \
libeigen3-dev
- name: Install python dependencies
run: pip install -r dev_requirements.txt
- name: Run cmake build
run: |
cmake -B build \
-D CMAKE_C_COMPILER=${{ matrix.compiler.C }} \
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.CXX }} \
-D "SYMFORCE_COMPILE_OPTIONS=-Wall;-Wextra;-Werror" \
-D SYMFORCE_PYTHON_OVERRIDE=${{ matrix.python }} \
-D SYMFORCE_BUILD_BENCHMARKS=ON
cmake --build build -j $(nproc)
# - lcmtypes need to be available for tests
# - Exact contents of dev_requirements.txt depend on python version. Need to update file to
# match current python version to avoid failure of corresponding gen test. symforce needs
# to be on the PYTHONPATH to run gen test in this manner.
- name: Run tests
run: |
pip install build/lcmtypes/python2.7
export PYTHONPATH=$PYTHONPATH:$(pwd)
${{ matrix.python }} test/symforce_requirements_test.py --update
EXIT_CODE=0
ctest --test-dir build -j $(nproc) || EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
ctest --test-dir build -j $(nproc) --rerun-failed --output-on-failure
fi
# Upload the docs as an artifact
# To view, download the `docs` artifact from the build and matrix entry you're interested in
# (probably any is good, assuming they all pass)
# Unzip to a directory and run `npx http-server` in that directory
- name: Upload Generated Docs
uses: actions/upload-artifact@v3
with:
name: docs ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.compiler.C }}
path: build/docs