-
Notifications
You must be signed in to change notification settings - Fork 10
177 lines (161 loc) · 6.13 KB
/
cmake.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CMake
on:
push:
branches: [ development ]
pull_request:
# CI runs when new commits are pushed or when draft PR is marked ready for review
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
OMP_NUM_THREADS: 2
CONAN_PRINT_RUN_COMMANDS: 1
CONAN_CPU_COUNT: 2
USE_CONAN: 0
jobs:
build:
# Skip CI if PR is a draft
if: github.event.pull_request.draft == false
name: ${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{matrix.os}}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-14
cc:
- gcc-10
- clang
cxx:
- g++-10
- clang++
mpi:
- "on"
- "off"
omp:
- "on"
- "off"
exclude:
- cc: gcc-10
cxx: clang++
- cc: clang
cxx: g++-10
- os: ubuntu-20.04
cc: clang
cxx: clang++
- os: macos-14
mpi: "on"
# This doesn't seem to work with ONNXrt yet:
- os: macos-14
cxx: g++-10
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Dependencies on Ubunutu
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install openmpi-bin libopenmpi-dev libyaml-cpp-dev ccache
if [[ "$USE_CONAN" = 1 ]]; then
pip install conan
else
sudo apt install libeigen3-dev libtiff-dev
git clone https://github.com/catchorg/Catch2.git -b v3.4.0
mkdir Catch2/build
cd Catch2/build
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${PWD}
make -j$(nproc --ignore 1) install
cd -
fi
- name: Install Dependencies on MacOS
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install libtiff libomp open-mpi eigen libyaml ccache catch2
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
#echo "/opt/homebrew/opt/libomp" >> $GITHUB_PATH
if [[ "$USE_CONAN" = 1 ]]; then
brew install conan
fi
#- name: Install gcc on MacOS
# if: ${{ contains(matrix.os, 'macos') && contains(matrix.cxx, 'g++10') }}
# run: |
# brew install gcc@10
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
#- name: Install Tensorflow API on Ubuntu
# # TODO could this be combined with mac version somehow? if/else?
# if: ${{ contains(matrix.os, 'ubuntu') }}
# uses: UCL/install-tensorflow-action@main
# with:
# version: 2.11.0
# os: linux
#- name: Install Tensorflow API on MacOS
# if: ${{ contains(matrix.os, 'macos') }}
# uses: UCL/install-tensorflow-action@main
# with:
# version: 2.11.0
# os: darwin
- name: Select Python 3.10
# otherwise turtlebrowser/[email protected] fails on macos-14
# ref: https://github.com/turtlebrowser/get-conan/issues/4
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT
- name: Set ccache cache directory
shell: bash
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
- name: Cache ccache files
uses: actions/cache@v3
with:
path: ${{runner.workspace}}/.ccache
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
restore-keys: |
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}
${{ matrix.os }}-${{ matrix.cxx }}
${{ matrix.os }}
- name: Dependencies
run: |
if [[ "$USE_CONAN" = 1 ]]; then
conan profile detect
conan install ${{github.workspace}} -of ${{github.workspace}}/build --build missing -o dompi=${{matrix.mpi}} -o openmp=${{matrix.omp}} -o onnxrt=on -s compiler.cppstd=17
fi
- name: Build
# Build your program with the given configuration.
# The Github Actions machines are dual-core so we can build faster using 2 parallel processes
run: |
if [[ "$USE_CONAN" = 1 ]]; then
conan build ${{github.workspace}} -of ${{github.workspace}}/build -o dompi=${{matrix.mpi}} -o openmp=${{matrix.omp}} -o onnxrt=on -s compiler.cppstd=17
else
export CMAKE_PREFIX_PATH=${{github.workspace}}/Catch2/build/lib/cmake:$CMAKE_PREFIX_PATH
mkdir ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${PWD}
make -j$(nproc --ignore 1) install
fi
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure