131 lines
4 KiB
YAML
131 lines
4 KiB
YAML
# Optimize git clone
|
|
git:
|
|
depth: 5
|
|
|
|
# Bionic is the most recent version of Ubuntu I can get to work properly
|
|
dist: bionic
|
|
|
|
# Enable C++ language support
|
|
language: cpp
|
|
|
|
compiler:
|
|
- gcc
|
|
|
|
os:
|
|
- linux
|
|
- windows
|
|
|
|
addons:
|
|
apt:
|
|
sources:
|
|
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
|
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
packages:
|
|
- make
|
|
- mingw-w64
|
|
|
|
env:
|
|
- MAKE_BUILD_TYPE=RELEASE=0
|
|
- MAKE_BUILD_TYPE=RELEASE=1
|
|
|
|
before_install:
|
|
# Setup MSYS2
|
|
- |-
|
|
case $TRAVIS_OS_NAME in
|
|
windows)
|
|
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
|
|
choco uninstall -y mingw
|
|
choco upgrade --no-progress -y msys2
|
|
export msys2='cmd //C RefreshEnv.cmd '
|
|
export msys2+='& set MSYS=winsymlinks:nativestrict '
|
|
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
|
|
export mingw32="$msys2 -mingw32 -full-path -here -c "\"\$@"\" --"
|
|
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
|
|
export msys2+=" -msys2 -c "\"\$@"\" --"
|
|
$msys2 pacman --sync --noconfirm --needed make mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
|
|
taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967
|
|
;;
|
|
esac
|
|
|
|
# Set URL for Discord send script
|
|
- DISCORD_SEND_SCRIPT_URL=https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
|
|
- DISCORD_SEND_SCRIPT_FILENAME=discordSendNotification.sh
|
|
|
|
# Display available disk space
|
|
- df -h
|
|
|
|
# Display Travis OS name
|
|
- echo $TRAVIS_OS_NAME
|
|
|
|
# Display build type
|
|
- echo $MAKE_BUILD_TYPE
|
|
|
|
# Define WINDRES
|
|
- |
|
|
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
|
|
WINDRES32="windres"
|
|
WINDRES64="windres"
|
|
else
|
|
WINDRES32="i686-w64-mingw32-windres"
|
|
WINDRES64="x86_64-w64-mingw32-windres"
|
|
fi
|
|
|
|
# Display compilers name/version
|
|
- |
|
|
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
|
|
$mingw32 echo ${CC}
|
|
$mingw32 echo ${CXX}
|
|
$mingw32 ${CC} --version
|
|
$mingw32 ${CXX} --version
|
|
|
|
$mingw64 echo ${CC}
|
|
$mingw64 echo ${CXX}
|
|
$mingw64 ${CC} --version
|
|
$mingw64 ${CXX} --version
|
|
else
|
|
echo ${CC}
|
|
echo ${CXX}
|
|
${CC} --version
|
|
${CXX} --version
|
|
fi
|
|
|
|
before_cache:
|
|
- |-
|
|
case $TRAVIS_OS_NAME in
|
|
windows)
|
|
# https://unix.stackexchange.com/a/137322/107554
|
|
$msys2 pacman --sync --clean --noconfirm
|
|
;;
|
|
esac
|
|
|
|
# Cache compiled object files with ccache
|
|
cache:
|
|
# ccache
|
|
directories:
|
|
- $HOME/AppData/Local/Temp/chocolatey
|
|
- /C/tools/msys64
|
|
|
|
install:
|
|
# Get number of cores (or 2 by default if somehow none of these are available somehow)
|
|
- JOBS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)
|
|
- echo $JOBS
|
|
|
|
script:
|
|
# Compile 32-bit build
|
|
- $mingw32 make -j ${JOBS} FIX_BUGS=1 ${MAKE_BUILD_TYPE} WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 STATIC=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ WINDRES=${WINDRES32}
|
|
|
|
# Compile 64-bit build
|
|
- $mingw64 make -j ${JOBS} FIX_BUGS=1 ${MAKE_BUILD_TYPE} WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 STATIC=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ WINDRES=${WINDRES64}
|
|
|
|
after_success:
|
|
# Send success notification to Discord through DISCORD_WEBHOOK_URL
|
|
- travis_retry wget ${DISCORD_SEND_SCRIPT_URL} -O ${DISCORD_SEND_SCRIPT_FILENAME}
|
|
- chmod +x ${DISCORD_SEND_SCRIPT_FILENAME}
|
|
- ./${DISCORD_SEND_SCRIPT_FILENAME} success $DISCORD_WEBHOOK_URL
|
|
|
|
after_failure:
|
|
# Send failure notification to Discord through DISCORD_WEBHOOK_URL
|
|
- travis_retry wget ${DISCORD_SEND_SCRIPT_URL} -O ${DISCORD_SEND_SCRIPT_FILENAME}
|
|
- chmod +x ${DISCORD_SEND_SCRIPT_FILENAME}
|
|
- ./${DISCORD_SEND_SCRIPT_FILENAME} failure $DISCORD_WEBHOOK_URL
|