Skip to content

Commit

Permalink
Improving tests (#325)
Browse files Browse the repository at this point in the history
* Adding OS(centos7,alma9,ubuntu) in CI tests

* ubuntu -> ubuntu22

* Removing new lines

* Running tests in parallel
  • Loading branch information
kjvbrt authored Dec 13, 2023
1 parent ec34141 commit a75bd6f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linux
name: 'Build and Test'

on: [push, pull_request]

Expand All @@ -8,42 +8,48 @@ jobs:
strategy:
fail-fast: false
matrix:
SETUP: ['/cvmfs/sw.hsf.org/key4hep/setup.sh', '/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh']
STACK: ['/cvmfs/sw.hsf.org/key4hep/setup.sh',
'/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh']
OS: ['aidasoft/centos7',
'key4hep/key4hep-images/alma9',
'key4hep/key4hep-images/ubuntu22']
steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
- name: Start container
run: |
docker run -it --name CI_container -v ${GITHUB_WORKSPACE}:/Package -v /cvmfs:/cvmfs:shared -d ghcr.io/aidasoft/centos7:latest /bin/bash
docker run -it --name CI_container \
-v ${GITHUB_WORKSPACE}:/Package \
-v /cvmfs:/cvmfs:shared \
-d ghcr.io/${{ matrix.OS }}:latest /bin/bash
- name: CMake Configure
run: |
docker exec CI_container /bin/bash -c 'cd Package;\
mkdir -p build install;\
source ${{ matrix.SETUP }};\
source ${{ matrix.STACK }};\
cd build;\
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " -DWITH_DD4HEP=ON -DWITH_ACTS=ON -DWITH_ONNX=ON -G Ninja ..;'
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " -DWITH_DD4HEP=ON -DWITH_ACTS=ON -DWITH_ONNX=ON -G Ninja ..;'
- name: Compile
run: |
docker exec CI_container /bin/bash -c 'cd ./Package;\
source ${{ matrix.SETUP }};\
source ${{ matrix.STACK }};\
cd build;\
ninja -k0;'
- name: Install
run: |
docker exec CI_container /bin/bash -c 'cd ./Package;\
source ${{ matrix.SETUP }};\
source ${{ matrix.STACK }};\
cd build;\
ninja -k0 install;'
- name: Test
run: |
docker exec CI_container /bin/bash -c 'cd ./Package;\
source ${{ matrix.SETUP }};\
source ${{ matrix.STACK }};\
cd build;\
ninja -k0 && ctest --output-on-failure;'
- name: Test using local Setup.sh
run: |
docker exec CI_container /bin/bash -c 'cd ./Package
source ${{ matrix.SETUP }}
source ./setup.sh
fccanalysis run examples/FCCee/higgs/mH-recoil/mumu/analysis_stage1.py --output myoutput.root --files-list root://eospublic.cern.ch//eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/p8_ee_Zbb_ecm91_EvtGen_Bc2TauNuTAUHADNU/events_131527278.root
'
docker exec CI_container /bin/bash -c 'cd ./Package;\
source ${{ matrix.STACK }};\
source ./setup.sh;\
fccanalysis run examples/FCCee/higgs/mH-recoil/mumu/analysis_stage1.py --output myoutput.root --files-list root://eospublic.cern.ch//eos/experiment/fcc/ee/generation/DelphesEvents/spring2021/IDEA/p8_ee_Zbb_ecm91_EvtGen_Bc2TauNuTAUHADNU/events_131527278.root'
2 changes: 1 addition & 1 deletion examples/FCCee/test/jet_constituents.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
prodTag = "FCCee/spring2021/IDEA/"

#Optional: output directory, default is local running directory
outputDir = "."
outputDir = "outputs/jet_constituents"

#Optional
nCPUS = 8
Expand Down
5 changes: 4 additions & 1 deletion examples/FCCee/weaver/analysis_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ def get_file_path(url, filename):

# ____________________________________________________________

## input file needed for unit test in CI
## input file needed for unit test in CI
testFile = "https://fccsw.web.cern.ch/fccsw/testsamples/wzp6_ee_nunuH_Hss_ecm240.root"

## output directory
outputDir = "outputs/inference"

## latest particle transformer model, trainied on 9M jets in winter2023 samples
model_name = "fccee_flavtagging_edm4hep_wc_v1"

Expand Down
6 changes: 6 additions & 0 deletions python/Parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ def setup_test_parser(parser):
type=str,
help='Exclude tests matching regular expression'
)
test_args.add_argument(
'-j', '--parallel',
type=int,
default=-1,
help='number of tests running in parallel (equivalent to `ctest -j`)'
)


def setup_pin_parser(parser):
Expand Down
4 changes: 4 additions & 0 deletions python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ def test_fccanalyses(mainparser):
ctest_command.append('-E')
ctest_command.append(args.exclude_regex)

if args.parallel != -1:
ctest_command.append('-j')
ctest_command.append(str(args.parallel))

run_subprocess(ctest_command, local_dir + '/build')

0 comments on commit a75bd6f

Please sign in to comment.