Skip to content

Commit

Permalink
Fix the pre-commit workflow (#449)
Browse files Browse the repository at this point in the history
* Switch to a newer LCG stack with root 6.28/00

* Try with key4hep nightlies

* Allow git to run necessary commands for pre-commit

* Fix clang-format complaints

* Fix clang-tidy complaints

* Reorder some imports to make pylint happy again

* Enbale building RNTuple support in more workflows
  • Loading branch information
tmadlener authored Jul 13, 2023
1 parent c13ada8 commit eb9276b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 38 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ jobs:
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: aidasoft/run-lcg-view@v4
with:
release-platform: LCG_102/x86_64-centos7-clang12-opt
container: centos7
view-path: /cvmfs/sw-nightlies.hsf.org/key4hep
run: |
echo "::group::Setup pre-commit"
export PYTHONPATH=$(python -m site --user-site):$PYTHONPATH
export PATH=/root/.local/bin:$PATH
# Newer versions of git are more cautious around the github runner
# environment and without this git rev-parse --show-cdup in pre-commit
# fails
git config --global --add safe.directory $(pwd)
pip install pre-commit
# Use virtualenv from the LCG release
pip uninstall --yes virtualenv
pip install pylint==2.12.2
pip install flake8
echo "::endgroup::"
echo "::group::Run CMake"
mkdir build
cd build
cmake .. -DENABLE_SIO=ON \
-DENABLE_RNTUPLE=ON \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror "\
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ jobs:
strategy:
fail-fast: false
matrix:
sio: [ON]
LCG: ["LCG_102/x86_64-centos7-clang12-opt",
"LCG_102/x86_64-centos8-gcc11-opt",
"dev3/x86_64-centos7-clang12-opt",
RNTUPLE: [ON]
LCG: ["dev3/x86_64-centos7-clang12-opt",
"dev4/x86_64-centos7-gcc11-opt",
"dev4/x86_64-centos7-clang12-opt"]
include:
- LCG: "LCG_102/x86_64-centos7-clang12-opt"
RNTUPLE: OFF
- LCG: "LCG_102/x86_64-centos8-gcc11-opt"
RNTUPLE: OFF
steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
Expand All @@ -29,7 +32,8 @@ jobs:
echo "::group::Run CMake"
mkdir build install
cd build
cmake -DENABLE_SIO=${{ matrix.sio }} \
cmake -DENABLE_SIO=ON \
-DENABLE_RNTUPLE=${{ matrix.RNTUPLE }} \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror -Wno-error=deprecated-declarations " \
Expand Down
4 changes: 2 additions & 2 deletions python/podio/root_io.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
"""Python module for reading root files containing podio Frames"""

from podio.base_reader import BaseReaderMixin

from ROOT import gSystem
gSystem.Load('libpodioRootIO') # noqa: E402
from ROOT import podio # noqa: E402 # pylint: disable=wrong-import-position

from podio.base_reader import BaseReaderMixin # pylint: disable=wrong-import-position

Writer = podio.ROOTFrameWriter


Expand Down
4 changes: 2 additions & 2 deletions python/podio/sio_io.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3
"""Python module for reading sio files containing podio Frames"""

from podio.base_reader import BaseReaderMixin # pylint: disable=wrong-import-position

from ROOT import gSystem
ret = gSystem.Load('libpodioSioIO') # noqa: 402
# Return values: -1 when it doesn't exist and -2 when there is a version mismatch
if ret < 0:
raise ImportError('Error when importing libpodioSioIO')
from ROOT import podio # noqa: 402 # pylint: disable=wrong-import-position

from podio.base_reader import BaseReaderMixin # pylint: disable=wrong-import-position

Writer = podio.SIOFrameWriter


Expand Down
2 changes: 1 addition & 1 deletion python/podio_class_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import jinja2

from podio_schema_evolution import DataModelComparator # dealing with cyclic imports
from podio.podio_config_reader import PodioConfigReader
from podio.generator_utils import DataType, DefinitionError, DataModelJSONEncoder
from podio_schema_evolution import DataModelComparator # dealing with cyclic imports

THIS_DIR = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIR = os.path.join(THIS_DIR, 'templates')
Expand Down
2 changes: 1 addition & 1 deletion src/EventStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool EventStore::get(uint32_t id, CollectionBase*& collection) const {
}

void EventStore::registerCollection(const std::string& name, podio::CollectionBase* coll) {
m_collections.push_back({name, coll});
m_collections.emplace_back(name, coll);
auto id = m_table->add(name);
coll->setID(id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ROOTReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ CollectionBase* ROOTReader::readCollectionData(const root_utils::CollectionBranc
collection->setID(id);
collection->prepareAfterRead();

m_inputs.emplace_back(std::make_pair(collection, name));
m_inputs.emplace_back(collection, name);
return collection;
}

Expand Down
21 changes: 0 additions & 21 deletions src/SIOBlockUserData.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "podio/SIOBlockUserData.h"

//#define PODIO_ADD_USER_TYPE_SIO(type) static UserDataSIOBlock<type> _default##type##CollcetionSIOBlock ;

namespace podio {

static SIOBlockUserData<float> _defaultfloatCollcetionSIOBlock;
Expand All @@ -18,22 +16,3 @@ static SIOBlockUserData<uint32_t> _defaultuint32_tCollcetionSIOBlock;
static SIOBlockUserData<uint64_t> _defaultuint64_tCollcetionSIOBlock;

} // namespace podio

// g++ -E ../src/SIOBlockUserData.cc
// PODIO_ADD_USER_TYPE_SIO(int)
// PODIO_ADD_USER_TYPE_SIO(long)
// PODIO_ADD_USER_TYPE_SIO(float)
// PODIO_ADD_USER_TYPE_SIO(double)
// PODIO_ADD_USER_TYPE_SIO(unsigned)
// PODIO_ADD_USER_TYPE_SIO(unsigned int)
// PODIO_ADD_USER_TYPE_SIO(unsigned long)
// PODIO_ADD_USER_TYPE_SIO(char)
// PODIO_ADD_USER_TYPE_SIO(short)
// PODIO_ADD_USER_TYPE_SIO(long long)
// PODIO_ADD_USER_TYPE_SIO(unsigned long long)
// PODIO_ADD_USER_TYPE_SIO(int16_t)
// PODIO_ADD_USER_TYPE_SIO(int32_t)
// PODIO_ADD_USER_TYPE_SIO(int64_t)
// PODIO_ADD_USER_TYPE_SIO(uint16_t)
// PODIO_ADD_USER_TYPE_SIO(uint32_t)
// PODIO_ADD_USER_TYPE_SIO(uint64_t)
2 changes: 1 addition & 1 deletion src/SchemaEvolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void SchemaEvolution::registerEvolutionFunc(const std::string& collType, SchemaV
// structure and update the index
if (typeIt->second.index == MapIndex::NoEvolutionAvailable) {
typeIt->second.index = m_evolutionFuncs.size();
m_evolutionFuncs.emplace_back(EvolFuncVersionMapT{});
m_evolutionFuncs.emplace_back();
}

// From here on out we don't need the mutabale any longer
Expand Down

0 comments on commit eb9276b

Please sign in to comment.