-
Notifications
You must be signed in to change notification settings - Fork 329
283 lines (251 loc) · 10.1 KB
/
windows.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
name: Windows Build
on:
push:
branches:
- dev
- releases
tags:
- '[0-9]+.*'
pull_request:
branches:
- dev
workflow_dispatch:
env:
publish_pre_dev_labels: '["Beep6581:wbrefinement"]'
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
build_type: [release, debug]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
uses: msys2/setup-msys2@v2
with:
location: C:\msys2
update: true
msystem: MINGW64
install: |
git
intltool
pacboy: |
cc:p
pkgconf:p
cmake:p
ninja:p
gtkmm3:p
lcms2:p
fftw:p
lensfun:p
libiptcdata:p
exiv2:p
- name: Configure build
run: |
export REF_NAME_FILTERED="$(echo '${{github.ref_name}}' | sed 's/[^A-z0-9_.-]//g')"
if [ '${{github.ref_type}}' == 'tag' ]; then
export CACHE_SUFFIX=""
else
echo "Setting cache suffix."
export CACHE_SUFFIX="5-$REF_NAME_FILTERED"
echo "Cache suffix is '$CACHE_SUFFIX'."
fi
echo "Running CMake configure."
cmake \
-G "Ninja" \
-DCMAKE_BUILD_TYPE='${{matrix.build_type}}' \
-DCACHE_NAME_SUFFIX="$CACHE_SUFFIX" \
-DPROC_TARGET_NUMBER="1" \
-DLENSFUNDBDIR="share/lensfun" \
-S . -B build
echo "Recording filtered ref name."
echo "REF_NAME_FILTERED=$REF_NAME_FILTERED" >> "$(cygpath -u $GITHUB_ENV)"
- name: Build RawTherapee
run: |
echo "Running CMake install."
cmake --build build --target install
- name: Include Lensfun
run: |
echo "Updating Lensfun database."
lensfun-update-data
echo "Creating Lensfun directory in the build directory."
mkdir -p 'build/${{matrix.build_type}}/share'
echo "Copying Lensfun database to the build directory."
cp -R "/C/msys2/msys64/mingw64/var/lib/lensfun-updates/version_1" 'build/${{matrix.build_type}}/share/lensfun'
- name: Bundle dependencies
run: |
echo "Listing shared library dependencies."
ldd "./build/${{matrix.build_type}}/rawtherapee.exe"
echo "Finding DLLs to include."
DLLS=($(ldd "./build/${{matrix.build_type}}/rawtherapee.exe" | grep '/mingw64/bin/' | awk '{print($1)'}))
echo "Required DLLs are: ${DLLS[*]}"
echo "Getting workspace path."
export BUILD_DIR="$(pwd)/build/${{matrix.build_type}}"
echo "Build directory is '$BUILD_DIR'."
echo "Changing working directory to MSYS2 MINGW64."
cd "/C/msys2/msys64/mingw64"
echo "Copying DLLs and EXEs."
cd ./bin
cp \
"gdbus.exe" \
"gspawn-win64-helper.exe" \
"gspawn-win64-helper-console.exe" \
${DLLS[*]} \
"$BUILD_DIR"
cd -
echo "Copying Adwaita theme."
mkdir -p "$BUILD_DIR/share/icons/Adwaita"
cd 'share/icons/Adwaita/'
mkdir -p "$BUILD_DIR/share/icons/Adwaita/symbolic"
cp -r \
"symbolic/actions" \
"symbolic/devices" \
"symbolic/mimetypes" \
"symbolic/places" \
"symbolic/status" \
"symbolic/ui" \
"$BUILD_DIR/share/icons/Adwaita/symbolic"
cp 'index.theme' "$BUILD_DIR/share/icons/Adwaita"
mkdir -p "$BUILD_DIR/share/icons/Adwaita/cursors"
cp -r \
"cursors/plus.cur" \
"cursors/sb_h_double_arrow.cur" \
"cursors/sb_left_arrow.cur" \
"cursors/sb_right_arrow.cur" \
"cursors/sb_v_double_arrow.cur" \
"$BUILD_DIR/share/icons/Adwaita/cursors"
cd -
echo "Copying GDK pixbuf."
mkdir -p "$BUILD_DIR/lib"
cp -r 'lib/gdk-pixbuf-2.0' "$BUILD_DIR/lib/gdk-pixbuf-2.0"
echo "Copying GLib schemas."
mkdir -p "$BUILD_DIR/share/glib-2.0/schemas"
cp 'share/glib-2.0/schemas/gschemas.compiled' "$BUILD_DIR/share/glib-2.0/schemas"
echo "Creating GTK settings.ini."
mkdir -p "$BUILD_DIR/share/gtk-3.0/"
echo -e '[Settings]\ngtk-button-images=1' > "$BUILD_DIR/share/gtk-3.0/settings.ini"
- name: Create installer
if: ${{matrix.build_type == 'release' && (github.ref_type == 'tag' || github.ref_name == 'dev')}}
working-directory: build/${{matrix.build_type}}
shell: pwsh
run: |
echo "Installing Inno Setup."
choco install innosetup
echo "Setup file:"
type "WindowsInnoSetup.iss"
echo "Creating installer from script."
iscc /F"installer" "WindowsInnoSetup.iss"
- name: Prepare artifact name
run: |
if [ '${{github.ref_type}}' == 'tag' ]; then
ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_win64_${{matrix.build_type}}"
else
echo "Getting RawTherapee version."
export VERSION="$(grep -m 1 '^Version: .*$' './build/${{matrix.build_type}}/AboutThisBuild.txt' | sed 's/^Version: \(.\+\)$/\1/')"
echo "Version is '$VERSION'."
FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')"
ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_${FILTERED_VERSION}_win64_${{matrix.build_type}}"
fi
echo "Artifact name is '$ARTIFACT_NAME'."
echo "Recording artifact name."
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> "$(cygpath -u $GITHUB_ENV)"
echo "Recording RawTherapee version."
echo "RT_VERSION=$VERSION" >> "$(cygpath -u $GITHUB_ENV)"
echo "Renaming artifact."
mv './build/${{matrix.build_type}}' "./build/$ARTIFACT_NAME"
if [ -e './build/installer.exe' ]; then
echo "Renaming installer."
mv './build/installer.exe' "./build/$ARTIFACT_NAME.exe"
fi
- name: Create ZIP archive
shell: cmd
working-directory: ./build
run: |
echo "Zipping artifact."
7z a -tzip "%ARTIFACT_NAME%.zip" "./%ARTIFACT_NAME%"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}
path: build\${{env.ARTIFACT_NAME}}
- name: Upload installer
if: ${{matrix.build_type == 'release' && (github.ref_type == 'tag' || github.ref_name == 'dev')}}
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}.exe
path: build\${{env.ARTIFACT_NAME}}.exe
- name: Prepare for publishing
if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}
run: |
echo "Setting publish name."
PUBLISH_NAME="RawTherapee_${REF_NAME_FILTERED}_win64_${{matrix.build_type}}"
echo "Publish name is '$PUBLISH_NAME'."
if [ "$ARTIFACT_NAME" != "$PUBLISH_NAME" ]; then
echo "Renaming ZIP file."
cp "build/$ARTIFACT_NAME.zip" "build/$PUBLISH_NAME.zip"
if [ -e "./build/$ARTIFACT_NAME.exe" ]; then
echo "Renaming installer."
mv "./build/$ARTIFACT_NAME.exe" "./build/$PUBLISH_NAME.exe"
fi
fi
echo "Creating version file."
cp "build/$ARTIFACT_NAME/AboutThisBuild.txt" "build/$PUBLISH_NAME-AboutThisBuild.txt"
echo "Recording publish name."
echo "PUBLISH_NAME=$PUBLISH_NAME" >> "$(cygpath -u $GITHUB_ENV)"
- name: Publish artifacts
uses: softprops/action-gh-release@v1
if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}
with:
tag_name: nightly-github-actions
files: |
build/${{env.PUBLISH_NAME}}.zip
build/${{env.PUBLISH_NAME}}-AboutThisBuild.txt
- name: Publish installer
uses: softprops/action-gh-release@v1
if: ${{matrix.build_type == 'release' && (github.ref_type == 'tag' || github.ref_name == 'dev')}}
with:
tag_name: nightly-github-actions
files: build/${{env.PUBLISH_NAME}}.exe
- name: Prepare for publishing pre-dev
id: prepare-publish-pre-dev
if: ${{github.event_name == 'pull_request' && contains(fromJSON(env.publish_pre_dev_labels), github.event.pull_request.head.label)}}
run: |
echo "Making ref name."
REF_NAME_FILTERED="$(echo '${{github.event.pull_request.head.label}}' | tr ':' '_' | sed 's/[^A-z0-9_.-]//g')"
echo "Ref name is '$REF_NAME_FILTERED'."
echo "Setting publish name."
PUBLISH_NAME="RawTherapee_${REF_NAME_FILTERED}_win64_${{matrix.build_type}}"
echo "Publish name is '$PUBLISH_NAME'."
if [ "$ARTIFACT_NAME" != "$PUBLISH_NAME" ]; then
echo "Renaming ZIP file."
cp "build/$ARTIFACT_NAME.zip" "build/$PUBLISH_NAME.zip"
if [ -e "./build/$ARTIFACT_NAME.exe" ]; then
echo "Renaming installer."
mv "./build/$ARTIFACT_NAME.exe" "./build/$PUBLISH_NAME.exe"
fi
fi
echo "Creating version file."
cp "build/$ARTIFACT_NAME/AboutThisBuild.txt" "build/$PUBLISH_NAME-AboutThisBuild.txt"
echo "Recording publish name."
echo "PUBLISH_NAME=$PUBLISH_NAME" >> "$(cygpath -u $GITHUB_ENV)"
- name: Publish pre-dev artifacts
uses: softprops/action-gh-release@v1
if: ${{steps.prepare-publish-pre-dev.outcome == 'success'}}
with:
tag_name: pre-dev-github-actions
files: |
build/${{env.PUBLISH_NAME}}.zip
build/${{env.PUBLISH_NAME}}-AboutThisBuild.txt
- name: Publish pre-dev installer
uses: softprops/action-gh-release@v1
if: ${{steps.prepare-publish-pre-dev.outcome == 'success' && matrix.build_type == 'release'}}
with:
tag_name: pre-dev-github-actions
files: build/${{env.PUBLISH_NAME}}.exe