Skip to content

add formatting and linting python in pre-commit #935

add formatting and linting python in pre-commit

add formatting and linting python in pre-commit #935

Workflow file for this run

name: pre-commit
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- 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"
cd podio
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 -B build
cmake --build build --target install
source init.sh && source env.sh
echo "::endgroup::"
echo "::group::Run pre-commit"
cd $STARTDIR
python3 -m venv /root/pre-commit-venv
source /root/pre-commit-venv/bin/activate
pip install pre-commit ruff
cmake -DENABLE_SIO=ON \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror "\
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-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
echo "::endgroup::"