Skip to content

Commit

Permalink
CI: Rework workflows to make them a bit easier to maintain (#360)
Browse files Browse the repository at this point in the history
* CI: Simplify workflows that build podio on the fly

- Update version actions
- Use checkout action to get podio
- Use podio setup scripts to set environment
- Enable more podio features

* Use Cmake to invoke the build tool

* CI: simplify the pre-commit action

- Use cmake to invoke build commands to make script a bit shorter

* Use a virtualenv to run pre-commit
  • Loading branch information
tmadlener authored Sep 9, 2024
1 parent b679e64 commit b99ba9f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 58 deletions.
56 changes: 24 additions & 32 deletions .github/workflows/lcg_linux_with_podio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,46 @@ jobs:
"LCG_106/x86_64-el9-gcc13-opt"]
CXX_STANDARD: [20]
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: ${{ matrix.LCG }}
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
cmake .. -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
echo "Building podio @"$(git log -1 --format=%H)
cmake -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
-DENABLE_SIO=ON \
-DENABLE_RNTUPLE=ON \
-DENABLE_DATASOURCE=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
export PYTHONPATH=$(pwd)/install/lib/python3$(python -c 'import sys; print(sys.version_info[1])')/site-packages:$PYTHONPATH
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
-G Ninja -B build
cmake --build build --target install -- -k0
source init.sh && source env.sh
echo "::endgroup::"
echo "::group::Build edm4hep"
cd $STARTDIR
echo "Building edm4hep"
mkdir build install
cd build
cmake .. -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
-DCMAKE_INSTALL_PREFIX=../install \
cmake -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
-DUSE_EXTERNAL_CATCH2=OFF \
-G Ninja
ninja -k0
ctest --output-on-failure
ninja install
cd -
-G Ninja -B build
cmake --build build -- -k0
ctest --test-dir build --output-on-failure
cmake --build build --target install
echo "::endgroup::"
echo "::group::Test downstream usage"
export CMAKE_PREFIX_PATH=$PWD/install:$CMAKE_PREFIX_PATH
cd test/downstream-project-cmake-test
mkdir build
cd build
cmake .. -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
-DCMAKE_INSTALL_PREFIX=../install \
-G Ninja
ninja -k0
cmake -DCMAKE_CXX_STANDARD=${{ matrix.CXX_STANDARD }} \
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
-G Ninja -B build
cmake --build build -- -k0
echo "::endgroup::"
44 changes: 18 additions & 26 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +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
cmake .. -DCMAKE_CXX_STANDARD=20 \
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 && source 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 \
python3 -m venv /root/pre-commit-venv
source /root/pre-commit-venv/bin/activate
pip install pre-commit
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 ..
pip install pre-commit --user
-DUSE_EXTERNAL_CATCH2=OFF -B build
ln -s $(pwd)/build/compile_commands.json ./compile_commands.json
pre-commit run --show-diff-on-failure \
--color=always \
--all-files
Expand Down

0 comments on commit b99ba9f

Please sign in to comment.