-
Notifications
You must be signed in to change notification settings - Fork 630
180 lines (159 loc) · 6.69 KB
/
ci_steps.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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.
# These are the steps for all CI jobs. Linux, macOS, and Windows all
# share a common set of configure/build/validate steps. The input
# variables control all variations of the jobs.
#
# Each job validates that the proper files are installed by comparing
# the install_manifest.txt to a reference for that job. This requires
# that each job have a corresponding reference, and that thes
# references are updated when any change is made to the installation
# headers/libraries/cmake/etc.
name: CI Steps
on:
workflow_call:
# This inputs receive values via the "with:" section in ci_workflow.yml
inputs:
build:
type: string
os:
type: string
container:
type: string
cxx-standard:
type: string
cxx-compiler:
type: string
cc-compiler:
type: string
build-type:
type: string
BUILD_SHARED_LIBS:
type: string
OPENEXR_ENABLE_THREADING:
type: string
OPENEXR_INSTALL_PKG_CONFIG:
type: string
OPENEXR_INSTALL_DOCS:
type: string
OPENEXR_BUILD_EXAMPLES:
type: string
OPENEXR_BUILD_TOOLS:
type: string
OPENEXR_FORCE_INTERNAL_IMATH:
type: string
OPENEXR_FORCE_INTERNAL_DEFLATE:
type: string
BUILD_TESTING:
type: string
namespace:
type: string
validate_install:
type: string
jobs:
steps:
runs-on: ${{ inputs.os }}
container:
image: ${{ inputs.container }}
env:
CXX: ${{ inputs.cxx-compiler }}
CC: ${{ inputs.cc-compiler }}
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Install Imath
# Pre-install Imath so the builds validate finding the external installation
if: ${{ inputs.OPENEXR_FORCE_INTERNAL_IMATH == 'OFF' }}
run: share/ci/scripts/install_imath.sh main
shell: bash
- name: Install libdeflate
# Pre-install libdeflate so the builds validate finding the external installation
if: ${{ inputs.OPENEXR_FORCE_INTERNAL_DEFLATE == 'OFF' }}
run: share/ci/scripts/install_libdeflate.sh master
shell: bash
- name: Install help2man
# TODO: this could go in the ASWF Linux docker
# container. Also, it doesn't currently work for Windows, so
# the windows builds have docs disabled.
if: ${{ inputs.OPENEXR_INSTALL_DOCS == 'ON' }}
run: share/ci/scripts/install_help2man.sh
shell: bash
- name: Create build directories
run: mkdir _install _build _examples
shell: bash
- name: Construct CMake command
run: |
# Construct the cmake command as a variable, so the
# Configure step below can execute it, but also so we can store
# in in the install_manifest as a debugging reference
CMAKE_COMMAND="cmake -B . -S .. \
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_BUILD_TYPE=${{ inputs.build-type }} \
-DOPENEXR_CXX_STANDARD=${{ inputs.cxx-standard }} \
-DBUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED_LIBS }} \
-DOPENEXR_ENABLE_THREADING=${{ inputs.OPENEXR_ENABLE_THREADING }} \
-DOPENEXR_INSTALL_PKG_CONFIG=${{ inputs.OPENEXR_INSTALL_PKG_CONFIG }} \
-DOPENEXR_INSTALL_DOCS=${{ inputs.OPENEXR_INSTALL_DOCS }} \
-DOPENEXR_BUILD_EXAMPLES=${{ inputs.OPENEXR_BUILD_EXAMPLES }} \
-DOPENEXR_BUILD_TOOLS=${{ inputs.OPENEXR_BUILD_TOOLS }} \
-DOPENEXR_FORCE_INTERNAL_IMATH=${{ inputs.OPENEXR_FORCE_INTERNAL_IMATH }} \
-DOPENEXR_FORCE_INTERNAL_DEFLATE=${{ inputs.OPENEXR_FORCE_INTERNAL_DEFLATE }} \
-DBUILD_TESTING=${{ inputs.BUILD_TESTING }} \
-DOPENEXR_RUN_FUZZ_TESTS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON"
if [ -n "${{ inputs.namespace }}" ]; then
CMAKE_COMMAND="$CMAKE_COMMAND \
-DOPENEXR_IMF_NAMESPACE=${{ inputs.namespace }} \
-DILMTHREAD_NAMESPACE=${{ inputs.namespace }} \
-DIEX_NAMESPACE=${{ inputs.namespace }}"
fi
echo "CMAKE_COMMAND=$CMAKE_COMMAND" >> $GITHUB_ENV
# Remove the os version from the manifest name, so it only
# contains "ubuntu", "macos", or "windows", so the name is,
# e.g. install_manifest.macos.1.txt
echo "INSTALL_MANIFEST=$(echo 'install_manifest.${{ inputs.os }}' | cut -d'-' -f1).${{ inputs.build }}.txt" >> $GITHUB_ENV
working-directory: _build
shell: bash
- name: Configure
run: |
$CMAKE_COMMAND
working-directory: _build
shell: bash
- name: Build
run: |
cmake --build . --target install --config ${{ inputs.build-type }}
working-directory: _build
shell: bash
- name: Prepare install_manifest
# Store the cmake command as the first line of the manifest,
# and remove the path prefix, so the manifest contains only
# the local filenames.
run: |
echo "# $CMAKE_COMMAND" > "_build/$INSTALL_MANIFEST"
sort _build/install_manifest.txt | sed -e "s:^.*/_install/::" >> "_build/$INSTALL_MANIFEST"
shell: bash
- name: Upload install_manifest.txt
# Upload the manifest to make it possible to download for inspection and debugging
uses: actions/upload-artifact@v4
with:
name: ${{ env.INSTALL_MANIFEST }}
path: _build/${{ env.INSTALL_MANIFEST }}
- name: Validate install
if: ${{ inputs.validate_install == 'ON' }}
# Validate that the build has installed the proper files by comparing against the appropriate reference manifest
run: |
share/ci/scripts/validate_install.py "_build/$INSTALL_MANIFEST" "share/ci/install_manifest/$INSTALL_MANIFEST"
shell: bash
- name: Set PATH for Imath/libdeflate DLLs
# When building against external Imath/libdeflate shared objects, the tests need PATH to include the dll's.
if: contains(inputs.os, 'windows')
run: |
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" >> $GITHUB_PATH
shell: bash
- name: Test
run: |
ctest -T Test -C ${{ inputs.build-type }} --timeout 7200 --output-on-failure -VV
working-directory: _build
shell: bash