Zstd compression #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |