-
Notifications
You must be signed in to change notification settings - Fork 4
237 lines (229 loc) · 8.77 KB
/
build.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
---
name: "OpenDDW CI"
on:
pull_request:
branches:
- master
push:
branches:
- master
- latest-release
schedule:
- cron: '10 0 * * 0'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
opendds_branch:
- master
- latest-release
runner:
- windows-2022
- windows-2019
- ubuntu-22.04
- ubuntu-20.04
- macos-13
- macos-12
runs-on: ${{ matrix.runner }}
steps:
# Clone git repositories
- name: 'Checkout OpenDDW'
uses: actions/checkout@v4
- name: 'Checkout MPC'
uses: actions/checkout@v4
with:
repository: DOCGroup/MPC
path: MPC
fetch-depth: 1
- name: 'Checkout ACE_TAO'
uses: actions/checkout@v4
with:
repository: DOCGroup/ACE_TAO
ref: ace6tao2
path: ACE_TAO
fetch-depth: 1
- name: 'Checkout OpenDDS'
uses: actions/checkout@v4
with:
repository: OpenDDS/OpenDDS
ref: ${{ matrix.opendds_branch }}
path: OpenDDS
fetch-depth: 1
submodules: true
# Get 3rd-party Dependencies
- name: 'Install openssl and xerces (Linux)'
if: runner.os == 'Linux'
run: |-
sudo apt-get update
sudo apt-get -y install libssl-dev libxerces-c-dev
- name: 'Install xerces (macOS)'
if: runner.os == 'macOS'
run: |-
brew install xerces-c
- name: 'Setup run-vcpkg (Windows)'
if: runner.os == 'Windows'
shell: cmd
run: |
echo { "name": "opendds", "version-string": "github-actions", "dependencies": [ "openssl", "xerces-c" ] } > vcpkg.json
echo VCPKG_DEFAULT_TRIPLET=x64-windows>> %GITHUB_ENV%
echo VCPKG_INSTALLED_DIR=${{ github.workspace }}\vcpkg\installed>> %GITHUB_ENV%
- name: 'Install openssl and xerces (Windows)'
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: 898b728edc5e0d12b50015f9cd18247c4257a3eb
runVcpkgInstall: true
# Set Up Build Environments
- name: 'Set Up MSVC Environment'
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: 'Set environment variables (Linux / macOS)'
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |-
echo "ACE_ROOT=$GITHUB_WORKSPACE/ACE_TAO/ACE" >> $GITHUB_ENV
echo "TAO_ROOT=$GITHUB_WORKSPACE/ACE_TAO/TAO" >> $GITHUB_ENV
echo "DDS_ROOT=$GITHUB_WORKSPACE/OpenDDS" >> $GITHUB_ENV
echo "MPC_ROOT=$GITHUB_WORKSPACE/MPC" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/ACE_TAO/ACE/lib:$GITHUB_WORKSPACE/OpenDDS/lib" >> $GITHUB_ENV
CONFIG_OPTIONS+=" --no-tests --std=c++17 --ipv6 --security"
if [ '${{ runner.os }}' == 'macOS' ]; then
CONFIG_OPTIONS+=" --xerces3=$(brew --prefix xerces-c) --openssl=/usr/local/opt/openssl@1.1"
fi
echo "CONFIG_OPTIONS=$CONFIG_OPTIONS" >> $GITHUB_ENV
export COMPILER_VERSION=$(c++ --version 2>&1 | head -n 1)
echo "COMPILER_VERSION=$COMPILER_VERSION" >> $GITHUB_ENV
echo "OBJ_EXT=\\.o" >> $GITHUB_ENV
TAR_EXE="tar"
MD5_EXE="md5sum"
if [ '${{ runner.os }}' == 'macOS' ]; then
TAR_EXE="gtar"
MD5_EXE="md5 -r"
fi
echo "TAR_EXE=$TAR_EXE" >> $GITHUB_ENV
echo "MD5_EXE=$MD5_EXE" >> $GITHUB_ENV
- name: 'Set environment variables (Windows)'
if: runner.os == 'Windows'
shell: bash
run: |-
echo "ACE_ROOT=$GITHUB_WORKSPACE\\ACE_TAO\\ACE" >> $GITHUB_ENV
echo "TAO_ROOT=$GITHUB_WORKSPACE\\ACE_TAO\\TAO" >> $GITHUB_ENV
echo "DDS_ROOT=$GITHUB_WORKSPACE\\OpenDDS" >> $GITHUB_ENV
echo "MPC_ROOT=$GITHUB_WORKSPACE\\MPC" >> $GITHUB_ENV
CONFIG_OPTIONS+=" --no-tests --std=c++17 --ipv6 --security --xerces3=\"$VCPKG_INSTALLED_DIR\\x64-windows\" --openssl=\"$VCPKG_INSTALLED_DIR\\x64-windows\""
echo "CONFIG_OPTIONS=$CONFIG_OPTIONS" >> $GITHUB_ENV
export COMPILER_VERSION=$("C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -property catalog_productDisplayVersion)
echo "COMPILER_VERSION=$COMPILER_VERSION" >> $GITHUB_ENV
echo "OBJ_EXT=\\.obj" >> $GITHUB_ENV
TAR_EXE="tar"
MD5_EXE="md5sum"
echo "TAR_EXE=$TAR_EXE" >> $GITHUB_ENV
echo "MD5_EXE=$MD5_EXE" >> $GITHUB_ENV
- name: 'Set environment variables (Common)'
shell: bash
run: |-
cd ACE_TAO
export ACE_COMMIT=$(git rev-parse HEAD)
echo "ACE_COMMIT=$ACE_COMMIT" >> $GITHUB_ENV
cd ../OpenDDS
export DDS_COMMIT=$(git rev-parse HEAD)
echo "DDS_COMMIT=$DDS_COMMIT" >> $GITHUB_ENV
export MATRIX_MD5=$(echo "${{ matrix }}" | ${{ env.MD5_EXE }} | cut -d ' ' -f 1)
echo "MATRIX_MD5=$MATRIX_MD5" >> $GITHUB_ENV
export COMPILER_MD5=$(echo "$COMPILER_VERSION" | ${{ env.MD5_EXE }} | cut -d ' ' -f 1)
echo "COMPILER_MD5=$COMPILER_MD5" >> $GITHUB_ENV
export CONFIG_MD5=$(echo "$CONFIG_OPTIONS" | ${{ env.MD5_EXE }} | cut -d ' ' -f 1)
echo "CONFIG_MD5=$CONFIG_MD5" >> $GITHUB_ENV
# Configure and build OpenDDS (using cache)
- name: 'Check Build Cache'
id: cache-build
uses: actions/cache@v4
with:
path: ${{ env.MATRIX_MD5 }}.tar.xz
key: c01_${{ env.MATRIX_MD5 }}_${{ env.COMPILER_MD5 }}_${{ env.ACE_COMMIT }}_${{ env.DDS_COMMIT }}_${{ env.CONFIG_MD5 }}
- name: 'Extract Build Cache'
if: steps.cache-build.outputs.cache-hit == 'true'
shell: bash
run: |
tar xvfJ ${{ env.MATRIX_MD5 }}.tar.xz
- name: 'Configure & Build OpenDDS (Linux / macOS)'
if: steps.cache-build.outputs.cache-hit != 'true' && (runner.os == 'Linux' || runner.os == 'macOS')
shell: bash
run: |-
cd OpenDDS
./configure ${{ env.CONFIG_OPTIONS }}
- name: 'Configure OpenDDS (Windows)'
if: steps.cache-build.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: cmd
run: |-
cd OpenDDS
configure ${{ env.CONFIG_OPTIONS }}
- name: 'Build OpenDDS (Linux / macOS)'
if: steps.cache-build.outputs.cache-hit != 'true' && (runner.os == 'Linux' || runner.os == 'macOS')
shell: bash
run: |-
cd OpenDDS
. setenv.sh
make -j3
- name: 'Build OpenDDS (Windows)'
if: steps.cache-build.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: cmd
run: |-
cd OpenDDS
call setenv.cmd
msbuild -p:Configuration=Debug,Platform=x64 -m DDS_TAOv2.sln
- name: 'Create Build Cache'
if: steps.cache-build.outputs.cache-hit != 'true'
shell: bash
run: |
cd ACE_TAO
find . -iname "*$OBJ_EXT" | xargs rm
git clean -xdfn | cut -d ' ' -f 3- | sed 's/^/ACE_TAO\//g' | tee ../ACE_TAO_files.txt
cd ..
$TAR_EXE cvf ${{ env.MATRIX_MD5 }}.tar ACE_TAO/ACE/ace/config.h
cat ACE_TAO_files.txt | xargs $TAR_EXE uvf ${{ env.MATRIX_MD5 }}.tar
cd OpenDDS
find . -iname "*$OBJ_EXT" | xargs rm
git clean -xdfn | cut -d ' ' -f 3- | sed 's/^/OpenDDS\//g' | tee ../OpenDDS_files.txt
cd ..
cat OpenDDS_files.txt | xargs $TAR_EXE uvf ${{ env.MATRIX_MD5 }}.tar
xz -3 ${{ env.MATRIX_MD5 }}.tar
- name: 'Show OpenDDS Configuration'
run: |
cd OpenDDS
perl tools/scripts/show_build_config.pl
# Build OpenDDW
- name: 'Set Up Problem Matcher (Windows)'
if: runner.os == 'Windows'
uses: ammaraskar/msvc-problem-matcher@0.3.0
- name: 'Set Up Problem Matcher (Linux / macOS)'
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: ammaraskar/gcc-problem-matcher@0.3.0
- name: 'Build OpenDDW (Linux / macOS)'
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |-
cd OpenDDS
. setenv.sh
cd ..
mkdir build
cd build
cmake ..
cmake --build .
- name: 'Build OpenDDW (Windows)'
if: runner.os == 'Windows'
shell: cmd
run: |-
cd OpenDDS
call setenv.cmd
cd ..
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=%VCPKG_INSTALLED_DIR%\x64-windows ..
cmake --build .