Compass sidis #746
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
# A single CI script with github workflow. | |
name: Automatic Fit | |
# start job only for PRs when a label is added. | |
on: | |
pull_request: | |
types: [labeled] | |
# some general variables | |
env: | |
N3FIT_MAXNREP: 20 # total number of replicas to fit | |
POSTFIT_NREP: 16 # requested replicas for postfit | |
REFERENCE_SET: NNBOT-b1374cba6-2024-11-28 # reference set for exact results | |
STABLE_REFERENCE_SET: NNBOT-c0f99b7b3-2024-02-28 # reference set for last tag | |
PYTHONHASHSEED: "0" | |
jobs: | |
fitbot: | |
# perform build only if PR has run-fit-bot label | |
if: contains(github.event.pull_request.labels.*.name, 'run-fit-bot') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.12" | |
use-mamba: true | |
channels: conda-forge | |
show-channel-urls: true | |
auto-update-conda: true | |
activate-environment: nnpdfenv | |
- name: Install lhapdf, pandoc and mongodb | |
shell: bash -l {0} | |
run: | | |
conda install lhapdf pandoc mongodb | |
- name: Install nnpdf with pip | |
shell: bash -l {0} | |
run: | | |
pip install . | |
# create fancy runcards | |
- name: Preparing fit runcard | |
run: | | |
# set runcard name | |
export COMMIT=`git rev-parse --short HEAD` | |
export TIMESTAMP=`date --iso-8601` | |
echo "RUNCARD=NNBOT-$COMMIT-$TIMESTAMP" >> $GITHUB_ENV | |
echo "RUNFOLDER=n3fit/runcards/examples" >> $GITHUB_ENV | |
# downloading theory, t0 and eko | |
- name: Downloading requirements | |
shell: bash -l {0} | |
run: | | |
cd $RUNFOLDER | |
cp developing.yml $RUNCARD.yml | |
vp-setupfit $RUNCARD.yml | |
# run n3fit replicas sequentially | |
- name: Running n3fit | |
shell: bash -l {0} | |
run: | | |
cd $RUNFOLDER | |
for ((i=1; i<=$N3FIT_MAXNREP; i+=1)); do n3fit $RUNCARD.yml $i ; done | |
# performing DGLAP | |
- name: Running dglap | |
shell: bash -l {0} | |
run: | | |
cd $RUNFOLDER | |
evolven3fit evolve $RUNCARD | |
# running postfit and upload the fit to the server | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.NNPDF_SSA }} | |
name: id_rsa | |
known_hosts: ${{ secrets.NNPDF_HOSTS_KEY }} | |
- name: Postfit and upload fit | |
shell: bash -l {0} | |
run: | | |
conda activate nnpdfenv | |
cd $RUNFOLDER | |
postfit $POSTFIT_NREP $RUNCARD | |
res=$(vp-upload $RUNCARD 2>&1) | |
echo ${res} | |
while echo ${res} | grep ERROR >/dev/null | |
do | |
sleep 30s | |
res=$(vp-upload $RUNCARD 2>&1) | |
done | |
url=$( echo "${res}" | grep https ) | |
echo "FIT_URL=$url" >> $GITHUB_ENV | |
# running validphys report | |
- name: Building and upload report | |
shell: bash -l {0} | |
run: | | |
conda activate nnpdfenv | |
vp-comparefits $RUNCARD $REFERENCE_SET \ | |
--title "Automatic check fit $RUNCARD" \ | |
--author bot \ | |
--keywords run-fit-bot \ | |
--thcovmat_if_present | |
url=$(vp-upload output/ 2>&1 | grep https) | |
echo "REPORT_URL=$url" >> $GITHUB_ENV | |
vp-comparefits $RUNCARD $STABLE_REFERENCE_SET \ | |
--title "Automatic check fit $RUNCARD with respect to latest tag" \ | |
--author bot \ | |
--keywords run-fit-bot \ | |
--thcovmat_if_present \ | |
-o tagged_output | |
url=$(vp-upload tagged_output/ 2>&1 | grep https) | |
echo "REPORT_URL_STABLE=$url" >> $GITHUB_ENV | |
# write reminder | |
- name: Write summary on PR | |
uses: unsplash/comment-on-pr@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
msg: | | |
Greetings from your nice fit :robot: ! | |
I have good news for you, I just finished my tasks: | |
- Fit Name: ${{ env.RUNCARD }} | |
- Fit Report wrt master: ${{ env.REPORT_URL }} | |
- Fit Report wrt latest stable reference: ${{ env.REPORT_URL_STABLE }} | |
- Fit Data: ${{ env.FIT_URL }} | |
Check the report **carefully**, and please buy me a :coffee: , or better, a GPU :wink:! |