-
Notifications
You must be signed in to change notification settings - Fork 276
224 lines (203 loc) · 8.03 KB
/
ci.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
# © OpenShot Studios, LLC
#
# SPDX-License-Identifier: LGPL-3.0-or-later
name: libopenshot CI Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.sys.os }}
strategy:
matrix:
sys:
- { os: ubuntu-20.04, shell: bash }
- { os: ubuntu-22.04, shell: bash }
#- { os: windows-2022, shell: 'msys2 {0}' } Disabled until we upgrade to C++17 and find_package(Protobuf CONFIG REQUIRED)
compiler:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
exclude:
# Windows clang isn't being our friend,
# JUCE seems to think it can use _get_tzname there
# (it can't)
- sys: { os: windows-2022, shell: 'msys2 {0}' }
compiler: { cc: clang, cxx: clang++ }
defaults:
run:
shell: "${{ matrix.sys.shell }}"
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CODECOV_TOKEN: 'dc94d508-39d3-4369-b1c6-321749f96f7c'
steps:
- uses: actions/checkout@v3
with:
# Work around a codecov issue detecting commit SHAs
# see: https://community.codecov.io/t/issue-detecting-commit-sha-please-run-actions-checkout-with-fetch-depth-1-or-set-to-0/2571
fetch-depth: 0
- name: Checkout OpenShotAudio
uses: actions/checkout@v3
with:
repository: OpenShot/libopenshot-audio
path: audio
- name: Checkout Resvg
if: ${{ matrix.compiler.cc == 'clang' && runner.os == 'linux' }}
uses: actions/checkout@v3
with:
repository: RazrFalcon/resvg
path: resvg
ref: v0.19.0
- uses: haya14busa/action-cond@v1
id: generator
with:
cond: ${{ runner.os == 'Windows' }}
if_true: "MinGW Makefiles"
if_false: "Unix Makefiles"
- uses: haya14busa/action-cond@v1
id: coverage
with:
cond: ${{ (matrix.compiler.cc == 'gcc' && runner.os == 'linux') || (matrix.compiler.cc == 'clang' && runner.os == 'macos') }}
if_true: "-DENABLE_COVERAGE:BOOL=1"
- uses: haya14busa/action-cond@v1
id: use-resvg
with:
cond: ${{ matrix.compiler.cc == 'clang' && runner.os == 'linux' }}
if_true: "-DResvg_ROOT:PATH=./resvg"
- name: Install Linux dependencies
if: ${{ runner.os == 'linux' }}
run: |
sudo apt update
sudo apt remove libzmq5 # See actions/virtual-environments#3317
sudo apt install \
cmake swig doxygen graphviz curl lcov \
libasound2-dev \
qtbase5-dev qtbase5-dev-tools libqt5svg5-dev \
libfdk-aac-dev libavcodec-dev libavformat-dev \
libavutil-dev libswscale-dev libswresample-dev \
libzmq3-dev libbabl-dev \
libopencv-dev libprotobuf-dev protobuf-compiler \
cargo libomp5 libomp-dev
# Install catch2 package from source
git clone https://github.com/catchorg/Catch2.git
pushd Catch2
cmake -Bbuild -H. -DBUILD_TESTING=OFF
sudo cmake --build build/ --target install
popd
wget https://launchpad.net/ubuntu/+archive/primary/+files/catch2_2.13.8-1_amd64.deb
sudo dpkg -i catch2_2.13.8-1_amd64.deb
- name: Install macOS dependencies
if: ${{ runner.os == 'macos' }}
run: |
brew install \
qt5 ffmpeg zeromq cppzmq libomp opencv protobuf babl \
python3 swig catch2 doxygen graphviz lcov
- name: Set up MSYS and install Windows dependencies
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
release: true
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-lld
mingw-w64-x86_64-make
mingw-w64-x86_64-cmake
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-qt5-base
mingw-w64-x86_64-qt5-svg
mingw-w64-x86_64-qt5-winextras
mingw-w64-x86_64-qt5-tools
mingw-w64-x86_64-libvpx
mingw-w64-x86_64-ffmpeg
mingw-w64-x86_64-zeromq
mingw-w64-x86_64-cppzmq
mingw-w64-x86_64-opencv
mingw-w64-x86_64-protobuf
mingw-w64-x86_64-babl
mingw-w64-x86_64-catch
mingw-w64-x86_64-python3
mingw-w64-x86_64-swig
- uses: actions/[email protected]
name: Import OpenShotAudio cache
id: cache-audio
with:
path: audio/build
key: audio-${{ matrix.sys.os }}-${{ matrix.compiler.cxx }}-${{ hashFiles('audio/CMakeLists.txt') }}
- uses: actions/[email protected]
name: Import Resvg cache
if: ${{ steps.use-resvg.outputs.value }}
id: cache-resvg
with:
path: resvg/target
key: resvg-${{ matrix.sys.os }}-${{ matrix.compiler.cxx }}-${{ hashFiles('resvg/Cargo.toml') }}
- name: Build OpenShotAudio (if not cached)
if: steps.cache-audio.outputs.cache-hit != 'true'
run: |
pushd audio
if [ ! -d build ]; then
mkdir build
if [ "_${{ runner.os }}" == "_macOS" ]; then
export CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
fi
if [ "_${{ runner.os }}_${{ matrix.compiler.cc }}" == "_macOS_clang" ]; then
export CMAKE_EXTRA="${CMAKE_EXTRA} \
-DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ \
-DCMAKE_MODULE_LINKER_FLAGS=-stdlib=libc++ \
-DCMAKE_SHARED_LINKER_FLAGS=-stdlib=libc++";
fi
cmake -B build -S . -G "${{ steps.generator.outputs.value }}" \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
${CMAKE_EXTRA}
fi
cmake --build build
popd
- name: Build Resvg (if enabled and not cached)
if: steps.cache-resvg && (steps.cache-resvg.outputs.cache-hit != 'true')
run: |
if [ -d "resvg/c-api" ]; then
pushd resvg/c-api
cargo build --release
popd
fi
- name: Build libopenshot
run: |
if [ "_${{ runner.os }}" == "_macOS" ]; then
export CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
-DQt5_DIR=/usr/local/opt/qt@5/lib/cmake/Qt5 \
-DENABLE_RUBY=0";
export PATH="/usr/local/opt/qt@5/bin:$PATH";
fi
if [ "_${{ runner.os }}_${{ matrix.compiler.cc }}" == "_macOS_clang" ]; then
export CMAKE_EXTRA="${CMAKE_EXTRA} \
-DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ \
-DCMAKE_MODULE_LINKER_FLAGS=-stdlib=libc++ \
-DCMAKE_SHARED_LINKER_FLAGS=-stdlib=libc++";
fi
if [ "_${{ runner.os }}" == "_Windows" ]; then
export CMAKE_EXTRA="${CMAKE_EXTRA} \
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \
-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld \
-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld"
fi
mkdir build
cmake -B build -S . -G "${{ steps.generator.outputs.value }}" \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
-DOpenShotAudio_ROOT="./audio/build" \
${CMAKE_EXTRA} \
"${{ steps.coverage.outputs.value }}" \
"${{ steps.use-resvg.outputs.value }}"
cmake --build build -- VERBOSE=1
- name: Test libopenshot
run: |
# Allow unit tests which require a display screen
export DISPLAY=:0.0
export QT_QPA_PLATFORM=offscreen
cmake --build build --target coverage -- VERBOSE=1
- name: Install libopenshot
run: |
cmake --build build --target install -- VERBOSE=1
- uses: codecov/[email protected]
if: ${{ steps.coverage.outputs.value }}
with:
file: build/coverage.info