Skip to content

Commit

Permalink
Merge branch 'main' into setup-fix-shellinclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
KSkwarczynski authored Nov 25, 2024
2 parents 67cfe57 + 1a1bb85 commit 5403af0
Show file tree
Hide file tree
Showing 59 changed files with 202,001 additions and 458 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/BumpVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Extract the MaCh3 version from CMakeLists.txt
- name: Get MaCh3 version
run: |
MaCh3_version=$(grep -Po '(?<=set\(MaCh3_VERSION )\d+\.\d+\.\d+' MaCh3/CMakeLists.txt)
MaCh3_version=$(grep -Po '(?<=project\(MaCh3 VERSION )\d+\.\d+\.\d+' MaCh3/CMakeLists.txt)
echo "Extracted MaCh3 version: ${MaCh3_version}"
echo "MaCh3_VERSION=${MaCh3_version}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CDImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false # KS: Prevents cancellation of remaining jobs if one fails
matrix:
include:
- os: Alma9
- os: alma9
file: Doc/DockerFiles/Alma9/Dockerfile
tag_latest: alma9latest

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/CIPythonValidations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Performs unit and integration testing

name: Validations Python CI

# The events that trigger the workflow
on:
pull_request:
branches: [ main ]

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest

container:
image: ghcr.io/mach3-software/mach3:alma9latest

steps:
- uses: actions/checkout@v4

- name: Get MaCh3 Validations
run: |
cd /opt/
git clone --branch "${{ github.head_ref }}" https://github.com/mach3-software/MaCh3Tutorial.git MaCh3Validations
- name: Install pytest
working-directory: /opt/MaCh3Validations
run: |
mkdir python-test-modules
pip install -r ./CIValidations/PythonTests/requirements.txt -t python-test-modules/
- name: Validations
working-directory: /opt/MaCh3Validations
run: |
source /opt/root/v6-26-10/bin/thisroot.sh
export PYTHONPATH=$PYTHONPATH:$PWD/python-test-modules/
export MACH3=$PWD
python3 -m pytest --config Inputs/FitterConfig.yaml CIValidations/PythonTests
87 changes: 87 additions & 0 deletions .github/workflows/CIValidations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Performs unit and integration testing

name: Validations CI

# The events that trigger the workflow
on:
pull_request:
branches: [ main ]

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest

name: ${{ matrix.name }}

strategy:
fail-fast: false # Prevents cancellation of remaining jobs if one fails
matrix:
include:
- name: Reweight Validations
test_1: MaCh3CLI --ReweightValidations
test_2: empty
test_3: empty

- name: Covariance Validations
test_1: MaCh3CLI --CovarianceValidations
test_2: empty
test_3: empty

- name: Fitter Validations
test_1: MaCh3CLI --FitterValidations
test_2: empty
test_3: empty

- name: NuMCMC Tools Validations
test_1: MaCh3CLI --NuMCMCToolsValidations
test_2: empty
test_3: empty

container:
image: ghcr.io/mach3-software/mach3:alma9latest

steps:
- uses: actions/checkout@v4


- name: Get MaCh3 Validations
run: |
cd /opt/
git clone --branch "${{ github.head_ref }}" https://github.com/mach3-software/MaCh3Tutorial.git MaCh3Validations
cd MaCh3Validations
mkdir build
cd build
cmake ../ -DMaCh3Tutorial_UNITTESTS_ENABLED=TRUE
- name: Build MaCh3 Validations
run: |
cd /opt/MaCh3Validations/build
make -j4 install # Build the project
- name: Validations
run: |
source /opt/MaCh3Validations/build/bin/setup.MaCh3.sh
source /opt/MaCh3Validations/build/bin/setup.MaCh3Tutorial.sh
cd /opt/MaCh3Validations/build/CIValidations
${{ matrix.test_1 }}
#KS: GHA is stupid when it comes to arrays. I tried something fancy but it was crashing terribly
#If you know how to write this better please let me know
# Run the second test if it is defined
if [[ "${{ matrix.test_2 }}" != "empty" ]]; then
echo " "
echo "Performing Second test"
${{ matrix.test_2 }}
fi
# Run the third test if it is defined
if [[ "${{ matrix.test_3 }}" != "empty" ]]; then
echo " "
echo "Performing Third test"
${{ matrix.test_3 }}
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build/
build*/
96 changes: 0 additions & 96 deletions Apps/NuMCMCconversion.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions Apps/NuMCMCvalidations.sh

This file was deleted.

14 changes: 11 additions & 3 deletions Apps/CMakeLists.txt → CIValidations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@ foreach(app
FitterValidations
CovarianceValidations
MaCh3ModeValidations
SamplePDFValidations
NuMCMCconversion
NuOscillatorInterfaceValidations
)
add_executable(${app} ${app}.cpp)
target_link_libraries(${app} MaCh3Validations::ValidationsUtils)
target_link_libraries(${app} MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::samplePDFTutorial)

add_dependencies(ValidApps ${app})
endforeach(app)

install(PROGRAMS
NuMCMCvalidations.sh
TestNuMCMC.py
MaCh3CLI

DESTINATION Apps)
DESTINATION CIValidations)

install(DIRECTORY
TestOutputs
Scripts

DESTINATION Apps)
DESTINATION CIValidations)

if(MaCh3Tutorial_UNITTESTS_ENABLED)
add_subdirectory(UnitTests)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(int argc, char *argv[])
}

////////////// Normal Xsec //////////////
std::vector<std::string> xsecCovMatrixFile = {"Inputs/SystematicsTest.yaml"};
std::vector<std::string> xsecCovMatrixFile = {"Inputs/SystematicModel.yaml"};
covarianceXsec* xsec = new covarianceXsec(xsecCovMatrixFile, "xsec_cov");

std::vector<double> ParProp = {1.05, 0.90, 1.10, 1.05, 0.25, 1.70, 3.20, -1.10, -1.70};
Expand Down Expand Up @@ -80,7 +80,7 @@ int main(int argc, char *argv[])
////////////// Now Osc //////////////
std::vector<std::string> OscCovMatrixFile = {"Inputs/Osc_Test.yaml"};
covarianceOsc* osc = new covarianceOsc(OscCovMatrixFile, "osc_cov");
std::vector<double> OscParProp = {0.3, 0.5, 0.020, 7.53e-5, 2.494e-3, 0.0, 295, 2.6};
std::vector<double> OscParProp = {0.3, 0.5, 0.020, 7.53e-5, 2.494e-3, 0.0, 295, 2.6, 0.5};
osc->setParameters(OscParProp);
osc->printNominalCurrProp();
outFile << "Likelihood Osc=" << osc->GetLikelihood() << std::endl;
Expand All @@ -90,7 +90,7 @@ int main(int argc, char *argv[])
delete osc;
delete PCA;

bool TheSame = CompareTwoFiles("Apps/TestOutputs/CovarianceOut.txt", "NewCovarianceOut.txt");
bool TheSame = CompareTwoFiles("CIValidations/TestOutputs/CovarianceOut.txt", "NewCovarianceOut.txt");

if(!TheSame) {
MACH3LOG_CRITICAL("Different likelihood mate");
Expand Down
Loading

0 comments on commit 5403af0

Please sign in to comment.