-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (154 loc) · 7.12 KB
/
build_executable.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
name: Build tests and archive executable
on:
pull_request:
push:
branches:
- "main"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
schedule: # This is a weekly schedule, running only on the "main" branch every Sunday at midnight
- cron: '0 0 * * 0'
# Make sure that there is one job per branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container: ubuntu:24.04
steps:
# Checkout this repository
- name: Checkout repository
uses: actions/checkout@v4
# Checkout storm dependency (to switch to the official one once support for sin/cos is integrated)
- name: Checkout STORM
uses: actions/checkout@v4
with:
repository: moves-rwth/storm
# Temporary fixed commit. Remove once we switch to the official storm repo
ref: master
path: external_dependencies/storm
# Enable ccache
- name: ccache
uses: hendrikmuhs/[email protected]
# install the dependencies
- name: Install dependencies
run: |
sudo apt install build-essential git cmake libboost-all-dev libcln-dev libgmp-dev libginac-dev automake libglpk-dev libhwloc-dev libz3-dev libxerces-c-dev libeigen3-dev libgtest-dev
- name: Get STORM last commit hash
- name: Configure linters
run: |
sudo apt install clang clang-tidy clang-format g++-12 gcc-12
echo "---- Print info about clang ----"
clang-14 -v
echo "---- Print info about clang-format ----"
clang-format-14 --version
echo "---- Print info about clang-tidy ----"
clang-tidy-14 --version
id: get-storm-commit
run: |
cd external_dependencies/storm
echo storm_hash="$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get cached storm build
id: get-storm-cache
uses: actions/cache@v4
with:
path: external_dependencies/storm/build
key: storm-build-${{ steps.get-storm-commit.outputs.storm_hash }}
- name: Build Storm
if: steps.get-storm-cache.outputs.cache-hit != 'true'
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir external_dependencies/storm/build
cd external_dependencies/storm/build
cmake -DSTORM_USE_SPOT_SHIPPED=ON ..
make storm-cli
- name: Build smc_storm
run: |
export STORM_BUILD_DIR=$PWD/external_dependencies/storm/build
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -Dstorm_DIR=$STORM_BUILD_DIR
make
- name: Run linters
run: |
./scripts/check-clang-style.bash
- name: Run tests
run: |
cd build
ctest
- name: Copy lib and executables in deploy folder
run: |
# List all existing dependencies of libstorm
echo "libstorm dependencies:"
ldd external_dependencies/storm/build/lib/libstorm.so
mkdir deployment
cd deployment
# Copy the dependencies
mkdir 3rd_party
cp ../external_dependencies/storm/build/lib/libstorm.so 3rd_party
cp ../external_dependencies/storm/build/lib/libstorm-parsers.so 3rd_party
cp ../external_dependencies/storm/build/resources/3rdparty/carl/libcarl.so.14.28 3rd_party
cp ../external_dependencies/storm/build/resources/3rdparty/spot/lib/libspot.so.0 3rd_party
cp ../external_dependencies/storm/build/resources/3rdparty/spot/lib/libbddx.so.0 3rd_party
# Copy the smc_storm lib
mkdir lib
cp ../build/lib/libsmc_storm_lib.so lib
mkdir bin
cp ../build/bin/smc_storm bin
- name: Generate install script
run: |
cd deployment
cat << EOF > install.sh
#!/bin/bash
# Check if --install-dependencies is set
if [[ "\$1" == "--install-dependencies" ]]; then
# Check if we need to prepend sudo
if [[ \$(id -u) -ne 0 ]]; then
SUDO=sudo DEBIAN_FRONTEND=noninteractive
else
# Required only when running in docker, as root
export DEBIAN_FRONTEND=noninteractive
fi
# Install the dependencies
\$SUDO apt update
\$SUDO apt install -y --no-install-recommends chrpath libboost-all-dev libcln-dev libgmp-dev libginac-dev libglpk-dev libhwloc-dev libz3-dev libxerces-c-dev libeigen3-dev libgtest-dev
fi
SOURCE=\$( cd -- "\$( dirname -- "\${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
chrpath -r \$SOURCE/3rd_party \$SOURCE/3rd_party/libspot.so.0
chrpath -r \$SOURCE/3rd_party \$SOURCE/3rd_party/libstorm.so
chrpath -r \$SOURCE/3rd_party \$SOURCE/3rd_party/libstorm-parsers.so
chrpath -r \$SOURCE/3rd_party \$SOURCE/lib/libsmc_storm_lib.so
chrpath -r \$SOURCE/3rd_party:\$SOURCE/lib \$SOURCE/bin/smc_storm
chmod a+x \$SOURCE/bin/smc_storm
EOF
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: smc_storm_executable
path: deployment
if-no-files-found: error
retention-days: 10
overwrite: true
release:
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
name: smc_storm_executable
- name: Generate tar file
run: |
cd ${{ steps.download-artifact.outputs.download-path }}
chmod +x install.sh
tar -czf smc_storm_executable.tar.gz *
- uses: softprops/action-gh-release@v2
with:
files: ${{ steps.download-artifact.outputs.download-path }}/smc_storm_executable.tar.gz
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}