-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (115 loc) · 4.93 KB
/
Copy pathtest-binder-environment.yml
File metadata and controls
132 lines (115 loc) · 4.93 KB
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
name: Test Binder Build
# Build the repository the same way mybinder.org does, with repo2docker, so a
# broken environment.yml, postBuild, or submodule is caught before users hit it.
# The plain conda build used before did not go through repo2docker and missed,
# for example, the Anaconda "defaults" channel terms-of-service failure.
#
# Two jobs:
# binder-build builds the committed gitlink (what mybinder serves) on
# every PR and push.
# binder-build-master builds against the current openTEPES master tip, on push
# to main only. It gives earlier warning of upstream breakage
# than the weekly bump job, without turning unrelated PRs red
# when master drifts. Keep its notebook list in sync with
# binder-build and with bump-opentepes-submodule.yml.
on:
pull_request:
paths:
- 'environment.yml'
- 'postBuild'
- '.gitmodules'
- '.dockerignore'
- 'notebooks/**'
- '.github/workflows/test-binder-environment.yml'
push:
branches:
- main
paths:
- 'environment.yml'
- 'postBuild'
- '.gitmodules'
- '.dockerignore'
- 'notebooks/**'
- '.github/workflows/test-binder-environment.yml'
jobs:
binder-build:
runs-on: ubuntu-latest
name: Build the Binder image with repo2docker
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install jupyter-repo2docker
run: pip install jupyter-repo2docker
- name: Build the Binder image (same path mybinder.org uses)
run: |
jupyter-repo2docker --no-run --image-name opentepes-tutorial:ci .
- name: Run the tutorial notebooks inside the built image
run: |
# Execute the notebooks in the built image so a notebook that no longer
# runs is caught. Each notebook writes into a work_*/ copy of the case,
# so the committed cases are never changed.
jupyter-repo2docker --image-name opentepes-tutorial:ci . \
bash -lc 'jupyter nbconvert --to notebook --execute \
--ExecutePreprocessor.timeout=900 --output-dir /tmp/executed \
notebooks/0*.ipynb \
notebooks/1.3-openTEPES-Running-StepByStep.ipynb \
notebooks/2.1-Comparison.ipynb \
notebooks/3.1-LoadLevelAggregation_TSAM.ipynb \
notebooks/4.*.ipynb \
notebooks/5.*.ipynb'
- name: Summary
if: success()
run: echo "Binder image built with repo2docker and the tutorial notebooks ran successfully."
binder-build-master:
# Only on push to main. Builds against the openTEPES master tip so upstream
# breakage shows up here, between the weekly runs of bump-opentepes-submodule.yml,
# rather than only on the Monday schedule. Not run on PRs, so a PR unrelated to
# openTEPES is never failed by master drifting.
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Build the Binder image against openTEPES master tip
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Move the gitlink to openTEPES master tip
run: |
# --remote follows the branch declared in .gitmodules (master).
git submodule update --remote --recursive external/openTEPES
echo "openTEPES at $(git -C external/openTEPES rev-parse --short HEAD)"
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install jupyter-repo2docker
run: pip install jupyter-repo2docker
- name: Build the Binder image (same path mybinder.org uses)
run: |
jupyter-repo2docker --no-run --image-name opentepes-tutorial:master .
- name: Run the tutorial notebooks inside the built image
run: |
# repo2docker builds the local context, so it picks up the bumped submodule
# commit without a push. Keep this notebook list in sync with binder-build.
jupyter-repo2docker --image-name opentepes-tutorial:master . \
bash -lc 'jupyter nbconvert --to notebook --execute \
--ExecutePreprocessor.timeout=900 --output-dir /tmp/executed \
notebooks/0*.ipynb \
notebooks/1.3-openTEPES-Running-StepByStep.ipynb \
notebooks/2.1-Comparison.ipynb \
notebooks/3.1-LoadLevelAggregation_TSAM.ipynb \
notebooks/4.*.ipynb \
notebooks/5.*.ipynb'
- name: Summary
if: success()
run: echo "Binder image built against openTEPES master tip and the tutorial notebooks ran successfully."