-
Notifications
You must be signed in to change notification settings - Fork 10
153 lines (124 loc) · 4.87 KB
/
python-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
name: Python CI
on: [pull_request]
jobs:
build:
name: ${{ matrix.name }} ${{ matrix.build_type }} Python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
PYTHON_VERSION: ${{ matrix.python_version }}
strategy:
fail-fast: false
matrix:
# Github Actions requires a single row to be added to the build matrix.
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
name: [ubuntu-22.04-gcc-9, ubuntu-22.04-clang-12, macOS-12-xcode-14.2]
build_type: [Debug, Release]
python_version: [3]
include:
- name: ubuntu-22.04-gcc-9
os: ubuntu-22.04
compiler: gcc
version: "9"
- name: ubuntu-22.04-clang-12
os: ubuntu-22.04
compiler: clang
version: "12"
- name: ubuntu-22.04-clang-12
os: ubuntu-22.04
compiler: clang
version: "12"
build_type: Debug
python_version: "3"
- name: macOS-12-xcode-14.2
os: macOS-12
compiler: xcode
version: "14.2"
steps:
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
# For SDFormat
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
sudo apt-get -y update
sudo apt-get -y install libtbb-dev libboost-all-dev libsdformat12-dev
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
brew install boost
brew tap osrf/simulation
brew install sdformat12
- name: Python Dependencies
run: |
# Install dependencies for gtwrap
pip3 install -U pip setuptools numpy pyparsing pyyaml "pybind11-stubgen>=2.5.1"
- name: GTSAM (Linux)
if: runner.os == 'Linux'
run: |
# Clone gtsam
git clone https://github.com/borglab/gtsam.git $GITHUB_WORKSPACE/gtsam
cd $GITHUB_WORKSPACE/gtsam
# Build & Install gtsam
mkdir build && cd $_
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON ..
sudo make -j6 install
sudo make python-install
sudo ldconfig
cd $GITHUB_WORKSPACE # go back to home directory
# Clean up after ourselves since we used `sudo`.
sudo rm -rf $GITHUB_WORKSPACE/gtsam
- name: GTSAM (macOS)
if: runner.os == 'macOS'
run: |
# Install gtsam
git clone https://github.com/borglab/gtsam.git /Users/runner/work/gtsam
cd /Users/runner/work/gtsam
mkdir build && cd $_
cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python3 ..
make -j$(sysctl -n hw.physicalcpu) install && make python-install
cd $GITHUB_WORKSPACE # go back to home directory
- name: Checkout
uses: actions/checkout@v2
- name: Build Directory
run: mkdir build
- name: Configure (Linux)
if: runner.os == 'Linux'
run: |
cmake -DGTDYNAMICS_BUILD_PYTHON=ON ..
working-directory: ./build
- name: Configure (macOS)
if: runner.os == 'macOS'
run: |
cmake -DGTDYNAMICS_BUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python3 ..
working-directory: ./build
- name: Build
run: make -j4
working-directory: ./build
- name: Install
run: sudo make -j4 python-install
working-directory: ./build
- name: Test
run: make -j4 python-test
working-directory: ./build