Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pre-commit checks and format files #48

Merged
merged 7 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ DerivePointerAlignment: false
PointerAlignment: Left

IndentWidth: 4
ColumnLimit : 110
ColumnLimit: 110
6 changes: 6 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://cmake-format.readthedocs.io/en/latest/configuration.html

format:
tab_size: 4
separate_ctrl_name_with_space: true
separate_fn_name_with_space: false
244 changes: 124 additions & 120 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ defaults:
jobs:
framework-validation:
uses: rest-for-physics/framework/.github/workflows/validation.yml@master

libCheck:
name: Validate library
runs-on: ubuntu-latest
container:
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
steps:
- uses: actions/checkout@v3
- run: python3 pipeline/validateLibrary.py .
- run: python3 pipeline/validateLibrary.py .

build-axionlib:
name: Build only axionlib
Expand All @@ -43,6 +43,10 @@ jobs:
with:
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_AXION=ON -DREST_MPFR=ON"
branch: ${{ env.BRANCH_NAME }}
- name: Verify pre-commit config files match
run: |
cd $GITHUB_WORKSPACE
curl https://raw.githubusercontent.com/rest-for-physics/framework/master/scripts/validatePreCommitConfig.py | python
- name: Cache framework installation
id: axionlib-install-cache
uses: actions/cache@v3
Expand Down Expand Up @@ -79,25 +83,25 @@ jobs:
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
needs: [ build-axionlib ]
steps:
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: Basic physics tests
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/physics/
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.nff
wget https://sultan.unizar.es/axionlib-data/bufferGas/Ne.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/Ne.nff
wget https://sultan.unizar.es/axionlib-data/bufferGas/bufferGases.rml
wget https://sultan.unizar.es/axionlib-data/magneticField/fields.rml
wget https://sultan.unizar.es/axionlib-data/magneticField/Bykovskiy_201906.dat
restRoot -b -q AxionPhysicsValidation.C
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: Basic physics tests
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/physics/
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.nff
wget https://sultan.unizar.es/axionlib-data/bufferGas/Ne.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/Ne.nff
wget https://sultan.unizar.es/axionlib-data/bufferGas/bufferGases.rml
wget https://sultan.unizar.es/axionlib-data/magneticField/fields.rml
wget https://sultan.unizar.es/axionlib-data/magneticField/Bykovskiy_201906.dat
restRoot -b -q AxionPhysicsValidation.C
Metadata:
name: Check metadata
Expand All @@ -106,63 +110,63 @@ jobs:
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
needs: [ build-axionlib ]
steps:
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: Magnetic field
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/magneticField/
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
wget https://rest-for-physics.github.io/axionlib-data/magneticField/Bykovskiy_201906.dat
python magneticField.py
cd trilinear
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
restRoot -b -q GetMagneticField_test.C
cd ../boundary/
restRoot -b -q Boundaries_test.C
- name: Optics Mirrors
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/optics.rml
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/mirrors.rml
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_C_30_SiO2_0.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_C_30_SiO2_0.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
python mirrors.py
- name: MCPL Optics
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/optics.rml
python mcpl.py
- name: X-ray transmission
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/transmission/
wget https://rest-for-physics.github.io/axionlib-data/transmission/windows.rml
wget https://rest-for-physics.github.io/axionlib-data/transmission/Al.sol
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si.sol
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si3N4.sol
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.REST_PATH }}/mpfr-4.0.2/install/lib
python windowPlot.py
- name: Solar flux
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/solarFlux/
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/fluxes.rml
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Dummy_Galan_202202.spt
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Primakoff_Gianotti_201904.dat
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Primakoff_LennertHoof_202203.dat
python solarTests.py
python solarPlot.py
python compare.py
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: Magnetic field
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/magneticField/
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
wget https://rest-for-physics.github.io/axionlib-data/magneticField/Bykovskiy_201906.dat
python magneticField.py
cd trilinear
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
restRoot -b -q GetMagneticField_test.C
cd ../boundary/
restRoot -b -q Boundaries_test.C
- name: Optics Mirrors
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/optics.rml
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/mirrors.rml
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_C_30_SiO2_0.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_C_30_SiO2_0.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
python mirrors.py
- name: MCPL Optics
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/optics.rml
python mcpl.py
- name: X-ray transmission
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/transmission/
wget https://rest-for-physics.github.io/axionlib-data/transmission/windows.rml
wget https://rest-for-physics.github.io/axionlib-data/transmission/Al.sol
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si.sol
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si3N4.sol
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.REST_PATH }}/mpfr-4.0.2/install/lib
python windowPlot.py
- name: Solar flux
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/metadata/solarFlux/
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/fluxes.rml
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Dummy_Galan_202202.spt
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Primakoff_Gianotti_201904.dat
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Primakoff_LennertHoof_202203.dat
python solarTests.py
python solarPlot.py
python compare.py
Ray-tracing:
name: Check ray-tracing processing chain
Expand All @@ -171,45 +175,45 @@ jobs:
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
needs: [ build-axionlib ]
steps:
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: XMM optics bench ray-tracing
run: |
source ${{ env.REST_PATH }}/thisREST.sh
export REST_NEVENTS=1000
export REST_RUN=100
cd pipeline/ray-tracing/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/xmm.rml
wget https://rest-for-physics.github.io/axionlib-data/optics/XMM.Wolter
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
restManager --c opticsBench.rml
restRoot -b -q ValidateXMM.C'("OpticsBench_Yaw_0.05_Dev_0.005_BabyIAXO_Run00100.root")'
- name: Window transmission
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/ray-tracing/transmission/
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si.sol
restManager --c emptyWindow.rml
restRoot ValidateTransmission.C'("EmptyVacuumWindow.root", 0.07, 0.09)'
restManager --c shiftedWindow.rml
restRoot ValidateTransmission.C'("ShiftedVacuumWindow", 0.3, 0.5)'
restManager --c siWindow.rml
restRoot -b -q ValidateTransmission.C'("SiWindow.root", 0.9, 1)'
- name: Axion-field integration
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/ray-tracing/axion-field/
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
wget https://rest-for-physics.github.io/axionlib-data/magneticField/Bykovskiy_201906.dat
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.nff
wget https://rest-for-physics.github.io/axionlib-data/bufferGas/bufferGases.rml
restManager --c photonConversion.rml
restRoot -b -q Validate.C'(5.86614e-19, 1.61288)'
python3 validateStreamer.py
- uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
id: axionlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: XMM optics bench ray-tracing
run: |
source ${{ env.REST_PATH }}/thisREST.sh
export REST_NEVENTS=1000
export REST_RUN=100
cd pipeline/ray-tracing/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/xmm.rml
wget https://rest-for-physics.github.io/axionlib-data/optics/XMM.Wolter
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
restManager --c opticsBench.rml
restRoot -b -q ValidateXMM.C'("OpticsBench_Yaw_0.05_Dev_0.005_BabyIAXO_Run00100.root")'
- name: Window transmission
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/ray-tracing/transmission/
wget https://rest-for-physics.github.io/axionlib-data/transmission/Si.sol
restManager --c emptyWindow.rml
restRoot ValidateTransmission.C'("EmptyVacuumWindow.root", 0.07, 0.09)'
restManager --c shiftedWindow.rml
restRoot ValidateTransmission.C'("ShiftedVacuumWindow", 0.3, 0.5)'
restManager --c siWindow.rml
restRoot -b -q ValidateTransmission.C'("SiWindow.root", 0.9, 1)'
- name: Axion-field integration
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd pipeline/ray-tracing/axion-field/
wget https://rest-for-physics.github.io/axionlib-data/magneticField/fields.rml
wget https://rest-for-physics.github.io/axionlib-data/magneticField/Bykovskiy_201906.dat
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.abs
wget https://sultan.unizar.es/axionlib-data/bufferGas/He.nff
wget https://rest-for-physics.github.io/axionlib-data/bufferGas/bufferGases.rml
restManager --c photonConversion.rml
restRoot -b -q Validate.C'(5.86614e-19, 1.61288)'
python3 validateStreamer.py
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-xml
- id: requirements-txt-fixer
- id: end-of-file-fixer
exclude: external/.*$
- id: mixed-line-ending
exclude: external/.*$
- id: trailing-whitespace
exclude: external/.*$

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.6
hooks:
- id: clang-format
exclude: external/.*$

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
additional_dependencies: [ pyyaml ]
# - id: cmake-lint

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
Loading