-
Notifications
You must be signed in to change notification settings - Fork 6
126 lines (122 loc) · 4.2 KB
/
fitbot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# 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:!