-
Notifications
You must be signed in to change notification settings - Fork 0
322 lines (303 loc) · 13.4 KB
/
build-connect.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
# On release creation:
# - Build and release connect for all platforms
name: CI-CONNECT-RELEASE
on:
release:
types: [created]
jobs:
# This job checks the tag pattern and decides whether to proceed or halt the workflow
check-tag:
runs-on: ubuntu-latest
steps:
- name: Check tag pattern
run: |
TAG_NAME=$(echo ${{ github.ref }} | sed 's|refs/tags/||')
echo "TAG_NAME=${TAG_NAME}"
# Check if the tag name starts with "connect/"
if [[ "${TAG_NAME}" != connect/* ]]; then
echo "Not supported by this CI"
exit 1
fi
# Set the environment variables for the rest of release workflow
set-variables:
needs: check-tag
runs-on: ubuntu-latest
outputs:
folder: ${{ env.FOLDER }}
package: ${{ env.PACKAGE }}
package_version: ${{ env.PACKAGE_VERSION }}
tag: ${{ env.TAG }}
steps:
- uses: actions/checkout@v3
- name: set environments on full release
shell: bash
run: |
echo "PACKAGE=$(echo ${{ github.ref }} | cut -d/ -f 3-3)" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(echo ${{ github.ref }} | cut -d/ -f 4-4)" >> $GITHUB_ENV
echo "TAG=$(echo ${{ github.ref }} | cut -d/ -f 3-4)" >> $GITHUB_ENV
- name: set apps folder
if: ${{ env.PACKAGE == 'connect' }}
shell: bash
run: |
echo "FOLDER=apps/${{ env.PACKAGE }}" >> $GITHUB_ENV
- name: debug
shell: bash
run: |
echo 'FOLDER: ${{ env.FOLDER }}'
echo 'PACKAGE: ${{ env.PACKAGE }}'
echo 'PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}'
echo 'TAG: ${{ env.TAG }}'
connect-build:
name: Build Connect
needs: set-variables
runs-on: macos-12 # Temporary setting macos-12 as OS instead of UBUNTU because python 6.6 onward has problems building resources on linux. (6.5 works but increases connect file size to double)
outputs:
connect_version: ${{ steps.get_version.outputs.connect_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install poetry
shell: bash
run: |
pip install poetry==1.5.1
- name: Build Qt resources
shell: bash
run: |
pip install --no-cache-dir -r tools/requirements-connect.txt
python tools/build.py --style_path resource --output_path source/ftrack_connect/ui/resource.py --pyside_version 6 build_qt_resources apps/connect
- name: poetry build and export dependencies
shell: bash
run: |
cd ${{ needs.set-variables.outputs.folder }}
poetry build
- name: Get Connect version
id: get_version # This ID is used to reference the output of the step
shell: bash
run: |
cd ${{ needs.set-variables.outputs.folder }}
CONNECT_VERSION=$(poetry version -s)
echo "Connect version: $CONNECT_VERSION"
echo "connect_version=$CONNECT_VERSION" >> $GITHUB_OUTPUT
- name: Prepare upload Connect wheel to GitHub Release
uses: actions/upload-artifact@v4
with:
name: ftrack-connect-whl
path: ${{ needs.set-variables.outputs.folder }}/dist/ftrack_connect-${{ steps.get_version.outputs.connect_version }}-py3-none-any.whl
- name: Upload Connect wheel to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo "Uploading ftrack_connect-${{ needs.connect-build.outputs.connect_version }}-py3-none-any.whl"
gh release upload ${{ needs.set-variables.outputs.tag }} ${{ needs.set-variables.outputs.folder }}/dist/ftrack_connect-${{ steps.get_version.outputs.connect_version }}-py3-none-any.whl --clobber
installer-windows:
name: Build Connect Installer on Windows
needs: [ set-variables, connect-build ]
runs-on: windows-latest
env:
CODESIGN: 'True' # Set this to 'True' or 'False' as needed
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install poetry
shell: bash
run: |
pip install poetry==1.5.1
- name: Build Qt resources
shell: bash
run: |
pip install -r tools/requirements-connect.txt
python tools/build.py --style_path resource --output_path source/ftrack_connect/ui/resource.py --pyside_version 6 build_qt_resources apps/connect
- uses: google-github-actions/auth@v2
if: env.CODESIGN == 'True'
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- uses: google-github-actions/setup-gcloud@v2
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'oracle'
- name: Install Inno Setup, needed to create the installer
run: |
choco install innosetup
- name: poetry build installer
shell: bash
run: |
cd ${{ needs.set-variables.outputs.folder }}
poetry install --with installer --sync
poetry run ftrack-connect-installer --codesign ${CODESIGN}
- name: Upload EXE installer to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo "Listing contents of apps/connect/dist:"
ls -l apps/connect/dist
echo "Listing contents of apps/connect/build:"
ls -l apps/connect/build
cd apps/connect/dist
version="${{ needs.set-variables.outputs.package_version }}"
clean_package_version="${version#v}" # Remove leading 'v' from version
echo "Uploading ftrack_connect-${clean_package_version}-win64.exe"
gh release upload ${{ needs.set-variables.outputs.tag }} "ftrack_connect-${clean_package_version}-win64.exe" --clobber
installer-macos:
name: Build Connect Installer on MacOs
needs: [ set-variables, connect-build ]
runs-on: macos-12
env:
CODESIGN: 'True' # A not codesigned dmg will always show damaged app. Please build locally if don't want to codesign and generate a ZIP instead of a dmg.
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install npm dependencies
run: npm install -g appdmg
- name: Set CPPFLAGS LDFLAGS
shell: bash
run: |
export CPPFLAGS=-I/usr/local/opt/openssl/include
export LDFLAGS=-L/usr/local/opt/openssl/lib
- name: Checkout code
uses: actions/checkout@v2
- name: install poetry
shell: bash
run: |
pip install poetry==1.5.1
- name: Build Qt resources
shell: bash
run: |
pip install -r tools/requirements-connect.txt
python tools/build.py --style_path resource --output_path source/ftrack_connect/ui/resource.py --pyside_version 6 build_qt_resources apps/connect
- name: Codesign app bundle
if: env.CODESIGN == 'True'
# Guidance pick from https://federicoterzi.com/blog/automatic-code-signing-and-notarization-for-macos-apps-using-github-actions/
# Extract the secrets we defined earlier as environment variables
env:
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
run: |
# Turn our base64-encoded certificate back to a regular .p12 file
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
# We need to create a new keychain, otherwise using the certificate will prompt
# with a UI dialog asking for the certificate password, which we can't
# use in a headless CI environment
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
# Verify certificate
echo "Verify certificate: "
security find-identity -v
# Create keychain credentials
echo "Create keychain profile to notarize"
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
# Build the installer and codesign
cd ${{ needs.set-variables.outputs.folder }}
poetry install --with installer --sync
poetry run ftrack-connect-installer --codesign ${CODESIGN}
- name: Upload Connect DMG to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo "Listing contents of apps/connect/dist:"
ls -l apps/connect/dist
echo "Listing contents of apps/connect/build:"
ls -l apps/connect/build
cd apps/connect/dist
version="${{ needs.set-variables.outputs.package_version }}"
clean_package_version="${version#v}" # Remove leading 'v' from version
echo "Uploading ftrack_connect-${clean_package_version}.dmg"
gh release upload ${{ needs.set-variables.outputs.tag }} "ftrack_connect-${clean_package_version}-macOS.dmg" --clobber
installer-rocky:
name: Build Connect Installer on Rocky linux
needs: [ set-variables, connect-build ]
runs-on: ubuntu-latest
strategy:
matrix:
rocky-version: [ '8', '9' ]
container:
image: rockylinux/rockylinux:${{ matrix.rocky-version }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies and pyenv
run: |
dnf install -y epel-release
dnf -y update
dnf groupinstall -y "Development Tools"
dnf install -y libxcb xcb-util-cursor gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel git findutils patch wget tar make libuuid-devel mesa-libGL
curl https://pyenv.run | bash
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
- name: Install GitHub CLI
run: |
dnf install -y dnf-plugins-core
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
dnf install -y gh
# Configure Git to allow the current directory
git config --global --add safe.directory /__w/integrations/integrations
- name: Install Python 3.10 using pyenv
run: |
source ~/.bashrc
pyenv install 3.10
pyenv global 3.10
- name: Verify Python version
run: |
source ~/.bashrc
pyenv versions
python --version
pyenv exec python -m pip install --upgrade pip
- name: Install patchelf using pip
run: |
source ~/.bashrc
pyenv exec pip install patchelf
- name: Checkout code
uses: actions/checkout@v2
- name: install poetry
shell: bash
run: |
source ~/.bashrc
pyenv exec pip install poetry==1.5.1
- name: Build Qt resources
shell: bash
run: |
source ~/.bashrc
pyenv exec pip install -r tools/requirements-connect.txt
pyenv exec python tools/build.py --style_path resource --output_path source/ftrack_connect/ui/resource.py --pyside_version 6 build_qt_resources apps/connect
- name: poetry build installer
shell: bash
run: |
source ~/.bashrc
cd ${{ needs.set-variables.outputs.folder }}
pyenv exec poetry install --with installer --sync
pyenv exec poetry run ftrack-connect-installer --codesign ${CODESIGN}
- name: Upload Connect tar.gz and md5 to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
source ~/.bashrc
echo "Listing contents of apps/connect/dist:"
ls -l apps/connect/dist
echo "Listing contents of apps/connect/build:"
ls -l apps/connect/build
cd apps/connect/dist
version="${{ needs.set-variables.outputs.package_version }}"
clean_package_version="${version#v}" # Remove leading 'v' from version
echo "Uploading ftrack_connect-${clean_package_version}-R${{ matrix.rocky-version }}.tar.gz"
gh release upload ${{ needs.set-variables.outputs.tag }} "ftrack_connect-${clean_package_version}-R${{ matrix.rocky-version }}.tar.gz" --clobber
gh release upload ${{ needs.set-variables.outputs.tag }} "ftrack_connect-${clean_package_version}-R${{ matrix.rocky-version }}.tar.gz.md5" --clobber