-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.67 KB
/
runfitbot.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
# A Github workflow that automatically run a fit
name: Automatically perform a fit
# start job only for PRs when a label is added.
on:
pull_request:
types: [labeled]
workflow_dispatch:
# Define global environment variables
env:
NUMBER_REPLICAS: 2
OUTPUT_FOLDER: RESULTS
PLOT_FOLDER: PLOTS
REPORT_TITLE: REPORT
AUTHOR_NAME: FITBOT
KEYWORDS: CHECK
FITCARD: ./runcards/fit_runcard.yml
jobs:
build:
if: contains(github.event.pull_request.labels.*.name, 'run-fit-bot')
name: 🔬 Run Bot Fit 🐍
runs-on: ubuntu-latest
container:
image: ghcr.io/nnpdf/lhapdf:v2
credentials:
username: ${{ github.repository_owner }}
password: ${{ github.token }}
steps:
- uses: actions/checkout@v2
with:
# tags needed for dynamic versioning
fetch-depth: 0
- name: Install and configure Poetry 🐍
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
installer-parallel: true
- name: Install dependencies 📦
run: poetry install --no-interaction --no-root --with test ${{ inputs.poetry-extras }}
- name: Install project 🔨
# it is required to repeat extras, otherwise they will be removed from
# the environment
run: poetry install --no-interaction
- name: Perform a fit 🚀
shell: bash --login {0}
run: |
mkdir $OUTPUT_FOLDER
for ((i=1; i<=$NUMBER_REPLICAS; i+=1))
do
nnu fit run $FITCARD $i
done
- name: Install base texlive 🔨
shell: bash --login {0}
run: sudo apt-get install texlive texlive-science dvipng texlive-latex-extra texlive-fonts-recommended cm-super
- name: Generate fit report 📘
shell: bash --login {0}
run: |
nnu report generate $OUTPUT_FOLDER -t $REPORT_TITLE -a $AUTHOR_NAME -k $KEYWORDS
- name: Upload the reports into the server 🚀
shell: bash --login {0}
run: |
export COMMIT=`git rev-parse --short HEAD`
export TIMESTAMP=`date +"%Y-%m-%dT%H-%M-%S"`
echo "OUTNAME=report-$COMMIT-$TIMESTAMP" >> $GITHUB_ENV
mv output "report-$COMMIT-$TIMESTAMP"
scp -r "report-$COMMIT-$TIMESTAMP" ${{ secrets.USER }}@${{ secrets.ADDR }}:/home/nnpdf/WEB/NNUSF/botfits
- name: Update PR with some comments 📮
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |
:robot: The reports from the fits are now ready :robot: !
Report is available in: https://data.nnpdf.science/NNUSF/botfits/${{ env.OUTNAME }}