-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
95 lines (88 loc) · 3.74 KB
/
action.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
name: "pyglotaran examples"
description: "Run pyglotaran examples as integration test against a version of glotaran"
author: "Sebastian Weigand"
inputs:
example_name:
description: "Which example to run {fluorescence, transient-absorption, transient-absorption-two-datasets, spectral-constraints, spectral-guidance, two-datasets, sim-3d-disp, sim-3d-nodisp, sim-3d-weight, sim-6d-disp, run-all}"
required: true
examples_branch:
description: "Branch/tag of pyglotaran examples to use"
required: true
default: main
install_extras:
description: "Whether or not to install pyglotaran_extras"
required: true
default: "true"
set_example_list:
description: "Whether or not to set the 'example-list' output and exit."
required: true
default: "false"
outputs:
example-list:
description: "List of all possible example names to be used in a workflow matrix."
value: ${{ steps.example-run.outputs.example-list }}
notebook-path:
description: "Path to evaluated notebook after running the example"
value: ${{ steps.example-run.outputs.notebook-path }}
runs:
using: "composite"
steps:
- name: Clone pyglotaran-examples to pyglotaran-examples
run: |
[ ! -d pyglotaran-examples ] && [ ! -n '${{ inputs.examples_branch }}' ] && \
{ \
echo "::error:: Branch not provided and 'pyglotaran-examples' folder doesn't exist.\
Manually clone the examples repo to 'pyglotaran-examples' if you use it with the 'push' or 'pull_request' event."; \
exit 1; \
}
echo "::group:: Cloning examples branch '${{ inputs.examples_branch }}' to pyglotaran-examples"
[ ! -d pyglotaran-examples ] && \
git clone --depth 1 -b ${{ inputs.examples_branch }} https://github.com/glotaran/pyglotaran-examples.git || \
echo "Folder pyglotaran-examples already exists, skipping cloning."
echo "::endgroup::"
shell: bash
- name: Install additional requirements
if: inputs.set_example_list == 'false'
run: |
echo "::group:: Installing requirements"
echo 'inputs.install_extras= ${{ inputs.install_extras }}'
if [ '${{ inputs.install_extras }}' = 'false' ]
then
echo "Installing with OUT pyglotaran_extras"
pip install wheel
pip install -r pyglotaran-examples/.github/requirements_ci.txt
else
echo "Installing with pyglotaran_extras"
pip install wheel
pip install -r pyglotaran-examples/requirements.txt
fi
echo "::endgroup::"
shell: bash
- name: Run example notebooks
id: example-run
run: |
echo "::group:: Running ${{ inputs.example_name }}"
if [ '${{ inputs.set_example_list }}' = 'false' ]
then
python pyglotaran-examples/scripts/run_examples_notebooks.py ${{ inputs.example_name }} 2>&1
else
pip install yaargh papermill
python pyglotaran-examples/scripts/run_examples_notebooks.py set-gha-example-list-output
fi
echo "::endgroup::"
shell: bash
- name: Save Examples commit sha
if: inputs.set_example_list == 'false'
run: |
echo "::group:: Saving commit sha to ~/pyglotaran_examples_results"
mkdir -p ~/pyglotaran_examples_results
git --git-dir=pyglotaran-examples/.git log -n 1 --pretty=format:%H | \
tee ~/pyglotaran_examples_results/example_commit_sha.txt && \
echo
echo "::endgroup::"
echo "::group:: Saving commit sha to plot_results"
git --git-dir=pyglotaran-examples/.git log -n 1 --pretty=format:%H | \
tee pyglotaran-examples/plot_results/example_commit_sha.txt && \
echo
echo "::endgroup::"
shell: bash