Ubuntu System CI #2539
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
# Runs the installation tests and valgrind tests in the following cases: | |
# 1) every day at 3 am | |
# 2) a pull request to the master branch | |
name: Ubuntu System CI | |
on: | |
schedule: | |
# Every day at 3 am | |
- cron: '0 3 * * *' | |
pull_request: | |
# Upon pull requests | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set GHA_BRANCH_NAME | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
echo "GHA_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | |
fi | |
if [ "${{ github.event_name }}" = "schedule" ]; then | |
echo "GHA_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
fi | |
echo "GHA_REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV | |
- name: Set OSVERS | |
run: | | |
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') | |
VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"') | |
echo "OSVERS=$ID-$VERSION" >> $GITHUB_ENV | |
- name: Start Xvfb | |
run: | | |
set -e | |
sudo apt update | |
sudo apt-get -y install xvfb | |
XVFBARGS=":99 -ac -screen 0 2560x1440x24" | |
/usr/bin/Xvfb $XVFBARGS >> /tmp/Xvfb.out 2>&1 & | |
disown -ar | |
sleep 3 | |
- name: Install BioDynaMo | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install -y curl | |
curl https://raw.githubusercontent.com/${GHA_REPOSITORY}/${GHA_BRANCH_NAME}/util/install | bash | |
# remove whole bidynamo repository to catch errors related to paths pointing into the build dir | |
mktemp -d | |
find /tmp -iname biodynamo -type d || true | |
rm -rf $(find $(mktemp -d)/../* -maxdepth 1 -iname biodynamo -type d 2>/dev/null) | |
echo "Removed" | |
find /tmp -iname biodynamo -type d || true | |
- name: Checkout BioDynaMo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set INSTALL_DIR | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
echo "INSTALL_DIR=${GITHUB_WORKSPACE}/build" >> $GITHUB_ENV | |
fi | |
if [ "${{ github.event_name }}" = "schedule" ]; then | |
echo "INSTALL_DIR=$(echo ${HOME}/biodynamo-*)" >> $GITHUB_ENV | |
fi | |
- name: Cache pyenv | |
uses: actions/cache@v4 | |
id: pyenv-cache | |
with: | |
path: ~/.pyenv | |
key: ${{ env.OSVERS }}-pyenv-3.9.1 | |
- name: Install pyenv dependency | |
if: steps.pyenv-cache.outputs.cache-hit != 'true' | |
run: | | |
if [ ! -f "$HOME/.pyenv/bin/pyenv" ]; then | |
curl https://pyenv.run | bash | |
fi | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init --path)" | |
eval "$(pyenv init -)" | |
if [ ! -f "$HOME/.pyenv/versions/3.9.1/lib/libpython3.so" ]; then | |
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.1 | |
fi | |
pyenv shell 3.9.1 | |
- name: Cache Third Party Packages | |
uses: actions/cache@v4 | |
with: | |
path: build/third_party | |
key: ${{ env.OSVERS }}-third-party-${{ hashFiles('cmake/external/SHA256Digests.cmake') }} | |
# Set floating point precision | |
- name: Set floating-point-precision | |
run: | | |
if [ "${{ env.OSVERS }}" = "ubuntu-20.04" ]; then | |
echo "REALT=float" >> $GITHUB_ENV | |
fi | |
if [ "${{ env.OSVERS }}" = "ubuntu-22.04" ]; then | |
echo "REALT=double" >> $GITHUB_ENV | |
fi | |
# Don't do this in the `Build BioDynaMo step`, because notebooks might time out in GHA | |
# runners, while waiting for other targets to be compiled. Run notebooks only | |
# if the event is a pull request, and on ubuntu-22.04. | |
- name: Run notebooks | |
shell: bash | |
run: | | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init --path)" | |
eval "$(pyenv init -)" | |
pyenv shell 3.9.1 | |
cmake \ | |
-Dnotebooks=ON \ | |
-Dsbml=OFF \ | |
-Dnuma=OFF \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-Dreal_t=${{ env.REALT }} \ | |
-B build | |
cmake --build build --parallel --config Release --target notebooks -- -j1 | |
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-22.04' | |
- name: Build BioDynaMo | |
shell: bash | |
run: | | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init --path)" | |
eval "$(pyenv init -)" | |
pyenv shell 3.9.1 | |
cmake \ | |
-Dnotebooks=OFF \ | |
-Dparaview=ON \ | |
-Dbenchmark=ON \ | |
-Dlibgit2=ON \ | |
-Dsbml=OFF \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-Dreal_t=${{ env.REALT }} \ | |
-B build | |
cmake --build build --config Release | |
- name: Run valgrind and system tests | |
shell: bash | |
working-directory: build | |
run: | | |
. $INSTALL_DIR/bin/thisbdm.sh | |
sudo git config --system user.name "Test User" | |
sudo git config --system user.email [email protected] | |
export DISPLAY=:99.0 | |
biodynamo new test-sim | |
. ../test/util.inc | |
run_cmake_simulation test-sim | |
make run-valgrind | |
make run-demos |