-
Notifications
You must be signed in to change notification settings - Fork 57
362 lines (297 loc) · 13.4 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
name: ci
on:
push:
branches: [ main, develop ]
pull_request:
types: [ synchronize, opened ]
workflow_dispatch:
jobs:
format-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
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@v3
with:
path: resources/options_lookup.tsv
name: options_lookup
unit-tests:
runs-on: ubuntu-latest
needs: [format-files]
container:
image: docker://nrel/openstudio:3.6.1
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
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@v3
with:
path: resources/buildstock.csv
name: feature_samples
- name: Store code coverage
uses: actions/upload-artifact@v3
with:
path: coverage
name: coverage
analysis-tests:
runs-on: ubuntu-latest
needs: [format-files, unit-tests]
container:
image: docker://nrel/openstudio:3.6.1
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install gems
run: |
rm -f Gemfile.lock && bundle install
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Download feature samples
uses: actions/download-artifact@v3
with:
path: samples
name: feature_samples
- name: Run run_analysis.rb
run: |
bundle exec rake workflow:analysis_tests
- name: Upload run_analysis.rb results
uses: actions/upload-artifact@v3
with:
path: |
project_national/results-Baseline.csv
project_testing/results-Baseline.csv
project_national/results-AllUpgrades.csv
project_testing/results-AllUpgrades.csv
name: run_analysis_results_csvs
integration-tests:
runs-on: ubuntu-latest
needs: [format-files]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Download and Install OpenStudio
run: |
wget -q https://github.com/NREL/OpenStudio/releases/download/v3.6.1/OpenStudio-3.6.1+bb9481519e-Ubuntu-20.04-x86_64.deb
sudo apt install -y ./OpenStudio-3.6.1+bb9481519e-Ubuntu-20.04-x86_64.deb
openstudio openstudio_version
which openstudio
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- name: Run buildstockbatch
run: |
pip install git+https://github.com/NREL/buildstockbatch.git@v2023.06.0
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: |
python test/process_bsb_analysis.py
- name: Run tests
run: |
sudo gem install minitest-reporters
sudo gem install simplecov
sudo gem install simplecov-html
ruby test/test_bsb_analysis.rb
- name: Upload integration results
uses: actions/upload-artifact@v3
with:
path: |
baseline
upgrades
name: feature_results
- name: Upload buildstockbatch results
uses: actions/upload-artifact@v3
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_up15.csv
project_testing/testing_upgrades/results_csvs/results_up15.csv
name: buildstockbatch_results_csvs
compare-tools:
runs-on: ubuntu-latest
needs: [analysis-tests, integration-tests]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Download buildstockbatch results
uses: actions/download-artifact@v3
with:
path: buildstockbatch
name: buildstockbatch_results_csvs
- name: Download run_analysis results
uses: actions/download-artifact@v3
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-latest
needs: [integration-tests]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Upload base results
uses: actions/upload-artifact@v3
with:
path: test/base_results
name: base_results
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download base results
uses: actions/download-artifact@v3
with:
path: base_results
name: base_results
- name: Download feature samples
uses: actions/download-artifact@v3
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v3
with:
path: results
name: feature_results
- name: Compare samples and results
run: |
pip install numpy
pip install pandas
pip install plotly
pip install kaleido
mkdir test/base_results/comparisons
mkdir test/base_results/comparisons/baseline
mkdir 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
python test/compare.py -a results -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
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
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
python test/compare.py -a visualize -dc build_existing_model.geometry_foundation_type -x results_output_foundation_type.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
python test/compare.py -a visualize -dc build_existing_model.census_region -x results_output_cr.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
python test/compare.py -a visualize -dc build_existing_model.geometry_building_type_recs -ac build_existing_model.census_region -af sum -x results_output_cr_sum.html -b base_results/baseline/annual -f results/baseline/annual -e test/base_results/comparisons/baseline/annual
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
mkdir test/base_results/comparisons/upgrades
mkdir 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
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
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
- name: Upload comparisons
uses: actions/upload-artifact@v3
with:
path: test/base_results/comparisons
name: comparisons
update-results:
runs-on: ubuntu-latest
needs: [integration-tests]
steps:
- uses: actions/checkout@v3
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@v3
with:
path: samples
name: feature_samples
- name: Download feature results
uses: actions/download-artifact@v3
with:
path: results
name: feature_results
- name: Download formatted options_lookup
uses: actions/download-artifact@v3
with:
path: resources
name: options_lookup
- 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 status
if [[ $(git diff --cached --exit-code) ]]; then
git config --global user.email "github-action@users.noreply.github.com"
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
- name: Build documentation
run: |
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
make html SPHINXOPTS="-W --keep-going -n"
- name: Save Docs
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/read_the_docs/_build/html/