From 2f206d1ef8facd3f18497f7e38932bafa5ff3c5b Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 13:43:38 +0000 Subject: [PATCH 1/8] Add a Travis file Not really sure how to test this beyond just spamming commits to the repo until it works, so bear with me --- .travis.yml | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..2552033e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,83 @@ +# Optimize git clone +git: + depth: 5 + +# No need for sudo +sudo: false + +# Bionic is the most recent version of Ubuntu I can get to work properly +dist: bionic + +# Enable C++ language support +language: cpp + +# Cache compiled object files with ccache +cache: ccache + +compiler: + - gcc +# - clang + +os: + - linux + +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 + - g++-mingw-w64-x86-64 + +#env: +# - BUILD_TYPE=Debug +# - BUILD_TYPE=RelWithDebInfo + +before_install: + # 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 $BUILD_TYPE + + # Point CC and CXX to MinGW-w64 + - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" WINDRES="x86_64-w64-mingw32-windres" + + # /usr/bin/gcc points to an older compiler on both Linux and macOS. +# - if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi + + # Display compilers/cmake name/version + - echo ${CC} + - echo ${CXX} + - ${CC} --version + - ${CXX} --version +# - cmake --version + +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: + - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 + +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 From c731f7077f4b8bac774dfec2acd70bb4cc25cbf7 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 13:51:38 +0000 Subject: [PATCH 2/8] Fix WINDRES in the Travis script --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2552033e..9f595f35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ before_install: - echo $BUILD_TYPE # Point CC and CXX to MinGW-w64 - - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" WINDRES="x86_64-w64-mingw32-windres" + - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" # /usr/bin/gcc points to an older compiler on both Linux and macOS. # - if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi @@ -68,7 +68,7 @@ install: - echo $JOBS script: - - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 + - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 WINDRES="x86_64-w64-mingw32-windres" after_success: # Send success notification to Discord through DISCORD_WEBHOOK_URL From 7a30be8a4a02e550eb0bd8454743f70f92cc8690 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 13:56:25 +0000 Subject: [PATCH 3/8] Cleanup, support WINDRES as an environment variable Also reenabled the Discord stuff even though it worked without those lines(???) --- .travis.yml | 28 ++++++++++++---------------- Makefile | 2 +- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f595f35..a11340ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,8 +37,8 @@ addons: before_install: # 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 + - 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 @@ -49,18 +49,14 @@ before_install: # Display build type - echo $BUILD_TYPE - # Point CC and CXX to MinGW-w64 - - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" + # Point CC and CXX to MinGW-w64 (and also WINDRES) + - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" WINDRES="x86_64-w64-mingw32-windres" - # /usr/bin/gcc points to an older compiler on both Linux and macOS. -# - if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi - - # Display compilers/cmake name/version + # Display compilers name/version - echo ${CC} - echo ${CXX} - ${CC} --version - ${CXX} --version -# - cmake --version install: # Get number of cores (or 2 by default if somehow none of these are available somehow) @@ -68,16 +64,16 @@ install: - echo $JOBS script: - - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 WINDRES="x86_64-w64-mingw32-windres" + - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 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 + - 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 + - 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 diff --git a/Makefile b/Makefile index 106daf1e..07dffe08 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -WINDRES = windres +WINDRES ?= windres BUILD_DIRECTORY = game ASSETS_DIRECTORY = assets From 03755933baa49f741b1b2b8087a19767874ae1cc Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 13:59:27 +0000 Subject: [PATCH 4/8] Added Travis badge to readme These were already in the portable and enhanced branches, but not here --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f448a379..18ecf16d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.com/Clownacy/Cave-Story-Engine-2.svg?branch=accurate)](https://travis-ci.com/Clownacy/Cave-Story-Engine-2) + ## Table of Contents This repo has multiple branches: From 29eecc26c9a4273feaeef67930f538c0ea64327d Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 14:17:54 +0000 Subject: [PATCH 5/8] Build both 32-bit and 64-bit binaries in Travis --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a11340ff..31242111 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ addons: - sourceline: 'ppa:ubuntu-toolchain-r/test' packages: - make - - g++-mingw-w64-x86-64 + - mingw-w64 #env: # - BUILD_TYPE=Debug @@ -47,10 +47,7 @@ before_install: - echo $TRAVIS_OS_NAME # Display build type - - echo $BUILD_TYPE - - # Point CC and CXX to MinGW-w64 (and also WINDRES) - - export CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" WINDRES="x86_64-w64-mingw32-windres" +# - echo $BUILD_TYPE # Display compilers name/version - echo ${CC} @@ -64,7 +61,11 @@ install: - echo $JOBS script: - - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 + # Compile 32-bit build + - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ WINDRES=i686-w64-mingw32-windres + + # Compile 64-bit build + - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ WINDRES=x86_64-w64-mingw32-windres after_success: # Send success notification to Discord through DISCORD_WEBHOOK_URL From 55090dc7cc49d03933503b983c2a5ed918df2d8a Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 14:23:02 +0000 Subject: [PATCH 6/8] Attempt to build release and debug binaries Also build static binaries, since that's what's intended for the Windows builds --- .travis.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31242111..7dfb67ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ addons: - mingw-w64 #env: -# - BUILD_TYPE=Debug -# - BUILD_TYPE=RelWithDebInfo + - MAKE_BUILD_TYPE=RELEASE=0 + - MAKE_BUILD_TYPE=RELEASE=1 before_install: # Set URL for Discord send script @@ -46,9 +46,6 @@ before_install: # Display Travis OS name - echo $TRAVIS_OS_NAME - # Display build type -# - echo $BUILD_TYPE - # Display compilers name/version - echo ${CC} - echo ${CXX} @@ -62,10 +59,10 @@ install: script: # Compile 32-bit build - - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ WINDRES=i686-w64-mingw32-windres + - 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=i686-w64-mingw32-windres # Compile 64-bit build - - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 WARNINGS_ALL=1 WINDOWS=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ WINDRES=x86_64-w64-mingw32-windres + - 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=x86_64-w64-mingw32-windres after_success: # Send success notification to Discord through DISCORD_WEBHOOK_URL From 35ac2aead88157997c756cb2839b75b454c05143 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 14:25:30 +0000 Subject: [PATCH 7/8] Er, don't break the Travis file --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7dfb67ab..0fa5dd71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ addons: - make - mingw-w64 -#env: +env: - MAKE_BUILD_TYPE=RELEASE=0 - MAKE_BUILD_TYPE=RELEASE=1 From 5fd0b5839bd2d87ac3ecc83762f753674f8a7e4d Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 23 Jan 2020 14:32:29 +0000 Subject: [PATCH 8/8] More Travis cleanup --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0fa5dd71..1fc0caf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ cache: ccache compiler: - gcc -# - clang os: - linux @@ -46,6 +45,9 @@ before_install: # Display Travis OS name - echo $TRAVIS_OS_NAME + # Display build type + - echo $MAKE_BUILD_TYPE + # Display compilers name/version - echo ${CC} - echo ${CXX}