Split travis in smaller scripts

This commit is contained in:
Paul Fd 2020-03-08 22:47:26 +01:00
parent fc02cbb271
commit 68fd04fe74
16 changed files with 208 additions and 189 deletions

View file

@ -1,133 +1,143 @@
language: cpp
os: linux
dist: bionic
jobs:
- os: linux
include:
- name: "clang-tidy checks"
stage: "Tests"
name: "clang-tidy checks"
dist: bionic
addons:
apt:
packages:
- clang-tidy
- libsndfile-dev
before_install:
- true
install:
- true
script:
- scripts/run_clang_tidy.sh
after_success:
- true
- os: linux
name: "Linux amd64 tests"
install: skip
script: scripts/run_clang_tidy.sh
- name: "Linux amd64 tests"
arch: amd64
dist: bionic
env:
- BUILD_TYPE="test"
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
after_success:
- true
- os: linux
name: "Linux arm64 tests"
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install: .travis/download_cmake.sh
script: .travis/script_test.sh
- name: "Linux arm64 tests"
arch: amd64
dist: bionic
env:
- BUILD_TYPE="test"
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
after_success:
- true
- os: linux
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install: .travis/download_cmake.sh
script: .travis/script_test.sh
- name: "Windows mingw32"
stage: "Build"
name: "Windows mingw32"
env:
- CROSS_COMPILE=mingw32
- CONTAINER=cross
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-mingw32"
- os: linux
name: "Windows mingw64"
before_install: .travis/before_install_mingw.sh
install: .travis/install_mingw.sh
script: .travis/script_mingw.sh
after_success: .travis/prepare_tarball.sh
- name: "Windows mingw64"
env:
- CROSS_COMPILE=mingw64
- CONTAINER=cross
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-mingw64"
- os: linux
name: "Linux amd64 library"
before_install: .travis/before_install_mingw.sh
install: .travis/install_mingw.sh
script: .travis/script_mingw.sh
after_success: .travis/prepare_tarball.sh
- name: "Linux amd64 library"
arch: amd64
dist: bionic
env:
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- os: linux
name: "Linux arm64 library"
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install: .travis/download_cmake.sh
script: .travis/script_library.sh
after_success: .travis/prepare_tarball.sh
- name: "Linux arm64 library"
arch: arm64
dist: bionic
env:
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- os: linux
name: "Linux arm64 static LV2"
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install: .travis/download_cmake.sh
script: .travis/script_library.sh
after_success: .travis/prepare_tarball.sh
- name: "Linux arm64 static LV2"
arch: arm64
dist: bionic
env:
- BUILD_TYPE=lv2
- INSTALL_DIR="sfizz-lv2-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- INSTALL_DIR="sfizz-lv2-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- os: linux
name: "Linux amd64 static LV2"
dist: bionic
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install:
- .travis/download_cmake.sh
- .travis/download_static_libs.sh
script: .travis/script_lv2.sh
after_success: .travis/prepare_tarball.sh
- name: "Linux amd64 static LV2"
env:
- BUILD_TYPE=lv2
- INSTALL_DIR="sfizz-lv2-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- INSTALL_DIR="sfizz-lv2-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- os: osx
name: "macOS"
packages:
- libasound2-dev
- libjack-jackd2-dev
- libsndfile1-dev
install:
- .travis/download_cmake.sh
- .travis/download_static_libs.sh
script: .travis/script_lv2.sh
after_success: .travis/prepare_tarball.sh
- name: "macOS"
os: osx
osx_image: xcode10.1
env:
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
install: .travis/install_osx.sh
script: .travis/script_osx.sh
after_success: .travis/prepare_tarball.sh
- os: linux
stage: "Deploy"
- stage: "Deploy"
name: "Source packaging"
if: (tag IS present) AND (branch = master)
env:
- BUILD_TYPE=source
- INSTALL_DIR="sfizz-${TRAVIS_BRANCH}-src"
addons:
apt:
packages:
- python-pip
before_install:
- true
install:
- sudo pip install git-archive-all
script:
- git-archive-all --prefix="sfizz-${TRAVIS_BRANCH}/" -9 "${INSTALL_DIR}.tar.gz"
after_failure:
- true
after_success:
- true
install: sudo pip install git-archive-all
script: git-archive-all --prefix="sfizz-${TRAVIS_BRANCH}/" -9 "${INSTALL_DIR}.tar.gz"
- os: linux
name: "Generate documentation"
dist: bionic
- name: "Generate documentation"
if: (tag IS present) AND (branch = master)
addons:
apt:
@ -135,43 +145,17 @@ jobs:
- doxygen
- cmake
- libsndfile-dev
before_install:
- true
install:
- true
script:
- .travis/update_dox.sh
after_failure:
- true
after_success:
- true
- os: linux
name: "Discord Webhook"
dist: bionic
before_install:
- true
install:
- true
script:
- true
after_success:
- bash ${TRAVIS_BUILD_DIR}/.travis/discord_webhook.sh success
install: skip
script: .travis/update_dox.sh
before_install:
- bash ${TRAVIS_BUILD_DIR}/.travis/before_install.sh
install:
- bash ${TRAVIS_BUILD_DIR}/.travis/install.sh
script:
- bash ${TRAVIS_BUILD_DIR}/.travis/script.sh
- name: "Discord Webhook"
install: skip
script: bash ${TRAVIS_BUILD_DIR}/.travis/discord_webhook.sh success
# Signal discord on failure
after_failure:
- bash ${TRAVIS_BUILD_DIR}/.travis/discord_webhook.sh failure
after_success:
- bash ${TRAVIS_BUILD_DIR}/.travis/after_success.sh
deploy:
provider: releases
skip_cleanup: true

