Skip to content

Commit

Permalink
CI: simplify the pre-commit action
Browse files Browse the repository at this point in the history
- Use cmake to invoke build commands to make script a bit shorter
  • Loading branch information
tmadlener committed Sep 9, 2024
1 parent 154a07d commit 40ca23c
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,39 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: AIDASoft/podio
path: podio
- uses: cvmfs-contrib/github-action-cvmfs@v4
- uses: aidasoft/run-lcg-view@v4
with:
release-platform: LCG_104/x86_64-el9-clang16-opt
run: |
STARTDIR=$(pwd)
echo "::group::Build podio"
echo "Building podio @"$(git log -1 --format=%H)
git clone --depth 1 https://github.com/AIDASoft/podio
cd podio
mkdir build install
cd build
echo "Building podio @"$(git log -1 --format=%H)
cmake .. -DCMAKE_CXX_STANDARD=20 \
-DENABLE_SIO=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \
-G Ninja
ninja -k0
ninja install
cd ..
export ROOT_INCLUDE_PATH=$(pwd)/install/include:$ROOT_INCLUDE_PATH:$CPATH
unset CPATH
export CMAKE_PREFIX_PATH=$(pwd)/install:$CMAKE_PREFIX_PATH
export LD_LIBRARY_PATH=$(pwd)/install/lib:$(pwd)/install/lib64:$LD_LIBRARY_PATH
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
-G Ninja -B build
cmake --build build --target install
source init.sh && env.sh
echo "::endgroup::"
echo "::group::Run pre-commit"
cd $STARTDIR
export PYTHONPATH=$(python -m site --user-site):$PYTHONPATH
export PATH=/root/.local/bin:$PATH
pip install argparse --user
mkdir build
cd build
cmake .. -DENABLE_SIO=ON \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror "\
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_EXTERNAL_CATCH2=OFF
ln -s $(pwd)/compile_commands.json ../
cd ..
-DUSE_EXTERNAL_CATCH2=OFF -B build
ln -s $(pwd)/build/compile_commands.json ./compile_commands.json
pip install pre-commit --user
pre-commit run --show-diff-on-failure \
--color=always \
Expand Down

0 comments on commit 40ca23c

Please sign in to comment.