7878 - name : Checkout
7979 uses : actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
8080
81+ - name : Set Up Directories & Environment
82+ run : |
83+ set -x
84+
85+ # Be careful to use consistent paths between Windows and
86+ # Linux. Convert backslashed Windows paths to Linux style via cygpath,
87+ # i.e. convert D:\a\Imath\Imath to /d/a/Imath/Imath.
88+
89+ # WORKSPACE is the root of the project directory
90+ if [[ "$RUNNER_OS" == "Windows" ]]; then
91+ WORKSPACE=$(cygpath -u "$GITHUB_WORKSPACE")
92+
93+ # remember the install location for Imath, libdeflate, openjph
94+ PROGRAM_FILES=$(cygpath -u "C:/Program Files (x86)")
95+ echo "PROGRAM_FILES=$PROGRAM_FILES" >> $GITHUB_ENV
96+ else
97+ WORKSPACE=$GITHUB_WORKSPACE
98+ fi
99+ echo "WORKSPACE=$WORKSPACE" >> $GITHUB_ENV
100+
101+ # BUILD_DIR is the CMake build directory
102+ BUILD_DIR=$WORKSPACE/_build
103+ echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
104+
105+ # INSTALL_DIR is the CMake install directory
106+ INSTALL_DIR=$WORKSPACE/_install
107+ echo "INSTALL_DIR=$INSTALL_DIR" >> $GITHUB_ENV
108+
109+ # Initialize the PATH necessary for the tests on Windows
110+ echo "OPENEXR_PATH=$INSTALL_DIR/bin:$INSTALL_DIR/lib" >> $GITHUB_ENV
111+
112+ shell : bash
113+
81114 - name : Determine MSYS2 Packages
82115 if : inputs.msystem != ''
83116 run : |
@@ -106,47 +139,42 @@ jobs:
106139 - name : Install Imath
107140 # Pre-install Imath so the builds validate that find_package sees the external installation
108141 if : inputs.OPENEXR_FORCE_INTERNAL_IMATH == 'OFF' && inputs.msystem == ''
109- run : share/ci/scripts/install_imath.sh main
142+ run : |
143+ share/ci/scripts/install_imath.sh main
144+ echo "OPENEXR_PATH=$OPENEXR_PATH:$PROGRAM_FILES/Imath/bin:$PROGRAM_FILES/Imath/lib" >> $GITHUB_ENV
110145 shell : bash
111146
112147 - name : Install libdeflate
113148 # Pre-install libdeflate so the builds validate that find_package sees the external installation
114149 if : inputs.OPENEXR_FORCE_INTERNAL_DEFLATE == 'OFF' && inputs.msystem == ''
115- run : share/ci/scripts/install_libdeflate.sh master
150+ run : |
151+ share/ci/scripts/install_libdeflate.sh master
152+ echo "OPENEXR_PATH=$OPENEXR_PATH:$PROGRAM_FILES/libdeflate/bin:$PROGRAM_FILES/libdeflate/lib" >> $GITHUB_ENV
116153 shell : bash
117154
118155 - name : Install OpenJPH
119156 # Pre-install OpenJPH so the builds validate finding the external installation
120157 if : inputs.OPENEXR_FORCE_INTERNAL_OPENJPH == 'OFF' && inputs.msystem == ''
121- run : share/ci/scripts/install_openjph.sh 0.21.2
122- shell : bash
123-
124- - name : Set PATH for Imath/libdeflate/OpenJPH DLLs
125- # When building against external Imath/libdeflate shared objects, the tests need PATH to include the dll's.
126- if : contains(inputs.os, 'windows') && inputs.msystem == ''
127158 run : |
128- echo "$PATH;C:/Program Files (x86)/Imath/bin;C:/Program Files (x86)/Imath/lib;C:/Program Files (x86)/libdeflate/bin;C:/Program Files (x86)/libdeflate/lib;C:/Program Files (x86)/openjph/lib;C:/Program Files (x86)/openjph/bin" >> $GITHUB_PATH
159+ share/ci/scripts/install_openjph.sh 0.21.2
160+ echo "OPENEXR_PATH=$OPENEXR_PATH:$PROGRAM_FILES/openjph/bin:$PROGRAM_FILES/openjph/lib" >> $GITHUB_ENV
129161 shell : bash
130162
131163 - name : Install help2man
132164 # TODO: this could go in the ASWF Linux docker
133165 # container. Also, it doesn't currently work for Windows, so
134166 # the windows builds have docs disabled.
135- if : ${{ inputs.OPENEXR_INSTALL_DOCS == 'ON' }}
167+ if : inputs.OPENEXR_INSTALL_DOCS == 'ON'
136168 run : share/ci/scripts/install_help2man.sh
137169 shell : bash
138170
139- - name : Create build directories
140- run : mkdir _install _build _examples
141- shell : bash
142-
143171 - name : Construct CMake command
144172 run : |
145173 # Construct the cmake command as a variable, so the
146174 # Configure step below can execute it, but also so we can store
147175 # in in the install_manifest as a debugging reference
148- cmake_args=("-B" "." "-S" ".. ")
149- cmake_args+=("-DCMAKE_INSTALL_PREFIX=../_install ")
176+ cmake_args=("-B" "$BUILD_DIR" -S "$WORKSPACE ")
177+ cmake_args+=("-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ")
150178 cmake_args+=("-DCMAKE_BUILD_TYPE=${{ inputs.build-type }}")
151179 cmake_args+=("-DOPENEXR_CXX_STANDARD=${{ inputs.cxx-standard }}")
152180 cmake_args+=("-DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED_LIBS }}")
@@ -177,11 +205,12 @@ jobs:
177205 quoted_args=$(printf '%q ' "${cmake_args[@]}")
178206 echo "CMAKE_ARGS=$quoted_args" >> "$GITHUB_ENV"
179207
180- # Remove the os version from the manifest name, so it only
181- # contains "ubuntu", "macos", or "windows", so the name is,
182- # e.g. install_manifest.macos.1.txt
183- echo "INSTALL_MANIFEST=$(echo 'install_manifest.${{ inputs.os }}' | cut -d'-' -f1).${{ inputs.build }}.txt" >> $GITHUB_ENV
184- working-directory : _build
208+ # Set the install manifest name to include the os and build number.
209+ # e.g. install_manifest.macos.1.txt. Note that $RUNNER_OS is "Linux",
210+ # while input.os is "ubuntu".
211+ os_name=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]') # linux, macos, windows
212+ build="${{ inputs.build }}"
213+ echo INSTALL_MANIFEST_FILENAME="install_manifest.${os_name}.${build}.txt" >> $GITHUB_ENV
185214 shell : bash
186215
187216 - name : Configure & Build
@@ -190,8 +219,7 @@ jobs:
190219 set -x
191220 cmake --version
192221 cmake ${{ env.CMAKE_ARGS }}
193- cmake --build . --target install --config ${{ inputs.build-type }}
194- working-directory : _build
222+ cmake --build $BUILD_DIR --target install --config ${{ inputs.build-type }}
195223 shell : bash
196224
197225 - name : Configure & Build (msys2) # requires msys2 shell
@@ -200,47 +228,58 @@ jobs:
200228 set -x
201229 cmake --version
202230 cmake ${{ env.CMAKE_ARGS }}
203- cmake --build . --target install --config ${{ inputs.build-type }}
204- working-directory : _build
231+ cmake --build $BUILD_DIR --target install --config ${{ inputs.build-type }}
205232 shell : msys2 {0}
206233
207234 - name : Test
208235 if : inputs.BUILD_TESTING == 'ON' && inputs.msystem == ''
209236 run : |
210237 set -x
211- ctest -T Test -C ${{ inputs.build-type }} --timeout 7200 --output-on-failure -VV
212- working-directory : _build
238+ if [[ "$RUNNER_OS" == "Windows" ]]; then
239+ export PATH="$OPENEXR_PATH:$PATH"
240+ fi
241+ ctest -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
213242 shell : bash
214243
215244 - name : Test (msys2) # requires msys2 shell
216245 if : inputs.BUILD_TESTING == 'ON' && inputs.msystem != ''
217246 run : |
218247 set -x
219- ctest -T Test -C ${{ inputs.build-type }} --timeout 7200 --output-on-failure -VV
220- working-directory : _build
248+ export PATH="$OPENEXR_PATH:$PATH"
249+ ctest -T Test -C ${{ inputs.build-type }} --test-dir $BUILD_DIR --timeout 7200 --output-on-failure -VV
221250 shell : msys2 {0}
222251
223252 - name : Prepare install_manifest
224253 # Store the cmake command as the first line of the manifest,
225254 # and remove the path prefix, so the manifest contains only
226255 # the local filenames.
227256 run : |
228- echo "# cmake ${{ env.CMAKE_ARGS }}" > "_build/$INSTALL_MANIFEST"
229- sort _build/install_manifest.txt | sed -e "s:^.*/_install/::" >> "_build/$INSTALL_MANIFEST"
257+ set -x
258+ INSTALL_MANIFEST_PATH="$BUILD_DIR/$INSTALL_MANIFEST_FILENAME"
259+ echo "# SPDX-License-Identifier: BSD-3-Clause" > $INSTALL_MANIFEST_PATH
260+ echo "# Copyright (c) Contributors to the OpenEXR Project." >> $INSTALL_MANIFEST_PATH
261+ echo "# cmake ${{ env.CMAKE_ARGS }}" >> $INSTALL_MANIFEST_PATH
262+ sort $BUILD_DIR/install_manifest.txt | sed -e "s:^.*/_install/::" >> $INSTALL_MANIFEST_PATH
263+ if [[ "$RUNNER_OS" == "Windows" ]]; then
264+ # upload-artifact expects a windows-style path
265+ INSTALL_MANIFEST_PATH=$(cygpath -w $INSTALL_MANIFEST_PATH)
266+ fi
267+ echo INSTALL_MANIFEST_PATH=$INSTALL_MANIFEST_PATH >> $GITHUB_ENV
230268 shell : bash
231269
232270 - name : Upload install_manifest.txt
233271 # Upload the manifest to make it possible to download for inspection and debugging
234272 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
235273 with :
236- name : ${{ env.INSTALL_MANIFEST }}
237- path : _build/ ${{ env.INSTALL_MANIFEST }}
274+ name : ${{ env.INSTALL_MANIFEST_FILENAME }}
275+ path : ${{ env.INSTALL_MANIFEST_PATH }}
238276
239277 - name : Validate install
240- if : ${{ inputs.validate_install == 'ON' }}
278+ if : inputs.validate_install == 'ON'
241279 # Validate that the build has installed the proper files by comparing against the appropriate reference manifest
242280 run : |
243- share/ci/scripts/validate_install.py "_build/$INSTALL_MANIFEST" "share/ci/install_manifest/$INSTALL_MANIFEST"
281+ set -x
282+ share/ci/scripts/validate_install.py "$INSTALL_MANIFEST_PATH" "share/ci/install_manifest/$INSTALL_MANIFEST_FILENAME"
244283 shell : bash
245284
246285 - name : Website examples
@@ -252,34 +291,32 @@ jobs:
252291 if : inputs.namespace == '' && inputs.msystem == '' && inputs.OPENEXR_BUILD_EXAMPLES != ''
253292 run : |
254293 set -x
255- if [[ "$RUNNER_OS" == "Windows" ]]; then
256- WORKSPACE=$(cygpath -u "$GITHUB_WORKSPACE")
257- else
258- WORKSPACE=$GITHUB_WORKSPACE
259- fi
260- INSTALL_DIR=$WORKSPACE/_install
261294 EXRWRITER_BUILD_DIR=$WORKSPACE/_build.exrwriter
262295 cmake -S website/src/exrwriter -B $EXRWRITER_BUILD_DIR \
263296 -DCMAKE_PREFIX_PATH=$INSTALL_DIR \
264297 -DCMAKE_VERBOSE_MAKEFILE=ON
265298 cmake --build $EXRWRITER_BUILD_DIR --config ${{ inputs.build-type }}
266299 if [[ "$RUNNER_OS" == "Windows" ]]; then
267- export PATH="$INSTALL_DIR/bin;$INSTALL_DIR/lib;C:/Program Files (x86)/Imath/bin;C:/Program Files (x86)/Imath/lib;C:/Program Files (x86)/libdeflate/bin;C:/Program Files (x86)/libdeflate/lib;C:/Program Files (x86)/openjph/lib;C:/Program Files (x86)/openjph/bin;$PATH"
268- EXRWRITER=$EXRWRITER_BUILD_DIR/${{ inputs.build-type }}/exrwriter.exe
269- EXRINFO=$INSTALL_DIR/bin/exrinfo.exe
270- else
271- EXRWRITER=$EXRWRITER_BUILD_DIR/exrwriter
272- EXRINFO=$INSTALL_DIR/bin/exrinfo
273- fi
274- if [ -x "$EXRWRITER" ]; then
275- "$EXRWRITER"
300+ export PATH="$OPENEXR_PATH:$PATH"
301+ EXRWRITER=$EXRWRITER_BUILD_DIR/${{ inputs.build-type }}/exrwriter.exe
302+ EXRINFO=$INSTALL_DIR/bin/exrinfo.exe
276303 else
277- echo "can't find exrwriter: $EXRWRITER"
304+ EXRWRITER=$EXRWRITER_BUILD_DIR/exrwriter
305+ EXRINFO=$INSTALL_DIR/bin/exrinfo
278306 fi
307+ "$EXRWRITER"
308+ # Validate that the image is as expected
279309 if [ -x "$EXRINFO" ]; then
280- "$EXRINFO" stripes.exr
310+ expected_output=$(<website/src/exrwriter/stripes.exrinfo.txt)
311+ actual_output=$("$EXRINFO" stripes.exr)
312+ if [[ "$actual_output" != "$expected_output" ]]; then
313+ echo "error: exrwriter produced incorrect results:"
314+ echo $actual_output
315+ exit 1
316+ fi
281317 else
282- echo "can't find exrinfo: $EXRINFO "
318+ echo "skipping exrinfo, no tool found. "
283319 fi
320+
284321 shell : bash
285322
0 commit comments