Make build_s2e_win CI job matrix clearly #2744
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
include: | |
- build_bit: 'BUILD_64BIT=OFF' | |
use_c2a: 'USE_C2A=OFF' | |
- build_bit: 'BUILD_64BIT=OFF' | |
use_c2a: 'USE_C2A=ON' | |
- build_bit: 'BUILD_64BIT=ON' | |
use_c2a: 'USE_C2A=OFF' | |
steps: | |
- uses: actions/[email protected] | |
- name: checkout C2A core | |
if: contains(matrix.use_c2a, 'ON') | |
uses: actions/[email protected] | |
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/[email protected] | |
with: | |
arch: amd64_x86 | |
- name: show tools version | |
shell: powershell | |
run: | | |
cmake --version | |
- name: cache extlib | |
id: cache-extlib | |
uses: actions/[email protected] | |
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' | |
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/[email protected] | |
- 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/[email protected] | |
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 | |
}) |