-
Notifications
You must be signed in to change notification settings - Fork 7
144 lines (140 loc) · 4.83 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# 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-c0b68779b-2024-05-16 # reference set for exact results
STABLE_REFERENCE_SET: NNBOT-c0f99b7b3-2024-02-28 # reference set for last tag
CONDA_PY: 312
PYTHONHASHSEED: "0"
jobs:
build:
# perform build only if PR has run-fit-bot label
if: contains(github.event.pull_request.labels.*.name, 'run-fit-bot')
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
env:
NETRC_FILE: ${{ secrets.NETRC_FILE }}
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
use-mamba: true
channels: https://packages.nnpdf.science/public,conda-forge
show-channel-urls: true
auto-update-conda: true
- 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: Setup conda and install conda-build
shell: bash -l {0}
run: |
echo "$NETRC_FILE" | base64 --decode > ~/.netrc
conda install conda-build --yes
- name: Build recipe
shell: bash -l {0}
run: |
CONDA_PY=$CONDA_PY conda build --no-test -q conda-recipe
# install local build
- name: Installing NNPDF conda package
shell: bash -l {0}
run: |
conda update -n base conda
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda create -n nnpdfenv -c file:///usr/share/miniconda/envs/test/conda-bld/linux-64/ nnpdf
# 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 and t0
- name: Downloading requirements
shell: bash -l {0}
run: |
conda activate nnpdfenv
cd $RUNFOLDER
cp developing.yml $RUNCARD.yml
vp-setupfit $RUNCARD.yml
# running n3fit replicas
- name: Running n3fit
shell: bash -l {0}
run: |
conda activate nnpdfenv
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: |
conda activate nnpdfenv
cd $RUNFOLDER
evolven3fit evolve $RUNCARD
# running postfit
- 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:!