Skip to content

Introduce threads buffer (#15) #58

Introduce threads buffer (#15)

Introduce threads buffer (#15) #58

name: Build tests and archive executable
on:
pull_request:
push:
branches:
- "main"
- "add-clang-format-check"
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
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
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
- 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 linting
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 }}