use mamba in docker construction #360
Workflow file for this run
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-90875c07e-2022-11-30 # reference set for vp | |
CONDA_PY: 310 | |
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.10"] | |
runs-on: ${{ matrix.os }} | |
env: | |
NETRC_FILE: ${{ secrets.NETRC_FILE }} | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- 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 config --append channels conda-forge | |
conda config --prepend channels https://packages.nnpdf.science/public | |
conda config --set show_channel_urls true | |
conda install boa --yes | |
- name: Build recipe | |
shell: bash -l {0} | |
run: | | |
CONDA_PY=$CONDA_PY conda mambabuild --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+=2)); do n3fit $RUNCARD.yml $i -r $((i+1)); done | |
# performing DGLAP | |
- name: Running dglap | |
shell: bash -l {0} | |
run: | | |
conda activate nnpdfenv | |
cd $RUNFOLDER | |
evolven3fit_new 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 | |
# 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: ${{ env.REPORT_URL }} | |
- Fit Data: ${{ env.FIT_URL }} | |
Check the report **carefully**, and please buy me a :coffee: , or better, a GPU :wink:! |