-
Notifications
You must be signed in to change notification settings - Fork 25
218 lines (192 loc) · 7.34 KB
/
manual_cli_test.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
name: Test OS SDK CLI from OpenStudio Application
on:
workflow_dispatch:
inputs:
run_id:
description: 'The github actions run_id where to find the artifacts'
required: true
jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, windows-2022, macos-13, macos-arm64]
include:
- os: ubuntu-20.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
BINARY_EXT: deb
COMPRESSED_EXT: tar.gz
- os: ubuntu-22.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
BINARY_EXT: deb
COMPRESSED_EXT: tar.gz
- os: windows-2022
SELF_HOSTED: false
PLATFORM_NAME: Windows
BINARY_EXT: exe
COMPRESSED_EXT: zip
- os: macos-13
SELF_HOSTED: false
PLATFORM_NAME: Darwin
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
MACOSX_DEPLOYMENT_TARGET: 10.15
- os: macos-arm64
SELF_HOSTED: true
PLATFORM_NAME: Darwin
BINARY_EXT: dmg
COMPRESSED_EXT: tar.gz
MACOSX_DEPLOYMENT_TARGET: 12.1
steps:
- name: Download binary installer
uses: actions/download-artifact@v4
id: downloader
with:
pattern: OpenStudioApplication-*-${{ matrix.os }}.${{ matrix.COMPRESSED_EXT }}
run-id: ${{ github.event.inputs.run_id}}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: cli_tester
merge-multiple: true
- name: Install OSApp
working-directory: cli_tester
shell: bash
run: |
set -x
echo "steps.downloader.outputs.download-path=${{ steps.downloader.outputs.download-path }}"
ls -R
archive=$(ls *.${{ matrix.COMPRESSED_EXT }})
OSAPP_DIR_NAME=$(basename $archive .${{ matrix.COMPRESSED_EXT }})
echo "OSAPP_DIR_NAME=$OSAPP_DIR_NAME" >> $GITHUB_ENV
if [ "${{ matrix.COMPRESSED_EXT }}" == "tar.gz" ]; then
#OSAPP_DIR_NAME=$(tar tzf $archive | head -1 | cut -f1 -d"/")
tar xfz $archive
else
7z X $archive
fi
examples_dir=$(find $(pwd)/$OSAPP_DIR_NAME -name "Examples" -type d)
OSAPP_ROOT_DIR=$(dirname $examples_dir)
echo "OSAPP_ROOT_DIR=$OSAPP_ROOT_DIR" >> $GITHUB_ENV
echo "puts ARGV" > test.rb
echo "import sys" > test.py
echo "print(sys.argv)" >> test.py
ls
cp -R $examples_dir/compact_osw/* .
if [ ! -d "$OSAPP_ROOT_DIR" ]; then
echo "Directly does not exist! $OSAPP_ROOT_DIR"
exit 1
fi
if [ "$RUNNER_OS" == "Linux" ]; then
export PATH="$OSAPP_ROOT_DIR/bin:$PATH"
echo "$OSAPP_ROOT_DIR/bin" >> $GITHUB_PATH
elif [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$OSAPP_ROOT_DIR/bin:$PATH"
echo "$OSAPP_ROOT_DIR/bin" >> $GITHUB_PATH
elif [ "$RUNNER_OS" == "macOS" ]; then
export PATH="$OSAPP_ROOT_DIR/OpenStudioApp.app/Contents/MacOS:$PATH"
echo "$OSAPP_ROOT_DIR/OpenStudioApp.app/Contents/MacOS" >> $GITHUB_PATH
fi
which openstudio
openstudio openstudio_version
if openstudio labs; then
echo "The Ruby CLI is the default"
echo CLASSIC_SUBCOMMAND= >> $GITHUB_ENV
echo LABS_SUBCOMMAND=labs >> $GITHUB_ENV
else
echo "The C++ CLI is the default"
echo CLASSIC_SUBCOMMAND=classic >> $GITHUB_ENV
echo LABS_SUBCOMMAND= >> $GITHUB_ENV
fi
- name: EnergyPlus itself works
working-directory: cli_tester
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
$OSAPP_ROOT_DIR/EnergyPlus/energyplus --help || ( echo "EnergyPlus missing dependencies!" && sudo apt install -y libgomp1 libx11-6 && $OSAPP_ROOT_DIR/EnergyPlus/energyplus --help )
else
$OSAPP_ROOT_DIR/EnergyPlus/energyplus --help
fi
- name: Classic Ruby CLI test
working-directory: cli_tester
shell: bash
run: |
set -x
openstudio $CLASSIC_SUBCOMMAND --help
openstudio $CLASSIC_SUBCOMMAND openstudio_version
openstudio $CLASSIC_SUBCOMMAND energyplus_version
openstudio $CLASSIC_SUBCOMMAND ruby_version
openstudio $CLASSIC_SUBCOMMAND -e "puts OpenStudio::Model::Model.new()"
openstudio $CLASSIC_SUBCOMMAND -e "require 'oga'; puts Oga::VERSION"
openstudio $CLASSIC_SUBCOMMAND execute_ruby_script test.rb -x arg2
openstudio $CLASSIC_SUBCOMMAND run -w compact_ruby_only.osw
- name: Labs C++ CLI Test
working-directory: cli_tester
shell: bash
run: |
set -x
openstudio $LABS_SUBCOMMAND --help
openstudio $LABS_SUBCOMMAND openstudio_version
openstudio $LABS_SUBCOMMAND energyplus_version
openstudio $LABS_SUBCOMMAND ruby_version
openstudio $LABS_SUBCOMMAND python_version
openstudio $LABS_SUBCOMMAND -e "puts OpenStudio::Model::Model.new()"
openstudio $LABS_SUBCOMMAND -e "require 'oga'; puts Oga::VERSION"
openstudio $LABS_SUBCOMMAND execute_ruby_script test.rb -x arg2
openstudio $LABS_SUBCOMMAND execute_python_script test.py -x arg2
openstudio $LABS_SUBCOMMAND run -w compact_ruby_only.osw
openstudio $LABS_SUBCOMMAND run -w compact_python_only_twomeasures.osw
openstudio $LABS_SUBCOMMAND run -w compact_ruby_then_python.osw
openstudio $LABS_SUBCOMMAND run -w compact_python_then_ruby.osw
- name: Display structure
if: ${{ always() && runner.os == 'Windows' }}
working-directory: cli_tester/${{ env.OSAPP_DIR_NAME }}
run: |
tree /f /a
- name: Display structure
if: ${{ always() && runner.os != 'Windows' }}
working-directory: cli_tester/${{ env.OSAPP_DIR_NAME }}
run: |
separator() {
echo -e "\n\033[0;31m===========================================================\033[0m"
};
if [ "$RUNNER_OS" == "macOS" ]; then
brew install tree
inspect_lib() {
separator
echo -e "\033[0;33m$1\033[0m"
otool -L $1
otool -l $1 | grep -A2 LC_RPATH || true
}
BUNDLE_EXT=bundle
SONAME=dylib
else
inspect_lib() {
separator
echo -e "\033[0;33m$1\033[0m"
ldd $1
objdump -x $1 | grep RUNPATH || true
}
BUNDLE_EXT=so
SONAME=so
fi
tree -I 'Radiance|python_standard_lib|include'
inspect_lib bin/openstudio
inspect_lib lib/libopenstudiolib.$SONAME
inspect_lib lib/libpythonengine.so
inspect_lib lib/librubyengine.so
inspect_lib Python/_openstudiomodel.so
inspect_lib Ruby/openstudio.$BUNDLE_EXT
inspect_lib EnergyPlus/energyplus
inspect_lib EnergyPlus/libenergyplusapi.dylib
inspect_lib EnergyPlus/ExpandObjects
- name: cleanup
if: ${{ always() }}
shell: bash
run: |
rm -Rf ./cli_tester/ || true
rm -Rf ./OpenStudioApplication-*-${{ matrix.os }}.${{ matrix.BINARY_EXT }} || true
rm -Rf ./OpenStudioApplication-*-${{ matrix.os }}.${{ matrix.COMPRESSED_EXT }} || true