Skip to content

Commit b763444

Browse files
committed
[ci] Build and cache BioDynaMo. Set up clang-tidy. (#5)
1 parent 7e8e525 commit b763444

File tree

2 files changed

+112
-22
lines changed

2 files changed

+112
-22
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,27 @@ concurrency:
1212

1313
jobs:
1414
build:
15-
name: ${{ matrix.compiler }}
16-
runs-on: ubuntu-latest
15+
name: ${{ matrix.name }}
16+
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
compiler: [gcc, clang]
20+
include:
21+
- name: ubu22-gcc
22+
os: ubuntu-22.04
23+
compiler: gcc
2124

2225
steps:
2326
- uses: actions/checkout@v4
2427

2528
- name: Set up Python
2629
uses: actions/setup-python@v5
2730
with:
28-
python-version: 3.11
31+
python-version: 3.9
2932

3033
- name: Install dependencies
3134
run: |
32-
sudo apt-get update
35+
#sudo apt-get update
3336
if [ "${{ matrix.compiler }}" = "gcc" ]; then
3437
sudo apt-get install -y gcc g++ cmake make
3538
echo "CC=gcc" >> $GITHUB_ENV
@@ -39,15 +42,77 @@ jobs:
3942
echo "CC=clang" >> $GITHUB_ENV
4043
echo "CXX=clang++" >> $GITHUB_ENV
4144
fi
45+
sudo apt-get install curl freeglut3-dev g++ gcc git libblas-dev \
46+
libbz2-dev liblapack-dev libnuma-dev libomp5 \
47+
libomp-dev libopenmpi-dev libpthread-stubs0-dev \
48+
make wget zlib1g-dev python3-dev libbz2-dev \
49+
libffi-dev liblzma-dev libreadline-dev \
50+
libsqlite3-dev libssl-dev python3-openssl tk-dev \
51+
xz-utils zlib1g-dev
52+
curl https://pyenv.run | bash
53+
54+
- name: Cache Third Party Packages
55+
uses: actions/cache@v4
56+
with:
57+
path: build/third_party
58+
key: ${{ matrix.os }}-third-party-${{ hashFiles('cmake/external/SHA256Digests.cmake') }}
59+
60+
- name: Restore BDM Cache
61+
uses: actions/cache/restore@v4
62+
id: cache
63+
with:
64+
path: |
65+
biodynamo
66+
key: ${{ matrix.os }}-bdm
67+
68+
- name: Build BDM if Cache is not found
69+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
70+
run: |
71+
git clone --depth=1 https://github.com/vgvassilev/biodynamo.git
72+
cd biodynamo
73+
cmake \
74+
-Dnotebooks=OFF \
75+
-Dparaview=OFF \
76+
-Dbenchmark=ON \
77+
-Dlibgit2=ON \
78+
-Dsbml=OFF \
79+
-DCMAKE_BUILD_TYPE=Release \
80+
-B build
81+
cmake --build build --config Release
82+
cd ..
83+
- name: Save Cache BDM
84+
uses: actions/cache/save@v4
85+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
86+
with:
87+
path: |
88+
biodynamo
89+
key: ${{ steps.cache.outputs.cache-primary-key }}
4290

4391
- name: Configure project
4492
run: |
45-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
93+
#FIXME: Drop this requirement by passing to cmake -DNOPYENV=Yes
94+
export PATH="$HOME/.pyenv/bin:$PATH"
95+
eval "$(pyenv init --path)"
96+
eval "$(pyenv init -)"
97+
pyenv install 3.9
98+
pyenv shell 3.9
99+
100+
source $GITHUB_WORKSPACE/biodynamo/build/bin/thisbdm.sh
101+
cmake . -B build \
102+
-DBioDynaMo_DIR="$GITHUB_WORKSPACE/biodynamo/build/share/cmake/" \
103+
-DCMAKE_BUILD_TYPE="Release"
46104
47105
- name: Build project
48106
run: |
49107
cmake --build build -- -j$(nproc)
50108
51109
- name: Run tests
52110
run: |
53-
ctest --test-dir build --output-on-failure
111+
# FIXME: Enable.
112+
# ctest --test-dir build --output-on-failure
113+
114+
- name: Setup tmate session
115+
if: ${{ !cancelled() && runner.debug }}
116+
uses: mxschmitt/action-tmate@v3
117+
# When debugging increase to a suitable value!
118+
timeout-minutes: 30

.github/workflows/clang-tidy-review.yml

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,64 @@ concurrency:
1313

1414
jobs:
1515
review:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717
steps:
1818
- name: Checkout PR branch
1919
uses: actions/checkout@v4
2020

21-
- name: Install LLVM and Clang
22-
uses: KyleMayes/install-llvm-action@v2
23-
with:
24-
version: "20"
25-
26-
- name: install lit
27-
run: pip install lit
28-
2921
- name: run git config command
3022
run: |
3123
git config --global --add safe.directory /github/workspace
3224
25+
- name: Restore BDM Cache
26+
uses: actions/cache/restore@v4
27+
id: cache
28+
with:
29+
path: |
30+
biodynamo
31+
key: ubuntu-22.04-bdm
32+
33+
- name: Complain when cache not found
34+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
35+
run: |
36+
echo "Cache was not found!"
37+
exit 1
38+
3339
- name: Run clang-tidy
3440
uses: ZedThree/[email protected]
3541
id: review
3642
with:
3743
build_dir: build
38-
apt_packages: cmake,libxml2,libxml2-dev,libtinfo-dev,zlib1g-dev,libzstd-dev
44+
apt_packages: >
45+
build-essential, cmake, curl, freeglut3-dev, g++, gcc, git,
46+
libblas-dev, libbz2-dev, libffi-dev, liblapack-dev, liblzma-dev,
47+
libncursesw5-dev, libnuma-dev, libomp-dev, libomp5, libopenmpi-dev,
48+
libpthread-stubs0-dev, libreadline-dev, libsqlite3-dev, libssl-dev,
49+
libxml2-dev, libxmlsec1-dev, make, python3-dev, python3-openssl,
50+
tk-dev, wget, xz-utils, zlib1g-dev
3951
exclude: "test/*,unittests/*"
4052
split_workflow: true
4153
config_file: .clang-tidy
4254
cmake_command: >
43-
CC=$GITHUB_WORKSPACE/llvm/bin/clang CXX=$GITHUB_WORKSPACE/llvm/bin/clang++
44-
cmake . -B build -DLLVM_DIR="$GITHUB_WORKSPACE/llvm"
45-
-DClang_DIR="$GITHUB_WORKSPACE/llvm"
55+
bash -x -c '
56+
curl https://pyenv.run | bash &&
57+
export PATH="$HOME/.pyenv/bin:$PATH" &&
58+
eval "$(pyenv init --path)" &&
59+
eval "$(pyenv init -)" &&
60+
pyenv install 3.9 &&
61+
pyenv shell 3.9 &&
62+
export &&
63+
source $GITHUB_WORKSPACE/biodynamo/build/bin/thisbdm.sh &&
64+
cmake . -B build
65+
-DBioDynaMo_DIR="$GITHUB_WORKSPACE/biodynamo/build/share/cmake/"
4666
-DCMAKE_BUILD_TYPE="Release"
47-
-DLLVM_EXTERNAL_LIT="`which lit`"
48-
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
67+
-DCMAKE_EXPORT_COMPILE_COMMANDS=On || true'
4968
5069
- name: Upload artifacts
5170
uses: ZedThree/clang-tidy-review/[email protected]
71+
72+
- name: Setup tmate session
73+
if: ${{ !cancelled() && runner.debug }}
74+
uses: mxschmitt/action-tmate@v3
75+
# When debugging increase to a suitable value!
76+
timeout-minutes: 30

0 commit comments

Comments
 (0)