-
-
Notifications
You must be signed in to change notification settings - Fork 132
210 lines (196 loc) · 5.63 KB
/
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
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
name: Test and package
on:
push:
pull_request:
jobs:
test-linux:
runs-on: ubuntu-20.04
strategy:
matrix:
fft:
- avfft
- fftw3
- fftw3f
- kissfft
env:
FFT_LIB: ${{ matrix.fft }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cmake libavcodec-dev libavformat-dev libavutil-dev libavresample-dev libfftw3-dev
- name: Test with ${{ env.FFT_LIB }}
run: |
mkdir build.test.$FFT_LIB
cd build.test.$FFT_LIB
cmake -DCMAKE_BUILD_TYPE=Release -DFFT_LIB=$FFT_LIB -DBUILD_TESTS=ON -DBUILD_TOOLS=OFF ..
make VERBOSE=1
make check VERBOSE=1
test-macos:
runs-on: macos-latest
strategy:
matrix:
fft:
- vdsp
- kissfft
env:
FFT_LIB: ${{ matrix.fft }}
steps:
- uses: actions/checkout@v3
- name: Test with ${{ env.FFT_LIB }}
run: |
mkdir build.test.$FFT_LIB
cd build.test.$FFT_LIB
cmake -DCMAKE_BUILD_TYPE=Release -DFFT_LIB=$FFT_LIB -DBUILD_TESTS=ON -DBUILD_TOOLS=OFF -DCMAKE_CXX_FLAGS='-stdlib=libc++' ..
make VERBOSE=1
make check VERBOSE=1
package-linux:
runs-on: ubuntu-20.04
strategy:
matrix:
arch:
- x86_64
- arm64
env:
OS: linux
ARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Install ARM64 compiler
if: env.ARCH == 'arm64'
run: |
sudo apt-get update -y && \
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Build
run: ./package/build.sh
- name: Test
if: env.ARCH == 'x86_64'
run: ./artifacts/bin/fpcalc -raw tests/data/test.mp3 | diff -u - tests/data/test.mp3.fpcalc.out
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: chromaprint-${{ env.OS }}-${{ env.ARCH }}
path: artifacts/
package-windows:
runs-on: ubuntu-20.04
strategy:
matrix:
arch:
- x86_64
env:
OS: windows
ARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update -y && \
sudo apt-get install -y mingw-w64
- name: Build
run: ./package/build.sh
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: chromaprint-${{ env.OS }}-${{ env.ARCH }}
path: artifacts/
package-macos:
runs-on: macos-latest
strategy:
matrix:
arch:
- x86_64
- arm64
env:
OS: macos
ARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Build
run: ./package/build.sh
- name: Test
run: ./artifacts/bin/fpcalc -raw tests/data/test.mp3 | diff -u - tests/data/test.mp3.fpcalc.out
if: ${{ matrix.arch == 'x86_64' }}
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: chromaprint-${{ env.OS }}-${{ env.ARCH }}
path: artifacts/
package-macos-universal:
runs-on: macos-latest
needs: package-macos
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
with:
name: chromaprint-macos-x86_64
path: single-arch/x86_64
- uses: actions/download-artifact@v2
with:
name: chromaprint-macos-arm64
path: single-arch/arm64
- name: Create universal binary
run: |
mkdir -p artifacts/bin
lipo single-arch/*/bin/fpcalc -create -output artifacts/bin/fpcalc
lipo -info artifacts/bin/fpcalc
chmod +x artifacts/bin/fpcalc
- name: Test
run: ./artifacts/bin/fpcalc -raw tests/data/test.mp3 | diff -u - tests/data/test.mp3.fpcalc.out
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: chromaprint-macos-universal
path: artifacts/
release:
runs-on: ubuntu-latest
needs:
- package-linux
- package-windows
- package-macos
- package-macos-universal
steps:
- uses: actions/checkout@v3
- name: Set version
id: version
run: |
case $GITHUB_REF in
refs/tags/v*)
VERSION=${GITHUB_REF//refs\/tags\/v/}
;;
*)
VERSION=${GITHUB_REF##*/}-${GITHUB_SHA:0:12}
;;
esac
echo "::set-output name=VERSION::$VERSION"
- uses: actions/download-artifact@v2
- name: Make source tarball
run: |
mkdir -p artifacts/
git archive --format=tar.gz --prefix=chromaprint-${{ steps.version.outputs.VERSION }}/ $GITHUB_SHA > artifacts/chromaprint-${{ steps.version.outputs.VERSION }}.tar.gz
- name: Make binary tarballs
run: |
for dir in chromaprint-{linux,macos,windows}-*
do
name=$(echo $(basename $dir) | sed "s/chromaprint-/chromaprint-fpcalc-${{ steps.version.outputs.VERSION }}-/")
mkdir -p tmp/$name
mv $dir/bin/fpcalc* tmp/$name
chmod +x tmp/$name/fpcalc*
if [ -e tmp/$name/fpcalc.exe ]
then
(cd tmp && zip -r ../artifacts/$name.zip $name)
else
tar cvzf artifacts/$name.tar.gz -C tmp $name
fi
rm -rf tmp
done
- name: List tarballs
run: |
ls -l artifacts/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}