generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 18
301 lines (264 loc) · 10.3 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: Build
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- '.github/workflows/build.yml'
- 'ExtLibraries/**'
- 'CMakeLists.txt'
- 'common.cmake'
- 'CMakeSettings.json'
- 'src/**'
- 'scripts/Plot/Pipfile'
env:
# datasource=github-releases depName=ut-issl/c2a-core
C2A_CORE_VERSION: v3.10.1
jobs:
build_s2e_win:
name: Build on Windows VS2022
# VS2022 を使うため
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
use_c2a: ['USE_C2A=OFF', 'USE_C2A=ON']
build_bit: ['BUILD_64BIT=OFF', 'BUILD_64BIT=ON']
steps:
- uses: actions/checkout@v4
- name: checkout C2A core
if: contains(matrix.use_c2a, 'ON')
uses: actions/checkout@v4
with:
path: c2a-core
repository: ut-issl/c2a-core
ref: ${{ env.C2A_CORE_VERSION }}
fetch-depth: 1
- name: setup C2A
if: contains(matrix.use_c2a, 'ON')
shell: cmd
working-directory: c2a-core
run: setup.bat
- name: Configure build for x86
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: show tools version
shell: powershell
run: |
cmake --version
- name: cache extlib
id: cache-extlib
uses: actions/cache@v4
with:
key: extlib-${{ runner.os }}-${{ hashFiles('./ExtLibraries/**') }}-${{ matrix.build_bit }}
path: ./ExtLibraries
- name: build extlib 32bit
if: steps.cache-extlib.outputs.cache-hit != 'true' && matrix.build_bit == 'BUILD_64BIT=OFF'
shell: powershell
working-directory: ./ExtLibraries
run: |
$extlib_dir=(pwd).Path
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR="${extlib_dir}" -D${{ matrix.build_bit }}
cmake --build .
- name: build extlib 64bit
if: steps.cache-extlib.outputs.cache-hit != 'true' && matrix.build_bit == 'BUILD_64BIT=ON'
shell: powershell
working-directory: ./ExtLibraries
run: |
$extlib_dir=(pwd).Path
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR="${extlib_dir}" -D${{ matrix.build_bit }}
cmake --build .
- name: install extlib
if: steps.cache-extlib.outputs.cache-hit != 'true'
shell: powershell
working-directory: ./ExtLibraries
run: |
cmake --install .
- name: check extlib
shell: powershell
working-directory: ./ExtLibraries
run: |
ls cspice
ls cspice/cspice_msvs*/lib
ls cspice/include
ls cspice/generic_kernels
ls nrlmsise00
ls nrlmsise00/lib*
ls nrlmsise00/lib*/libnrlmsise00.lib
ls nrlmsise00/src
- name: copy to settings
if: steps.cache-extlib.outputs.cache-hit == 'true'
shell: powershell
run: |
ls ./settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./settings/environment/cspice"
ls ./settings/environment/cspice
ls ./settings/environment/cspice/generic_kernels/lsk
ls ./settings/environment/cspice/generic_kernels/pck
ls ./settings/environment/cspice/generic_kernels/spk
- name: build 32bit
if: matrix.build_bit == 'BUILD_64BIT=OFF'
shell: cmd
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: build 64bit
if: matrix.build_bit == 'BUILD_64BIT=ON' && matrix.use_c2a == 'USE_C2A=OFF'
shell: cmd
run: |
cl.exe
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DFLIGHT_SW_DIR=./c2a-core -DC2A_NAME=Examples/minimum_user -D${{ matrix.use_c2a }} -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
shell: bash
working-directory: ./settings
run: |
find . -type f -name '*.ini' -exec sed -i 's/..\/..\/logs/.\/logs/g' {} \;
- name: run simulation(SampleSat)
if: matrix.build_bit == 'BUILD_64BIT=OFF' || (matrix.build_bit == 'BUILD_64BIT=ON' && matrix.use_c2a == 'USE_C2A=OFF')
working-directory: ./
run: |
.\Debug\S2E.exe
build_s2e_linux:
name: Build on Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: ['gcc-11 g++-11', 'clang clang++']
build_bit: ['BUILD_64BIT=OFF', 'BUILD_64BIT=ON']
steps:
- uses: actions/checkout@v4
- name: set compiler
id: compiler
run: |
COMPILER="${{ matrix.compiler }}"
read -r -a COMPILER <<< "$COMPILER"
echo "CC=${COMPILER[0]}" >> "$GITHUB_OUTPUT"
echo "CXX=${COMPILER[1]}" >> "$GITHUB_OUTPUT"
- name: install deps
run: |
# FIXME: temporary install gcc-11 in ubuntu:focal
if [[ "${{ steps.compiler.outputs.CC }}" =~ "gcc-11" ]]; then
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
fi
sudo apt-get update
if [[ "${{ steps.compiler.outputs.CC }}" =~ "gcc" ]]; then
sudo apt-get install -y ${{ steps.compiler.outputs.CC }}-multilib \
${{ steps.compiler.outputs.CXX }}-multilib
else
sudo apt-get install -y gcc-multilib g++-multilib
fi
- name: show tools version
run: |
cmake --version
${{ steps.compiler.outputs.CC }} --version
${{ steps.compiler.outputs.CXX }} --version
- name: cache extlib
id: cache-extlib
uses: actions/cache@v4
with:
key: extlib-${{ runner.os }}-${{ hashFiles('./ExtLibraries/**') }}-${{ matrix.build_bit }}
path: ExtLibraries
- name: build extlib
if: steps.cache-extlib.outputs.cache-hit != 'true'
working-directory: ./ExtLibraries
run: |
cmake . -DEXT_LIB_DIR="$(pwd)" -D${{ matrix.build_bit }}
cmake --build .
- name: install extlib
if: steps.cache-extlib.outputs.cache-hit != 'true'
working-directory: ./ExtLibraries
run: |
cmake --install .
- name: check extlib
working-directory: ./ExtLibraries
run: |
ls cspice
ls cspice/cspice_unix*
ls cspice/include
ls cspice/generic_kernels
ls nrlmsise00
ls nrlmsise00/lib*
ls nrlmsise00/lib*/libnrlmsise00.a
ls nrlmsise00/src
- name: copy to settings
if: steps.cache-extlib.outputs.cache-hit == 'true'
run: |
ls ./settings/environment/cspice
cp -r "./ExtLibraries/cspice/generic_kernels" "./settings/environment/cspice"
ls ./settings/environment/cspice
ls ./settings/environment/cspice/generic_kernels/lsk
ls ./settings/environment/cspice/generic_kernels/pck
ls ./settings/environment/cspice/generic_kernels/spk
- name: build
env:
CC: ${{ steps.compiler.outputs.CC }}
CXX: ${{ steps.compiler.outputs.CXX }}
run: |
cmake . -DEXT_LIB_DIR=./ExtLibraries -DEXT_LIB_DIR_FROM_EXE=./ExtLibraries -DSETTINGS_DIR_FROM_EXE=./settings -DCORE_DIR_FROM_EXE=./ -D${{ matrix.build_bit }}
cmake --build .
- name: fix simulation config
working-directory: ./settings
run: |
find . -type f -name '*.ini' -exec sed -i 's/..\/..\/logs/.\/logs/g' {} \;
- name: run simulation(SampleSat)
working-directory: ./
run: |
./S2E
- name: generate graph
working-directory: ./scripts/Plot
run: |
sudo apt-get install -y gnuplot
pip3 install yq
LOG=$(ls ../../logs/logs_*/*.csv)
echo "plot $LOG"
./gen_graph.sh "${LOG}"
ls
ls ./imgs
- name: read python version from Pipfile
id: python-version
working-directory: ./scripts/Plot
run: |
ver=$(grep python_version ./Pipfile | sed -e 's/^python_version\s=\s"\(.*\)"$/\1/')
echo "version=$ver" >> "$GITHUB_OUTPUT"
- uses: actions/[email protected]
with:
python-version: ${{ steps.python-version.outputs.version }}
- name: plot GS visibility
working-directory: ./scripts/Plot
run: |
pip install pipenv
pipenv install
pipenv run pip list
pipenv run python plot_gs_visibility.py --no-gui
ls ./*_gs_visibility.png
- name: upload imgs
id: upload_imgs
working-directory: ./scripts/Plot
if: contains(matrix.compiler, 'clang') && contains(matrix.build_bit, 'OFF') && contains(github.event.pull_request.labels.*.name, 'automation::comment-graph')
run: |
IMG=$(ls ./*_gs_visibility.png)
IMG_URL=$(curl -sL -X POST upload.gyazo.com/upload.cgi -F "imagedata=@${IMG}")
echo "gyazo url: ${IMG_URL}"
IMG_EMBED_URL="${IMG_URL//gyazo/i.gyazo}.png"
echo "gyazo embed url: ${IMG_EMBED_URL}"
echo "IMG_EMBED_URL=${IMG_EMBED_URL}" >> "$GITHUB_OUTPUT"
- name: comment imgs
if: contains(matrix.compiler, 'clang') && contains(matrix.build_bit, 'OFF') && contains(github.event.pull_request.labels.*.name, 'automation::comment-graph')
uses: actions/[email protected]
with:
script: |
const output = `## \`position.png\`
![position](${{ steps.upload_imgs.outputs.IMG_EMBED_URL }})`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})