-
-
Notifications
You must be signed in to change notification settings - Fork 31
172 lines (146 loc) · 5.77 KB
/
windows-build.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
name: Windows-Build
on:
pull_request:
push:
paths-ignore:
- '.github/workflows/linux-build.yml'
- '.gitignore'
- 'LICENSE'
- 'README.md'
jobs:
build:
strategy:
matrix:
os: [windows-latest]
arch: [x64]
mode: [debug, releasedbg]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
env:
QT_VERSION: '5.15.2'
OBS_VERSION: '26.0.0'
CMAKE_GENERATOR: 'Visual Studio 17 2022'
steps:
- name: Get current date as package key
id: pkg_key
run: echo "::set-output name=key::$(date +'%W')"
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout Kinect SDKs
uses: actions/checkout@v4
continue-on-error: true
with:
repository: SirLynix/kinect-sdks
token: ${{ secrets.KINECT_SDKS_PAT }}
path: ${{ github.workspace }}/kinect-sdks
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Enable longpath in git for Windows
run: git config --system core.longpaths true
# Install Qt
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
# Select OBS runtime
- name: Choose OBS Debug or Release build
uses: haya14busa/action-cond@v1
id: cmake_target
with:
cond: ${{ matrix.mode == 'debug' }}
if_true: "Debug"
if_false: "RelWithDebInfo"
# Cache OBS Studio
- name: Retrieve OBS Studio cache
uses: actions/cache@v3
id: obs-cache
with:
path: ${{ github.workspace }}/obs-studio
key: Windows-OBS-Studio-${{ steps.cmake_target.outputs.value }}-${{ env.OBS_VERSION }}
# Build obs-studio
- name: Clone OBS
if: steps.obs-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: obsproject/obs-studio
path: ${{ github.workspace }}/obs-studio
submodules: 'recursive'
fetch-depth: 0 # for tags
# Checkout OBS to the wanted version
- name: Checkout OBS-Studio release (${{ env.OBS_VERSION }})
if: steps.obs-cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/obs-studio
run: |
git checkout ${{ env.OBS_VERSION }}
git submodule update
# Install OBS dependencies
- name: Install OBS dependencies
if: steps.obs-cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
curl https://obsproject.com/downloads/dependencies2019.zip --output dependencies2019.zip
mkdir obsdeps
tar -xv -C obsdeps -f dependencies2019.zip
# Configure and build obs
- name: Build OBS-Studio
if: steps.obs-cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/obs-studio
run: |
mkdir ./build64
cd ./build64
cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DDepsPath=${{ github.workspace }}\obsdeps\win64 -DQTDIR=${{ env.Qt5_DIR }} -DDISABLE_PLUGINS=YES -DENABLE_SCRIPTING=NO ..
msbuild /m /p:Configuration=${{ steps.cmake_target.outputs.value }} ./libobs/libobs.vcxproj
# Force xmake to a specific folder (for cache)
- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Install xmake
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@dev # avoids a bug in xmake 2.9.1
# Prepare environment
- name: Configure build
run:
echo "LibObs = { Include = [[${{ github.workspace }}\obs-studio\libobs]], Lib64 = [[${{ github.workspace }}\obs-studio\build64\libobs]] } ObsPlugins={}" > config.lua
# Update xmake repository (in order to have the file that will be cached)
- name: Update xmake repository
run: xmake repo --update
# Fetch xmake dephash
- name: Retrieve dependencies hash
id: dep_hash
run: echo "::set-output name=hash::$(xmake l utils.ci.packageskey)"
# Cache xmake dependencies
- name: Retrieve cached xmake dependencies
uses: actions/cache@v3
with:
path: ${{ env.XMAKE_GLOBALDIR }}\.xmake\packages
key: MSVC-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.pkg_key.outputs.key }}
# Setup compilation mode and install project dependencies
- name: Configure xmake and install dependencies
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --yes --verbose
env:
KINECTSDKAZUREBT_DIR: ${{ github.workspace }}/kinect-sdks/k4abt
KINECTSDK10_DIR: ${{ github.workspace }}/kinect-sdks/sdk1
KINECT_TOOLKIT_DIR: ${{ github.workspace }}/kinect-sdks/sdk1-toolkit
KINECTSDK20_DIR: ${{ github.workspace }}/kinect-sdks/sdk2
# Build the plugin
- name: Build obs-kinect
run: xmake --verbose
env:
KINECTSDKAZUREBT_DIR: ${{ github.workspace }}/kinect-sdks/k4abt
KINECTSDK10_DIR: ${{ github.workspace }}/kinect-sdks/sdk1
KINECT_TOOLKIT_DIR: ${{ github.workspace }}/kinect-sdks/sdk1-toolkit
KINECTSDK20_DIR: ${{ github.workspace }}/kinect-sdks/sdk2
# Install the result files
- name: Install obs-kinect
run: xmake package -vo package
env:
KINECTSDKAZUREBT_DIR: ${{ github.workspace }}/kinect-sdks/k4abt
KINECTSDK10_DIR: ${{ github.workspace }}/kinect-sdks/sdk1
KINECT_TOOLKIT_DIR: ${{ github.workspace }}/kinect-sdks/sdk1-toolkit
KINECTSDK20_DIR: ${{ github.workspace }}/kinect-sdks/sdk2
# Upload artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}
path: package