-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:rat-pac/ratpac-two into whack-a-war…
…ning
- Loading branch information
Showing
84 changed files
with
1,182 additions
and
7,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
rattest-name: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
rattest: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ratpac/ratpac-two:latest-base | ||
options: --user root | ||
steps: | ||
- name: Get build cache | ||
id: cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ratpac2 | ||
key: ${{ github.sha }}-install | ||
- name: Run rattest | ||
working-directory: ratpac2 | ||
shell: bash | ||
run: | | ||
source /ratpac-setup/env.sh | ||
source ../ratpac2/ratpac.sh | ||
rattest -t test/full/${{ inputs.rattest-name }} | ||
id: test | ||
continue-on-error: true | ||
- name: upload-result | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.rattest-name }}-result | ||
if-no-files-found: error | ||
path: | | ||
ratpac2/test/full/${{ inputs.rattest-name }}/*.png | ||
ratpac2/test/full/${{ inputs.rattest-name }}/*.html | ||
- name: check-test-result | ||
if: steps.test.outcome != 'success' | ||
run: exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: rattests | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ratpac/ratpac-two:latest-base | ||
options: --user root | ||
steps: | ||
- name: Checkout Ratpac2 | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ratpac2 | ||
- name: Build Ratpac2 | ||
working-directory: ratpac2 | ||
shell: bash | ||
run: | | ||
source /ratpac-setup/env.sh | ||
make -j$(nproc) | ||
- name: Cache build output | ||
id: cache | ||
uses: actions/cache/save@v4 | ||
with: | ||
key: ${{ github.sha }}-install | ||
path: ratpac2 | ||
|
||
acrylic_attenuation: | ||
needs: build | ||
uses: ./.github/workflows/rattests-template.yml | ||
with: | ||
rattest-name: acrylic_attenuation | ||
|
||
fitcentroid: | ||
needs: build | ||
uses: ./.github/workflows/rattests-template.yml | ||
with: | ||
rattest-name: fitcentroid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
#-*-python-*- | ||
|
||
from __future__ import print_function | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
|
||
import sys | ||
import os.path | ||
import argparse | ||
import webbrowser | ||
from rattest import RatTest, RatHtml, make_template | ||
|
||
#### Parse command line options | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('input', | ||
nargs='+', type=str, | ||
help='RAT test(s) to run. Must be a directory or directories.') | ||
|
||
parser.add_argument('-u', '--update', | ||
action='store_true', dest='update', default=False, | ||
help='Update "standard" histogram with current results.') | ||
|
||
parser.add_argument('-m', '--regen-mc', | ||
action='store_true', dest='regen_mc', default=False, | ||
help='Force Monte Carlo to be regenerated.') | ||
|
||
parser.add_argument('-r', '--regen-plots', | ||
action='store_true', dest='regen_plots', default=False, | ||
help='Force histograms to be regenerated.') | ||
|
||
parser.add_argument('-t', '--text-only', | ||
action='store_false', dest='web', default=True, | ||
help='Do not open web pages with plots.') | ||
|
||
parser.add_argument('--make-template', type=str, dest='template', default=None, | ||
help='Write a template rattest to current directory for you to edit. '\ | ||
'Supplied name is used for .mac and .C files.') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.template is not None: | ||
make_template(args.template) | ||
print('Writing test template to current directory...') | ||
sys.exit(0) | ||
|
||
#### Open runfile | ||
configname = 'rattest.config' | ||
htmlname = 'results.html' | ||
success = True | ||
for dirname in args.input: | ||
for dirpath, _, filenames in os.walk(dirname): | ||
if configname in filenames: | ||
testcase = RatTest(os.path.join(dirpath, configname)) | ||
if args.update: | ||
testcase.update(regen_mc=args.regen_mc, regen_plots=args.regen_plots) | ||
else: | ||
testcase_html = RatHtml(os.path.join(dirpath, htmlname)) | ||
result = testcase.run(regen_mc=args.regen_mc, regen_plots=args.regen_plots, | ||
html=testcase_html) | ||
testcase_html.write() | ||
if args.web: | ||
webbrowser.open('file://'+os.path.abspath(testcase_html.htmlname), new=1) | ||
success = (success and result) | ||
|
||
if not success: | ||
sys.exit(1) |
Oops, something went wrong.