17
.travis/before_install_mingw.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -ex
. .travis/mingw_container.sh
buildenv bash -c "echo Hello from container" # ensure to start the container
docker cp "$container":/etc/pacman.conf pacman.conf
cat >>pacman.conf <<EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
[mingw-w64]
SigLevel = Optional TrustAll
Server = https://github.com/jpcima/arch-mingw-w64/releases/download/repo.\$arch/
EOF
docker cp pacman.conf "$container":/etc/pacman.conf
rm -f pacman.conf

13
.travis/download_cmake.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -ex
cmake_dir="cmake-3.13.0-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
cmake_arc="${cmake_dir}.tar.gz"
cmake_url="https://github.com/sfztools/cmake/releases/download/${TRAVIS_OS_NAME}/${cmake_arc}"
wget -q ${cmake_url}
tar xzf ${cmake_arc}
cd ${TRAVIS_BUILD_DIR}/${cmake_dir}
sudo cp bin/* /usr/local/bin/
sudo cp -r share/* /usr/local/share/

View file

@ -0,0 +1,6 @@
#!/bin/bash
set -ex
wget -q https://github.com/sfztools/sndfile-libraries/releases/download/${TRAVIS_OS_NAME}/sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}.tar.gz
tar xf sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}.tar.gz
sudo cp -R sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}/usr /

View file

@ -1,31 +0,0 @@
# ---------------------------------------------------------------------------- #
# Global environment included from all scripts #
# ---------------------------------------------------------------------------- #
# add /usr/local/bin to path, for custom cmake installs
if [[ ${TRAVIS_OS_NAME} == "linux" || ${TRAVIS_OS_NAME} == "osx" ]]; then
export PATH="/usr/local/bin:$PATH"
fi
# buildenv runs a command in host machine or container, depending on build
if [[ ${CROSS_COMPILE} == "mingw32" || ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv() {
setup_container archlinux
docker exec -w "$(pwd)" -i -t "$container" "$@"
}
else
buildenv() {
"$@"
}
fi
# create a container based on given image if not existing
# the container id is persisted in a file across different scripts
setup_container() {
if [ -f ${TRAVIS_BUILD_DIR}/docker-container-id ]; then
container=$(cat ${TRAVIS_BUILD_DIR}/docker-container-id)
else
container=$(docker run -d -i -t -v /home:/home "$1" /bin/bash)
echo "$container" > ${TRAVIS_BUILD_DIR}/docker-container-id
fi
}

View file

@ -1,17 +0,0 @@
#!/bin/bash
set -ex
. .travis/environment.sh
if [[ ${CROSS_COMPILE} == "mingw32" || ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv pacman -Sqy --noconfirm
buildenv pacman -Sq --noconfirm base-devel wget mingw-w64-cmake mingw-w64-gcc mingw-w64-pkg-config mingw-w64-libsndfile
buildenv i686-w64-mingw32-gcc -v && buildenv i686-w64-mingw32-g++ -v && buildenv i686-w64-mingw32-cmake --version
elif [[ ${BUILD_TYPE} == "lv2" ]]; then
wget -q https://github.com/sfztools/sndfile-libraries/releases/download/${TRAVIS_OS_NAME}/sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}.tar.gz
tar xf sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}.tar.gz
sudo cp -R sndfile-libraries-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}/usr /
elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
sudo apt-get install libasound2-dev libjack-jackd2-dev libsndfile1-dev
gcc -v && g++ -v && cmake --version && /usr/local/bin/cmake --version && $SHELL --version
fi

8
.travis/install_mingw.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -ex
. .travis/mingw_container.sh
buildenv pacman -Sqy --noconfirm
buildenv pacman -Sq --noconfirm base-devel wget mingw-w64-cmake mingw-w64-gcc mingw-w64-pkg-config mingw-w64-libsndfile
buildenv i686-w64-mingw32-gcc -v && buildenv i686-w64-mingw32-g++ -v && buildenv i686-w64-mingw32-cmake --version

8
.travis/install_osx.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -ex
sudo ln -s /usr/local /opt/local
brew update
brew upgrade cmake
brew install jack

15
.travis/mingw_container.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
buildenv() {
setup_container archlinux
docker exec -w "$(pwd)" -i -t "$container" "$@"
}
setup_container() {
if [ -f ${TRAVIS_BUILD_DIR}/docker-container-id ]; then
container=$(cat ${TRAVIS_BUILD_DIR}/docker-container-id)
else
container=$(docker run -d -i -t -v /home:/home "$1" /bin/bash)
echo "$container" > ${TRAVIS_BUILD_DIR}/docker-container-id
fi
}

View file

@ -1,7 +1,12 @@
#!/bin/bash
set -ex
. .travis/environment.sh
. .travis/mingw_container.sh
# Do not prepare a tarball without a tag
if [[ ${TRAVIS_TAG} == "" ]]; then
exit 0
fi
cd build
buildenv make DESTDIR=${PWD}/${INSTALL_DIR} install

View file

@ -1,29 +0,0 @@
#!/bin/bash
set -ex
. .travis/environment.sh
mkdir -p build/${INSTALL_DIR} && cd build
if [[ ${CROSS_COMPILE} == "mingw32" ]]; then
buildenv i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
buildenv make -j
elif [[ ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
buildenv make -j
elif [[ ${BUILD_TYPE} == "lv2" ]]; then
buildenv cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_TESTS=OFF -DSFIZZ_SHARED=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
buildenv make -j$(nproc)
elif [[ ${BUILD_TYPE} == "test" ]]; then
buildenv cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_TESTS=ON -DSFIZZ_SHARED=OFF -DSFIZZ_STATIC_LIBSNDFILE=OFF -DSFIZZ_LV2=OFF ..
buildenv make -j$(nproc) sfizz_tests
buildenv tests/sfizz_tests
elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
buildenv cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_LV2=OFF -DSFIZZ_TESTS=OFF ..
buildenv make -j$(nproc)
elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
buildenv cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_TESTS=OFF ..
buildenv make -j$(sysctl -n hw.ncpu)
# Xcode not currently supported, see https://gitlab.kitware.com/cmake/cmake/issues/18088
# xcodebuild -project sfizz.xcodeproj -alltargets -configuration Debug build
fi

6
.travis/script_library.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -ex
mkdir -p build/${INSTALL_DIR} && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release -DSFIZZ_LV2=OFF -DSFIZZ_TESTS=OFF ..
make -j$(nproc)

6
.travis/script_lv2.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -ex
mkdir -p build/${INSTALL_DIR} && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_TESTS=OFF -DSFIZZ_SHARED=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
make -j$(nproc)

13
.travis/script_mingw.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -ex
. .travis/mingw_container.sh
mkdir -p build/${INSTALL_DIR} && cd build
if [[ ${CROSS_COMPILE} == "mingw32" ]]; then
buildenv i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
buildenv make -j
elif [[ ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON ..
buildenv make -j
fi

8
.travis/script_osx.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -ex
mkdir -p build/${INSTALL_DIR} && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_TESTS=OFF ..
make -j$(sysctl -n hw.ncpu)
# Xcode not currently supported, see https://gitlab.kitware.com/cmake/cmake/issues/18088
# xcodebuild -project sfizz.xcodeproj -alltargets -configuration Debug build

7
.travis/script_test.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -ex
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_TESTS=ON -DSFIZZ_SHARED=OFF -DSFIZZ_STATIC_LIBSNDFILE=OFF -DSFIZZ_LV2=OFF ..
make -j$(nproc) sfizz_tests
tests/sfizz_tests