-
Notifications
You must be signed in to change notification settings - Fork 124
203 lines (170 loc) · 7.31 KB
/
main.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
name: CI
on:
workflow_dispatch:
push:
branches:
- main
- 'RB-*'
pull_request:
branches:
- main
- 'RB-*'
release:
types: [published]
jobs:
build:
strategy:
# Don't cancel other jobs in the build matrix if one job fails.
fail-fast: false
matrix:
# Rather than generate all permutations of various settings,
# we want to explicitly list each of the variants we want to
# test. We can use `name` to declare the names of our variants,
# and then use `include` to define their settings.
name: [
linux-python3,
linux-python3-debug,
windows-python3,
windows-python3-debug
]
include:
- name: linux-python3
os: ubuntu-20.04
buildType: RELEASE
containerImage: ghcr.io/gafferhq/build/build:2.0.0
options: .github/workflows/main/options.posix
dependenciesURL: https://github.com/GafferHQ/dependencies/releases/download/6.0.0/gafferDependencies-6.0.0-linux.tar.gz
tests: testCore testCorePython testScene testImage testAlembic testUSD testVDB
publish: true
- name: linux-python3-debug
os: ubuntu-20.04
buildType: DEBUG
containerImage: ghcr.io/gafferhq/build/build:2.0.0
options: .github/workflows/main/options.posix
dependenciesURL: https://github.com/GafferHQ/dependencies/releases/download/6.0.0/gafferDependencies-6.0.0-linux.tar.gz
tests: testCore testCorePython testScene testImage testAlembic testUSD testVDB
publish: false
- name: windows-python3
os: windows-2019
buildType: RELEASE
options: .github/workflows/main/options.windows
dependenciesURL: https://github.com/GafferHQ/dependencies/releases/download/6.0.0/gafferDependencies-6.0.0-windows.zip
tests: testCore testCorePython testScene testImage testAlembic testUSD testVDB
publish: true
- name: windows-python3-debug
os: windows-2019
buildType: RELWITHDEBINFO
options: .github/workflows/main/options.windows
dependenciesURL: https://github.com/GafferHQ/dependencies/releases/download/6.0.0/gafferDependencies-6.0.0-windows.zip
tests: testCore testCorePython testScene testImage testAlembic testUSD testVDB
publish: false
runs-on: ${{ matrix.os }}
container: ${{ matrix.containerImage }}
steps:
- uses: actions/checkout@v2
- uses: ilammy/[email protected]
with:
sdk: 10.0.17763.0
- name: Install toolchain (Windows)
run: |
python -m pip install scons
echo "PACKAGE_COMMAND=7z a -tzip" >> $env:GITHUB_ENV
echo "PACKAGE_EXTENSION=zip" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: Install toolchain (MacOS)
# Prefer `pip install` because it is faster
# than `brew install`.
run: |
sudo pip3 install scons==4.0.1
# Brew installs all manner of headers into `/usr/local/include`, including
# OpenEXR and Imath versions that conflict with our own. We can't stop Clang
# finding them because Clang is hardcoded to look in `/usr/local/include`
# _before_ anything we specify with `-isystem`, despite documentation to the
# contrary. So we nuke the headers.
rm -rf /usr/local/include/*
echo PACKAGE_COMMAND=tar -czf >> $GITHUB_ENV
echo PACKAGE_EXTENSION=tar.gz >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Install toolchain (Linux)
run: |
# The Docker container configures bash shells such that they enable the
# software collections we want. If we could set GitHub's
# `defaults.run.shell` to `bash` then all our build steps would pick up
# this environment automatically. But we can't do that because it
# breaks the build on Windows, and we can't configure a different shell
# per platform because GitHub won't allow it. But we can run _this_
# Linux-only step in bash, and transfer the environment out to be used
# in later steps.
echo $PATH > $GITHUB_PATH
echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >> $GITHUB_ENV
echo PACKAGE_COMMAND=tar -czf >> $GITHUB_ENV
echo PACKAGE_EXTENSION=tar.gz >> $GITHUB_ENV
shell: bash
if: runner.os == 'Linux'
- name: Install Python Modules
run: |
python --version
pip install PyJWT==1.7.1 PyGitHub==1.45
- name: Set Custom Variables
run: |
.github/workflows/main/setBuildVars.py
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CORTEX_BUILD_VARIANT: ${{ matrix.name }}
shell: bash
- name: Install dependencies
# The `$GITHUB_ENV` shenanigans creates an environment variable
# containing the hash of the archive, for use in the cache key
# below.
run: |
echo CORTEX_DEPENDENCIES_HASH=`python config/installDependencies.py --archiveURL ${{ matrix.dependenciesURL }} --dependenciesDir ${{ env.CORTEX_BUILD_NAME }} --outputFormat "{archiveDigest}"` >> $GITHUB_ENV
shell: bash
- name: Cache
uses: actions/cache@v3
with:
path: sconsCache
key: ${{ runner.os }}-${{ matrix.containerImage }}-${{env.CORTEX_DEPENDENCIES_HASH}}-${{ matrix.buildType }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.containerImage }}-${{env.CORTEX_DEPENDENCIES_HASH}}-${{ matrix.buildType }}-
- name: Build
run: |
scons -j 2 install BUILD_TYPE=${{ matrix.buildType }} OPTIONS=${{ matrix.options }} BUILD_CACHEDIR=sconsCache
# Copy the config log for use in the "Debug Failures" step, because it
# gets clobbered by the `scons test*` call below.
cp config.log buildConfig.log
- name: Test
run: |
scons ${{ matrix.tests }} BUILD_TYPE=${{ matrix.buildType }} OPTIONS=${{ matrix.options }} BUILD_CACHEDIR=sconsCache
env:
IECORE_RTLD_GLOBAL: 0
OCIO: ${{ env.CORTEX_BUILD_NAME }}/openColorIO/config.ocio
- name: Build Package
run: |
${{ env.PACKAGE_COMMAND }} ${{ env.CORTEX_BUILD_NAME }}.${{env.PACKAGE_EXTENSION}} ${{ env.CORTEX_BUILD_NAME }}
if: matrix.publish
- uses: actions/upload-artifact@v2
with:
name: ${{ env.CORTEX_BUILD_NAME }}
path: ${{ env.CORTEX_BUILD_NAME }}.${{ env.PACKAGE_EXTENSION }}
if: matrix.publish
- name: Publish Release
run: |
python ./.github/workflows/main/publishRelease.py --archive ${{ env.CORTEX_BUILD_NAME }}.${{ env.PACKAGE_EXTENSION }} --repo ${{ github.repository }} --releaseId ${{ env.CORTEX_GITHUB_RELEASEID }}
if: matrix.publish && env.CORTEX_GITHUB_RELEASEID != ''
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Limit cache size
run: python ./.github/workflows/main/limitCacheSize.py
- name: Debug Failures
run: |
# Give MacOS crash reporter time to do its thing
sleep 20
# Print SCons logs and MacOS crash logs
shopt -s nullglob
for logFile in config.log buildConfig.log ~/Library/Logs/DiagnosticReports/*.crash
do
echo $logFile
cat $logFile
done
shell: bash
if: failure()