-
Notifications
You must be signed in to change notification settings - Fork 8
245 lines (200 loc) · 8.24 KB
/
build-workspace.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
name: Build Workspace
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install gstreamer
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libatk1.0-dev libgtk-3-dev
version: 2.0
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --workspace
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --release
- name: Archive Linux OpenFX plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-linux-openfx
path: crates/openfx-plugin/build/
- name: Package Linux binaries
run: |
mkdir ntsc-rs-linux-standalone
cp target/release/ntsc-rs-standalone ntsc-rs-linux-standalone
cp target/release/ntsc-rs-cli ntsc-rs-linux-standalone
- name: Archive Linux binary
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-linux-standalone
path: ntsc-rs-linux-standalone
build-windows:
runs-on: windows-2019
steps:
# This is an attempt to make the Windows CI image faster. Not sure if it works.
- name: Disable Defender
run: Set-MpPreference -DisableRealtimeMonitoring $true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# Put the Chocolatey temp directory in a place where we can use the cache action to save and restore it.
- name: Set chocolatey temp directory
run: |
choco config set cacheLocation --value "$Env:GITHUB_WORKSPACE\chocolatey_cache"
echo "CHOCO_TEMP=$Env:GITHUB_WORKSPACE\chocolatey_cache" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Restore Chocolatey cache
id: choco-cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.CHOCO_TEMP }}
# TODO: Why did I set up the cache key like this?
key: 'this should never hit'
restore-keys: choco-${{ github.job }}-
- name: Install gstreamer
# Some things to note:
# - GStreamer adds some environment variables, which we need to pick up.
# - GSTREAMER_1_0_ROOT_MSVC_X86_64 cannot be hardcoded because it can be installed on different drive letters,
# seemingly chosen at random.
# - We need to export said path to the environment variables so that later steps can use it.
run: |
choco install gstreamer gstreamer-devel
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
echo "$($Env:GSTREAMER_1_0_ROOT_MSVC_X86_64)bin"
echo "$($Env:GSTREAMER_1_0_ROOT_MSVC_X86_64)bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "GSTREAMER_1_0_ROOT_MSVC_X86_64=$Env:GSTREAMER_1_0_ROOT_MSVC_X86_64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Save Chocolatey cache
id: choco-cache-save
uses: actions/cache/save@v4
with:
path: ${{ env.CHOCO_TEMP }}
# TODO: Pretty sure I'm misunderstanding the point of hashFiles here.
key: choco-${{ github.job }}-${{ hashFiles(format('{0}\**\*', env.CHOCO_TEMP)) }}
- uses: Swatinem/rust-cache@v2
- name: Build GUI
run: cargo build --release -p gui
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --release
- name: Build After Effects plugin
run: |
cargo build --release -p ae-plugin
cp target\release\ae_plugin.dll .\ntsc-rs-ae.aex
- name: Archive Windows OpenFX plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-openfx
path: crates/openfx-plugin/build/
- name: Package Windows binary
if: ${{ github.ref_type == 'tag' }}
# Some things to note:
# - Robocopy has a non-zero exit code even when successful. We therefore clear it to 0 so that Actions doesn't
# fail.
run: |
mkdir ntsc-rs-windows-standalone
cd ntsc-rs-windows-standalone
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64 .\ *.dll /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64\share\licenses .\licenses /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
cp ..\target\release\ntsc-rs-standalone.exe .\bin\
cp ..\target\release\ntsc-rs-cli.exe .\bin\
cp ..\target\release\ntsc-rs-launcher.exe .\
- name: Archive Windows binary
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-standalone
path: ntsc-rs-windows-standalone
- name: Archive Windows After Effects plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-afterfx
path: .\ntsc-rs-ae.aex
build-macos:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set deployment target
run: echo 'MACOSX_DEPLOYMENT_TARGET=10.12' >> $GITHUB_ENV
- name: Add x86_64 target
run: |
rustup target add x86_64-apple-darwin
- name: Install packages
run: |
brew install --cask gstreamer-runtime
brew install --cask gstreamer-development
- name: Setup GStreamer devel
run: |
echo "/Library/Frameworks/GStreamer.framework/Versions/1.0/bin" >> $GITHUB_PATH
echo 'PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig"' >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2
- name: Build standalone app
run: cargo xtask macos-bundle --release --destdir=build/ntsc-rs-standalone
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --macos-universal --release --destdir=build/ntsc-rs-openfx
- name: Build After Effects plugin
run: cargo xtask macos-ae-plugin --macos-universal --release --destdir=build/ntsc-rs-afterfx
- name: Create .pkg installers for bundles
if: ${{ github.ref_type == 'tag' }}
# Using the "latest" compression setting is slower (50 seconds vs 25ish) but results in a smaller file
# (around 120MB vs around 180MB).
run: |
pkgbuild --install-location /Applications --component build/ntsc-rs-standalone/ntsc-rs.app --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-standalone.pkg
pkgbuild --install-location /Library/OFX/Plugins --component build/ntsc-rs-openfx/NtscRs.ofx.bundle --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-openfx.pkg
pkgbuild --install-location "/Library/Application Support/Adobe/Common/Plug-ins/7.0/MediaCore" --component build/ntsc-rs-afterfx/ntsc-rs.plugin --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-afterfx.pkg
- name: Archive .pkg installers
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-macos
path: build/ntsc-rs-*.pkg
# TODO: sign bundles
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- build-windows
- build-macos
- build-linux
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Zip Windows/Linux artifacts
run: |
shopt -s extglob
for dir in ntsc-rs-@(windows|linux)*/; do zip -r "${dir%/}.zip" "${dir%/}"; done
working-directory: ./artifacts
- name: Display structure of downloaded files
run: ls -l
working-directory: ./artifacts
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "./artifacts/ntsc-rs-*.zip,./artifacts/ntsc-rs-macos/ntsc-rs-*.pkg"
draft: true