-
Notifications
You must be signed in to change notification settings - Fork 57
388 lines (327 loc) · 13.9 KB
/
config.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: ci
on:
push:
branches: [ main, develop ]
pull_request:
types: [ synchronize, opened ]
workflow_dispatch:
env:
OPENSTUDIO_VER: 3.9.0
OPENSTUDIO_SHA: c77fbb9569
OPENSTUDIO_PLATFORM: Ubuntu-22.04-x86_64
OPENSTUDIO_EXT: deb
OPENSTUDIO_URL: https://github.com/NREL/OpenStudio/releases/download/v3.9.0
jobs:
format-files:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Format Files
shell: bash
run: |
sed -i -e 's/[[:space:]]*$//' resources/options_lookup.tsv # Remove whitespace
(sed -u 1q ; sort -k1 -k2) < resources/options_lookup.tsv > sorted_options_lookup.tsv
mv sorted_options_lookup.tsv resources/options_lookup.tsv # Sort on first two columns
- name: Upload formatted options_lookup
uses: actions/upload-artifact@v4
with:
path: resources/options_lookup.tsv
name: options_lookup
unit-tests:
runs-on: ubuntu-22.04
needs: [format-files]
container:
image: docker://nrel/openstudio:3.9.0
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Download formatted options_lookup
uses: actions/download-artifact@v4
with:
path: resources
name: options_lookup
- name: Run integrity checks for all projects
run: |
bundle exec rake unit_tests:project_integrity_checks
- name: Run all integrity check unit tests
run: |
bundle exec rake unit_tests:integrity_check_tests
- name: Run all measure tests
run: |
bundle exec rake unit_tests:measure_tests
- name: Upload feature samples
uses: actions/upload-artifact@v4
with:
path: resources/buildstock.csv
name: feature_samples
- name: Store code coverage
uses: actions/upload-artifact@v4
with:
path: coverage
name: coverage
analysis-tests:
runs-on: ubuntu-22.04
needs: [unit-tests]
container:
image: docker://nrel/openstudio:3.9.0
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Install python
shell: bash
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo -E apt-get install -y python3-pip
- name: Install python dependencies
run : |
python3 -m pip install --progress-bar off --upgrade pip
pip3 install --progress-bar off pandas pyyaml
- name: Download formatted options_lookup
uses: actions/download-artifact@v4
with:
path: resources
name: options_lookup
- name: Generate precomputed buildstocks
run: |
python3 test/update_yml_precomputed_files.py
- name: Run run_analysis.rb
run: |
bundle exec rake workflow:analysis_tests
- name: Upload precomputed buildstocks
uses: actions/upload-artifact@v4
with:
path: test/tests_yml_files/yml_precomputed*/buildstock*.csv
name: precomputed_buildstocks
- name: Upload run_analysis.rb results
uses: actions/upload-artifact@v4
with:
path: |
project_national/results-Baseline.csv
project_testing/results-Baseline.csv
project_national/results-PackageUpgrade.csv
project_testing/results-PackageUpgrade.csv
name: run_analysis_results_csvs
integration-tests:
runs-on: ubuntu-22.04
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download and Install OpenStudio
run: |
export OS_DEBFILE="OpenStudio-$OPENSTUDIO_VER+$OPENSTUDIO_SHA-$OPENSTUDIO_PLATFORM.$OPENSTUDIO_EXT"
wget -q $OPENSTUDIO_URL/$OS_DEBFILE
sudo apt install -y ./$OS_DEBFILE
openstudio openstudio_version
which openstudio
- name: Download formatted options_lookup
uses: actions/download-artifact@v4
with:
path: resources
name: options_lookup
- name: Run buildstockbatch
run: |
pip install git+https://github.com/NREL/buildstockbatch.git@develop
buildstock_local project_national/national_baseline.yml
buildstock_local project_testing/testing_baseline.yml
buildstock_local project_national/national_upgrades.yml
buildstock_local project_testing/testing_upgrades.yml
- name: Unzip results
run: |
gunzip -v project_national/national_baseline/results_csvs/*.csv.gz
gunzip -v project_testing/testing_baseline/results_csvs/*.csv.gz
gunzip -v project_national/national_upgrades/results_csvs/*.csv.gz
gunzip -v project_testing/testing_upgrades/results_csvs/*.csv.gz
tar -xvf project_national/national_baseline/simulation_output/*.tar.gz -C project_national/national_baseline/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw'
tar -xvf project_testing/testing_baseline/simulation_output/*.tar.gz -C project_testing/testing_baseline/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw' --wildcards '*in.osm' --wildcards '*in.idf'
tar -xvf project_national/national_upgrades/simulation_output/*.tar.gz -C project_national/national_upgrades/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw'
tar -xvf project_testing/testing_upgrades/simulation_output/*.tar.gz -C project_testing/testing_upgrades/simulation_output --wildcards '*results_timeseries.csv' --wildcards '*.xml' --wildcards '*data_point_out.json' --wildcards '*.osw' --wildcards '*in.osm' --wildcards '*in.idf'
- name: Process results
run: |
pip install plotly
python test/process_bsb_analysis.py
- name: Upload integration results
uses: actions/upload-artifact@v4
with:
path: |
baseline
upgrades
name: feature_results
- name: Upload buildstockbatch results
uses: actions/upload-artifact@v4
with:
path: |
project_national/national_baseline/results_csvs/results_up00.csv
project_testing/testing_baseline/results_csvs/results_up00.csv
project_national/national_upgrades/results_csvs/results_up17.csv
project_testing/testing_upgrades/results_csvs/results_up17.csv
name: buildstockbatch_results_csvs
- name: Run tests
run: |
sudo gem install minitest-reporters
sudo gem install simplecov
sudo gem install simplecov-html
ruby test/test_bsb_analysis.rb
compare-tools:
runs-on: ubuntu-22.04
needs: [analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Download buildstockbatch results
uses: actions/download-artifact@v4
with:
path: buildstockbatch
name: buildstockbatch_results_csvs
- name: Download run_analysis results
uses: actions/download-artifact@v4
with:
path: run_analysis
name: run_analysis_results_csvs
- name: Run tests
run: |
sudo gem install minitest-reporters
sudo gem install simplecov
sudo gem install simplecov-html
ruby test/test_analysis_tools.rb
compare-results:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
needs: [integration-tests]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Upload base results
uses: actions/upload-artifact@v4
with:
path: test/base_results
name: base_results
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download base results
uses: actions/download-artifact@v4
with:
path: base_results
name: base_results
- name: Download feature samples
uses: actions/download-artifact@v4
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v4
with:
path: results
name: feature_results
- name: Compare samples and results
run: |
pip install numpy
pip install pandas
pip install plotly
pip install kaleido
# baseline annual
mkdir -p test/base_results/comparisons/baseline/annual
python test/compare.py -a samples -b base_results/baseline/annual -f samples -e test/base_results/comparisons/baseline/annual # base_samples.csv, feature_samples.csv
python test/compare.py -a results -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual # results_characteristics.csv, results_output.csv
python test/compare.py -a results -af sum -ac build_existing_model.geometry_building_type_recs -x results_output_building_type_sum.csv -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual # results_output_building_type_sum.csv
python test/compare.py -a visualize -dc build_existing_model.geometry_building_type_recs -x results_output_building_type.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual # *.html
# baseline timeseries
mkdir test/base_results/comparisons/baseline/timeseries
python test/compare.py -a timeseries -b base_results/baseline/timeseries -f results/baseline/timeseries -e test/base_results/comparisons/baseline/timeseries # cvrmse_nmbe_*.csv
# upgrades annual
mkdir -p test/base_results/comparisons/upgrades/annual
python test/compare.py -a results -b base_results/upgrades/annual -f results/upgrades/annual -e test/base_results/comparisons/upgrades/annual # results_output.csv
python test/compare.py -a visualize -x results_output.html -b base_results/upgrades/annual -f results/upgrades/annual -e test/base_results/comparisons/upgrades/annual # *.html
# upgrades timeseries
mkdir test/base_results/comparisons/upgrades/timeseries
python test/compare.py -a timeseries -b base_results/upgrades/timeseries -f results/upgrades/timeseries -e test/base_results/comparisons/upgrades/timeseries # cvrmse_nmbe_*.csv
- name: Upload comparisons
uses: actions/upload-artifact@v4
with:
path: test/base_results/comparisons
name: comparisons
update-results:
runs-on: ubuntu-22.04
needs: [analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install software
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo -E apt-get install -y wget unzip python3-sphinx-rtd-theme
- name: Download feature samples
uses: actions/download-artifact@v4
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v4
with:
path: results
name: feature_results
- name: Download formatted options_lookup
uses: actions/download-artifact@v4
with:
path: resources
name: options_lookup
- name: Download precomputed buildstocks
uses: actions/download-artifact@v4
with:
path: test/tests_yml_files
name: precomputed_buildstocks
- name: Build documentation
run: |
sudo gem install oga
ruby docs/read_the_docs/source/workflow_inputs/create_characteristics_rst.rb
ruby docs/read_the_docs/source/workflow_outputs/csv_tables.rb
cd docs/read_the_docs
pip install changelog
make html SPHINXOPTS="-W --keep-going -n"
- name: Save Docs
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/read_the_docs/_build/html/
- name: Commit latest results
shell: bash
run: |
branch_name="${{ github.head_ref }}"
git pull origin $branch_name
cp -r samples/buildstock*.csv test/base_results/baseline/annual
cp -r results/baseline/annual/results*.csv test/base_results/baseline/annual
cp -r results/baseline/timeseries/*.csv test/base_results/baseline/timeseries
cp -r results/upgrades/annual/results*.csv test/base_results/upgrades/annual
cp -r results/upgrades/timeseries/*.csv test/base_results/upgrades/timeseries
git add test/base_results
git add docs
git add resources/options_lookup.tsv
git add test/tests_yml_files
git status
if [[ $(git diff --cached --exit-code) ]]; then
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git commit -m "Latest results."
echo "Pushing to branch: $branch_name"
git push -u origin $branch_name
fi