From f1871ba69dc6157a0f22814ad6639217a3b789e8 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 8 Jun 2020 00:00:12 -0400 Subject: [PATCH] Deployer v2 for Travis General build: * OSX: Build all brews ourselves * OSX: Enable caching for brews * OSX: Enable CCACHE * New Windows buildbot Deployments: * Ordered deploying buildbots first * Overhauled DPL variables * Specify asset paths in one variable, delimited by ; * Enabled Github Releases deployment * Dummied out Debian package builds * Added environment targeting for core2 CPU --- .travis.yml | 598 ++++++------------ debian_template.sh | 2 +- deployer/travis/deployer.sh | 157 ----- deployer/travis/deployer_build.sh | 190 ------ deployer/travis/deployer_ftp.sh | 137 ---- .../defaults.sh | 53 +- travis/deployer.sh | 87 +++ travis/deployer_build.sh | 156 +++++ {deployer/travis => travis}/deployer_dput.sh | 1 + travis/deployer_ftp.sh | 128 ++++ travis/osx_brew_upgrade.sh | 37 ++ travis/windows_install.sh | 34 + 12 files changed, 642 insertions(+), 938 deletions(-) delete mode 100644 deployer/travis/deployer.sh delete mode 100644 deployer/travis/deployer_build.sh delete mode 100644 deployer/travis/deployer_ftp.sh rename deployer/travis/deployer_defaults.sh => travis/defaults.sh (56%) mode change 100644 => 100755 create mode 100755 travis/deployer.sh create mode 100755 travis/deployer_build.sh rename {deployer/travis => travis}/deployer_dput.sh (98%) create mode 100755 travis/deployer_ftp.sh create mode 100755 travis/osx_brew_upgrade.sh create mode 100755 travis/windows_install.sh diff --git a/.travis.yml b/.travis.yml index 9d91b77df..1aef5b558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # Travis-CI Config # # You may use the Deployer to upload packages and builds to external servers. -# See deployer/travis/deployer_defaults.sh for environment variables to configure. +# See travis/defaults.sh for environment variables to configure. language: c sudo: required @@ -10,10 +10,133 @@ dist: trusty matrix: include: ################################ -# Test Buildbots -# Deployer does not operate on these. See Deployer Buildbots, below. -# These bots are disabled when a deployment is triggered by 'deployer' branch name AND DPL_TERMINATE_TESTS=1. -# These bots remain enabled when a deployment is triggered by release tag. +# Deploying Buildbots +################################ + - os: osx + osx_image: xcode11.5 + env: + - DPL_UPLOAD_INSTALLER=1 + - CFLAGS="-march=core2 -mtune=haswell" + - CXXFLAGS="-march=core2 -mtune=haswell" + cache: + directories: + - $HOME/Library/Caches/Homebrew + - /usr/local/Homebrew + - $HOME/homebrew_cache + - $HOME/.ccache + - $HOME/srb2_cache + before_install: + # Initialize Deployer defaults + - source ./travis/defaults.sh + # Unpack homebrew. + # Unlink current cmake so our installed cmake can overwrite. + - if [[ -f "$HOME/homebrew_cache/homebrew-cache-Cellar.tar.gz" ]]; then + brew unlink cmake; + tar xzf $HOME/homebrew_cache/homebrew-cache-Cellar.tar.gz --directory=/usr/local/Cellar; + tar xzf $HOME/homebrew_cache/homebrew-cache-opt.tar.gz --directory=/usr/local/opt; + fi; + before_cache: + - brew cleanup + # Credit https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/9 + # Cache only .git files under "/usr/local/Homebrew" so "brew update" does not take 5min every build + - find /usr/local/Homebrew \! -regex ".+\.git.+" -delete + - tar czf $HOME/homebrew_cache/homebrew-cache-Cellar.tar.gz --directory=/usr/local/Cellar p7zip cmake ccache sdl2 sdl2_mixer game-music-emu libopenmpt + - tar czf $HOME/homebrew_cache/homebrew-cache-opt.tar.gz --directory=/usr/local/opt p7zip cmake ccache sdl2 sdl2_mixer game-music-emu libopenmpt + deploy: + - provider: releases + skip_cleanup: true + api_key: $DPL_GITHUB_TOKEN + file_glob: true + file: $TRAVIS_BUILD_DIR/build/deploy/**/* + draft: true + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + - provider: script + skip_cleanup: true + # relative to {repo_root}/build + script: bash ../travis/deployer_ftp.sh + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + #Default: macOS 10.13 and Xcode 9.4.1 + - os: windows + compiler: gcc + env: + - DPL_UPLOAD_ASSETS=1 + - DPL_UPLOAD_INSTALLER=1 + - CFLAGS="-march=nocona -mtune=haswell" + - CXXFLAGS="-march=nocona -mtune=haswell" + - WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow -Wno-error=format-truncation -Wno-error=stringop-overflow -Wno-error=stringop-truncation" + - GCC91=1 + - PROGRAM_FILENAME=srb2win + cache: + directories: + - $HOME/AppData/Local/Temp/chocolatey + - /c/tools/msys64 + - $HOME/.ccache + - $HOME/srb2_cache + before_cache: + # https://unix.stackexchange.com/a/137322/107554 + - $msys2 pacman --sync --clean --noconfirm + deploy: + - provider: releases + skip_cleanup: true + api_key: $DPL_GITHUB_TOKEN + file_glob: true + file: $TRAVIS_BUILD_DIR/build/deploy/**/* + draft: true + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + - provider: script + skip_cleanup: true + # relative to {repo_root}/build + script: bash ../travis/deployer_ftp.sh + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + #Windows Server version 1809, mingw-w64-i686-gcc-10.1.0-3 + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - libopenmpt-dev + - p7zip-full + - gcc-8 + compiler: gcc-8 + env: + - CFLAGS="-march=nocona -mtune=haswell" + - CXXFLAGS="-march=nocona -mtune=haswell" + - WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow -Wno-error=format-truncation" + - GCC81=1 + deploy: + - provider: releases + skip_cleanup: true + api_key: $DPL_GITHUB_TOKEN + file_glob: true + file: $TRAVIS_BUILD_DIR/build/deploy/**/* + draft: true + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + - provider: script + skip_cleanup: true + # relative to {repo_root}/build + script: bash ../travis/deployer_ftp.sh + on: + all_branches: true + condition: '"$__DPL_ENABLED" == "1"' + #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 +################################ +# Non-Deploying Buildbots ################################ - os: linux addons: @@ -30,7 +153,6 @@ matrix: - gcc-4.4 compiler: gcc-4.4 env: GCC44=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.4 (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7 - os: linux addons: @@ -47,7 +169,6 @@ matrix: - gcc-4.6 compiler: gcc-4.6 env: GCC46=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.6 (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4 - os: linux addons: @@ -64,12 +185,10 @@ matrix: - gcc-4.7 compiler: gcc-4.7 env: GCC47=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.7 - os: linux compiler: gcc env: GCC48=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 - os: linux addons: @@ -87,7 +206,6 @@ matrix: - gcc-4.8 compiler: gcc-4.8 env: GCC48=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: @@ -105,29 +223,9 @@ matrix: - gcc-7 compiler: gcc-7 env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-8 - compiler: gcc-8 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow -Wno-error=format-truncation" GCC81=1 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ - #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - os: linux compiler: clang - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #clang version 3.5.0 (tags/RELEASE_350/final) - os: linux addons: @@ -144,7 +242,6 @@ matrix: - p7zip-full - clang-3.5 compiler: clang-3.5 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) - os: linux addons: @@ -162,7 +259,6 @@ matrix: - p7zip-full - clang-3.6 compiler: clang-3.6 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) - os: linux addons: @@ -180,7 +276,6 @@ matrix: - p7zip-full - clang-3.7 compiler: clang-3.7 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) - os: linux addons: @@ -198,7 +293,6 @@ matrix: - p7zip-full - clang-3.8 compiler: clang-3.8 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #clang version 3.8.1-svn271127-1~exp1 (branches/release_38) - os: linux addons: @@ -216,7 +310,6 @@ matrix: - p7zip-full - clang-3.9 compiler: clang-3.9 - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #clang version 3.9.X # - os: linux # addons: @@ -234,7 +327,6 @@ matrix: # - p7zip-full # - clang-4.0 # compiler: clang-4.0 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #clang version 4.0.X # - os: linux # addons: @@ -252,36 +344,28 @@ matrix: # - p7zip-full # - clang-5.0 # compiler: clang-5.0 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #clang version 5.0.X # - os: osx # osx_image: beta-xcode6.1 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) # - os: osx # osx_image: beta-xcode6.2 # compiler: gcc -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) ## - os: osx ## osx_image: beta-xcode6.3 -## if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ ## #I think xcode.6.3 VM is broken, it does not boot # - os: osx # osx_image: xcode6.4 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) # - os: osx # osx_image: xcode7 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 7.0.0 (clang-700.0.72) # - os: osx # osx_image: xcode7.1 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 7.0.0 (clang-700.1.76) # - os: osx # osx_image: xcode7.2 -# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ # #Apple LLVM version 7.0.2 (clang-700.1.81) # - os: osx # osx_image: xcode7.3 @@ -289,308 +373,8 @@ matrix: # - os: osx # osx_image: xcode7.3 # #Apple LLVM version 7.3.0 (clang-703.0.31) - - os: osx - if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ - #Default: macOS 10.13 and Xcode 9.4.1 - - -################################ -# Deployer Buildbots - OSX -################################ - - os: osx - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=osx - - _DPL_FTP_TARGET=1 - - _DPL_PACKAGE_BINARY=1 - #Apple LLVM version 7.3.0 (clang-703.0.31) - - -################################ -# Deployer Buildbots - Linux assets -# Set DPL_TERMINATE_ASSETS to disable all of these -# List Ubuntu LTS next, newest to oldest -# Then list non-LTS, newest to oldest -################################ - - os: linux - addons: - apt: - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_ASSETS) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=bionic-asset - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - _DPL_PACKAGE_MAIN=0 - - _DPL_PACKAGE_ASSET=1 - - PACKAGE_DISTRO=bionic - #- PACKAGE_SUBVERSION=~18.04bionic - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - ################################ - # The below asset bots produce packages that occupy too much space. - # It would be nice if the asset files were not included in the source package itself, - # so these can deploy to each Ubuntu target without manual intervention. - # - # Currently, to get around Launchpad's space limitation, - # copy the packages from *one* bot and the space usage is not increased. - ################################ - # - os: linux - # addons: - # apt: - # packages: - # - libsdl2-mixer-dev - # - libpng-dev - # - libgl1-mesa-dev - # - libgme-dev - # - p7zip-full - # - gcc-4.8 - # compiler: gcc-4.8 - # dist: trusty - # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - # AND env(DPL_TERMINATE_ASSETS) != "1" - # env: - # - _DPL_JOB_ENABLED=1 - # - _DPL_JOB_NAME=trusty-asset - # - _DPL_DPUT_TARGET=1 - # - _DPL_PACKAGE_SOURCE=1 - # - _DPL_PACKAGE_MAIN=0 - # - _DPL_PACKAGE_ASSET=1 - # - PACKAGE_DISTRO=trusty - # #- PACKAGE_SUBVERSION=~14.04trusty - # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - # - os: linux - # addons: - # apt: - # packages: - # - libsdl2-mixer-dev - # - libpng-dev - # - libgl1-mesa-dev - # - libgme-dev - # - p7zip-full - # - gcc-4.8 - # compiler: gcc-4.8 - # dist: xenial - # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - # AND env(DPL_TERMINATE_ASSETS) != "1" - # env: - # - _DPL_JOB_ENABLED=1 - # - _DPL_JOB_NAME=disco-asset - # - _DPL_DPUT_TARGET=1 - # - _DPL_PACKAGE_SOURCE=1 - # - _DPL_PACKAGE_MAIN=0 - # - _DPL_PACKAGE_ASSET=1 - # - PACKAGE_DISTRO=disco - # #- PACKAGE_SUBVERSION=~19.04disco - # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - # - os: linux - # addons: - # apt: - # packages: - # - libsdl2-mixer-dev - # - libpng-dev - # - libgl1-mesa-dev - # - libgme-dev - # - p7zip-full - # - gcc-4.8 - # compiler: gcc-4.8 - # dist: xenial - # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - # AND env(DPL_TERMINATE_ASSETS) != "1" - # env: - # - _DPL_JOB_ENABLED=1 - # - _DPL_JOB_NAME=cosmic-asset - # - _DPL_DPUT_TARGET=1 - # - _DPL_PACKAGE_SOURCE=1 - # - _DPL_PACKAGE_MAIN=0 - # - _DPL_PACKAGE_ASSET=1 - # - PACKAGE_DISTRO=cosmic - # #- PACKAGE_SUBVERSION=~18.10cosmic - # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - # - os: linux - # addons: - # apt: - # packages: - # - libsdl2-mixer-dev - # - libpng-dev - # - libgl1-mesa-dev - # - libgme-dev - # - p7zip-full - # - gcc-4.8 - # compiler: gcc-4.8 - # dist: xenial - # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - # AND env(DPL_TERMINATE_ASSETS) != "1" - # env: - # - _DPL_JOB_ENABLED=1 - # - _DPL_JOB_NAME=xenial-asset - # - _DPL_DPUT_TARGET=1 - # - _DPL_PACKAGE_SOURCE=1 - # - _DPL_PACKAGE_MAIN=0 - # - _DPL_PACKAGE_ASSET=1 - # - PACKAGE_DISTRO=xenial - # #- PACKAGE_SUBVERSION=~16.04xenial - # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - -################################ -# Deployer Buildbots - Linux binaries -# List Ubuntu LTS, newest to oldest -# Then list non-LTS, newest to oldest -################################ - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=eoan - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=eoan - - PACKAGE_SUBVERSION=~19.10eoan - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=disco - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=disco - - PACKAGE_SUBVERSION=~19.04disco - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=bionic - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=bionic - - PACKAGE_SUBVERSION=~18.04bionic - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=xenial - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=xenial - - PACKAGE_SUBVERSION=~16.04xenial - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:stjr/srb2' - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - libopenmpt-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: trusty - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=trusty - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=trusty - - PACKAGE_SUBVERSION=~14.04trusty - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 +# - os: osx +# #Default: macOS 10.13 and Xcode 9.4.1 allow_failures: - compiler: clang-3.5 - compiler: clang-3.6 @@ -620,56 +404,34 @@ addons: - zlib1g-dev - libopenmpt-dev - p7zip-full - homebrew: - taps: - - mazmazz/srb2 - packages: - - sdl2_mixer - - game-music-emu - - p7zip - - libopenmpt - - cmake - update: true - before_install: # Initialize Deployer defaults - - . ./deployer/travis/deployer_defaults.sh - - # Initialize Deployer; check if Deployer is enabled - # This needs to be run in the current shell so that $__DPL_ACTIVE is set for this session - - . ./deployer/travis/deployer.sh - - # Also check if we should now terminate -- see `deployer.sh` for conditions. - # This should never happen on non-release buildbots when Deployer is not triggered. - - if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]]; then - if [[ "$__DPL_ACTIVE" != "1" ]]; then - echo "Exiting early because this job is not deploying."; - exit; - fi; - fi - - # If we're triggered by release tag, force ASSET_FILES_OPTIONAL_GET=1 - - if [[ "$__DPL_TAG_ELIGIBLE" = "1" ]]; then - ASSET_FILES_OPTIONAL_GET=1; - fi; + - source ./travis/defaults.sh install: - # Install OS X library dependencies via Homebrew - # Do this differently for release buildbots: - # * `brew install --build-bottle` builds libraries for x86_64's lowest common denominator CPU, core2 + # OS X: Install library dependencies via Homebrew + # * `brew install --build-from-source` builds libraries for our CFLAGS, which target core2 CPU # * `sdl2_mixer` requires options from the formula tap https://github.com/mazmazz/homebrew-srb2 - # * `brew postinstall` runs post-install scripts after building a bottle - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$__DPL_ACTIVE" == "1" ]]; then - brew install --build-bottle sdl2 game-music-emu; - brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; - brew postinstall sdl2 game-music-emu mazmazz/srb2/sdl2_mixer; - fi; - fi - mkdir -p $HOME/srb2_cache + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + BREW_UPGRADE="bash ./travis/osx_brew_upgrade.sh"; + brew tap mazmazz/srb2; + brew update; + $BREW_UPGRADE p7zip; brew link p7zip; + $BREW_UPGRADE cmake; brew link cmake; + $BREW_UPGRADE ccache; brew link ccache; + $BREW_UPGRADE --build-from-source sdl2; brew link sdl2; + $BREW_UPGRADE --build-from-source mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; brew link mazmazz/srb2/sdl2_mixer; + $BREW_UPGRADE --build-from-source mazmazz/srb2/game-music-emu; brew link mazmazz/srb2/game-music-emu; + $BREW_UPGRADE --build-from-source libopenmpt; brew link libopenmpt; + fi + # Windows: Install MSYS2 and build toolchain + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + source ./travis/windows_install.sh; + fi before_script: @@ -689,22 +451,16 @@ before_script: # Get asset files (required for MD5) # See `deployer_defaults.sh` for asset download path - - if [[ "$ASSET_ARCHIVE_PATH" != "" ]]; then - if [ -f "$(basename $ASSET_ARCHIVE_PATH)" ]; then - echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))"; - fi; - wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH"; - 7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$__ASSET_DIRECTORY" -aos; - fi; - - # Get optional files too - - if [[ "$__DPL_ACTIVE" == "1" ]] && [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then - if [ -f "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" ]; then - echo "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_OPTIONAL_PATH))"; - fi; - wget --verbose --server-response -N "$ASSET_ARCHIVE_OPTIONAL_PATH"; - 7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$__ASSET_DIRECTORY" -aos; - fi; + - IFS=';' read -r -a paths <<< "$ASSET_ARCHIVE_PATHS" + - > + for path in "${paths[@]}"; + do + if [ -f "$(basename $path)" ]; then + echo "$(basename $path) cache date -- $($STATCMD $(basename $path))"; + fi; + wget --verbose --server-response -N "$path"; + 7z x "$(basename $path)" -o"$__ASSET_DIRECTORY" -aos; + done # Go back to root repo folder - cd "$OLDPWD" @@ -718,13 +474,28 @@ before_script: - mkdir build - cd build - mkdir package - - export CFLAGS="-Wall -W -Werror $WFLAGS" + - export CFLAGS="-Wall -W -Werror $WFLAGS $CFLAGS" - export CCACHE_COMPRESS=true - # If OS X, set -march=core2 to build compatible binaries with old Macs + # enable CCACHE on OSX + # also fix LIBRARY_PATH to include SDL2 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - export CFLAGS="${CFLAGS} -march=core2"; + export PATH="/usr/local/opt/ccache/bin:$PATH"; + export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"; + __CMAKE_CCACHE="-DSRB2_USE_CCACHE=ON"; fi; - - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + __CMAKE_GENERATOR="MinGW Makefiles"; + __CMAKE_COMPILER="-DCMAKE_C_COMPILER=gcc -DCMAKE_MAKE_PROGRAM=mingw32-make"; + __CMAKE_CCACHE="-DSRB2_USE_CCACHE=ON"; + __CMAKE_LIBRARIES="-DSRB2_CONFIG_USE_INTERNAL_LIBRARIES=1"; + __CMAKE_ASM="-DSRB2_CONFIG_USEASM=1"; + __MAKE="mingw32-make"; + else + __CMAKE_GENERATOR="Unix Makefiles"; + __MAKE="make"; + fi; + - cmake .. -G "$__CMAKE_GENERATOR" ${__CMAKE_COMPILER} ${__CMAKE_CCACHE} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${__CMAKE_LIBRARIES} ${__CMAKE_ASM} + -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package -DSRB2_ASSET_HASHED="${SRB2_ASSET_HASHED}" -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}" -DSRB2_ASSET_DIRECTORY="${SRB2_ASSET_DIRECTORY}" -DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}" @@ -732,15 +503,8 @@ before_script: -DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}" script: - # Build our Makefile from Cmake! - - if [[ "$__DPL_ACTIVE" == "1" ]]; then - . ../deployer/travis/deployer_build.sh; - else - make -k; - fi; + - ${__MAKE} -k after_success: - # Run the upload scripts - # These do nothing if Deployer is not triggered - - . ../deployer/travis/deployer_ftp.sh - - . ../deployer/travis/deployer_dput.sh + # Generate packages and installers + - source ${TRAVIS_BUILD_DIR}/travis/deployer.sh diff --git a/debian_template.sh b/debian_template.sh index c1af3c19f..879dc6470 100644 --- a/debian_template.sh +++ b/debian_template.sh @@ -84,7 +84,7 @@ evaldirectory () { # Initialize package parameter defaults # if [[ "$__DEBIAN_PARAMETERS_INITIALIZED" != "1" ]]; then - . ${DIR}/deployer/travis/deployer_defaults.sh; + . ${DIR}/travis/defaults.sh; fi; # Clean up after ourselves; we only expect to run this script once diff --git a/deployer/travis/deployer.sh b/deployer/travis/deployer.sh deleted file mode 100644 index c88155d21..000000000 --- a/deployer/travis/deployer.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash - -# Deployer for Travis-CI -# Initialization -# -# Performs validity checks to ensure that Deployer is allowed to run -# e.g., is an FTP hostname specified? Are we whitelisted by OSNAMES and BRANCHES? -# -# Set these environment variables in your Travis-CI settings, where they are stored securely. -# See other shell scripts for more options. -# -# DPL_ENABLED = 1 (leave blank to disable) -# DPL_TAG_ENABLED = 1 (run Deployer on all tags) -# DPL_JOB_ENABLE_ALL = 1 (run Deployer on all jobs; leave blank to act on specific jobs, see below) -# DPL_JOBNAMES = name1,name2 (whitelist of job names to allow uploading; leave blank to upload from all jobs) -# DPL_OSNAMES = osx (whitelist of OS names to allow uploading; leave blank to upload from all OSes) -# DPL_BRANCHES = master,branch1,branch2 (whitelist of branches to upload; leave blank to upload all branches) -# -# To enable Deployer on specific jobs, set _DPL_JOB_ENABLED=1 for that job. Example: -# - matrix: -# - os: osx -# env: -# - _DPL_JOB_ENABLED=1 -# -# DO NOT set __DPL_ACTIVE, because that would bypass these validity checks. - -# Validate Deployer state -if [[ "$DPL_ENABLED" == "1" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then - # Test for base eligibility: - # Are we in a deployer branch? Or - # Are we in a release tag AND DPL_TAG_ENABLED=1? - if [[ $TRAVIS_BRANCH == *"deployer"* ]]; then - __DPL_BASE_ELIGIBLE=1; - __DPL_TERMINATE_EARLY_ELIGIBLE=1; - fi; - - if [[ "$TRAVIS_TAG" != "" ]] && [[ "$DPL_TAG_ENABLED" == "1" ]]; then - __DPL_BASE_ELIGIBLE=1; - __DPL_TAG_ELIGIBLE=1; - __DPL_TERMINATE_EARLY_ELIGIBLE=1; - fi; - - # Logging message for trigger word - if [[ "$__DPL_TAG_ELIGIBLE" != "1" ]] && [[ "$DPL_TRIGGER" != "" ]]; then - echo "Testing for trigger $DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; - echo "[${DPL_TRIGGER}]"; - echo "[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"; - echo "[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"; - fi; - - # - # Search for the trigger word - # Force enable if release tags are eligible - # - if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_TRIGGER" == "" ]] \ - || [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER]"* ]] \ - || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"* ]] \ - || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"* ]]; then - # - # Whitelist by branch name - # Force enable if release tags are eligible - # - if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then - # Set this so we only early-terminate builds when we are specifically deploying - # Trigger string and branch are encompassing conditions; the rest are job-specific - # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, - # because we're filtering non-deployer jobs. - # - # __DPL_TRY_TERMINATE_EARLY is invalidated in .travis.yml if __DPL_ACTIVE=1 - if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then - __DPL_TRY_TERMINATE_EARLY=1; - fi; - - # - # Is the job enabled for deployment? - # - if [[ "$DPL_JOB_ENABLE_ALL" == "1" ]] || [[ "$_DPL_JOB_ENABLED" == "1" ]]; then - # - # Whitelist by job names - # - if [[ "$DPL_JOBNAMES" == "" ]] || [[ "$_DPL_JOB_NAME" == "" ]] || [[ $DPL_JOBNAMES == *"$_DPL_JOB_NAME"* ]]; then - # - # Whitelist by OS names - # - if [[ "$DPL_OSNAMES" == "" ]] || [[ $DPL_OSNAMES == *"$TRAVIS_OS_NAME"* ]]; then - # Base Deployer is eligible for becoming active - - # Are we building for Linux? - if [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then - if [[ "$_DPL_PACKAGE_MAIN" == "1" ]] || [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - __DPL_DEBIAN_ACTIVE=1; - fi; - fi; - fi; - - # Now check for deployment targets - if [[ "$_DPL_FTP_TARGET" == "1" ]] && [[ "$DPL_FTP_HOSTNAME" != "" ]]; then - if [[ "$TRAVIS_OS_HOST" == "linux" ]] && [[ "$DPL_FTP_PROTOCOL" == "ftp" ]]; then - echo "Non-secure FTP will not work on Linux Travis-CI jobs!"; - echo "Try SFTP or another target. Details:"; - echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; - else - if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] || [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_BINARY" == "1" ]]; then - echo "Deployer FTP target is enabled"; - __DPL_FTP_ACTIVE=1; - else - echo "Deployer FTP target cannot be enabled: You must specify _DPL_PACKAGE_BINARY=1,"; - echo "and/or _DPL_BINARY=1 in your job's environment variables."; - fi; - fi; - fi; - - if [[ "$_DPL_DPUT_TARGET" == "1" ]] && [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] \ - && [[ "$DPL_DPUT_INCOMING" != "" ]]; then - if [[ "$DPL_DPUT_METHOD" == "ftp" ]]; then - echo "DPUT will not work with non-secure FTP on Linux Travis-CI jobs!"; - echo "Try SFTP or another method for DPUT. Details:"; - echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; - else - echo "Deployer DPUT target is enabled"; - __DPL_DPUT_ACTIVE=1; - fi; - fi; - - # If any deployment targets are active, then so is the Deployer at large - if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then - __DPL_ACTIVE=1; - fi; - fi; - fi; - fi; - fi; - else - if [[ "$DPL_TRIGGER" != "" ]]; then - echo "Testing for global trigger [$DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; - fi; - if [[ "$DPL_TRIGGER" != "" ]] && [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER"* ]]; then - if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then - # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, - # because we're filtering non-deployer jobs. - if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then - # Assume that some job received the trigger, so mark this for early termination - __DPL_TRY_TERMINATE_EARLY=1; - fi; - fi; - fi; - fi; -fi; - -if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then - echo "Deployer is active in another job"; -fi; - -if [[ "$__DPL_TRY_TERMINATE_EARLY" != "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then - echo "Deployer is not active"; -fi; diff --git a/deployer/travis/deployer_build.sh b/deployer/travis/deployer_build.sh deleted file mode 100644 index 3817f025d..000000000 --- a/deployer/travis/deployer_build.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/bash - -# Deployer for Travis-CI -# Build Script -# -# Builds the required targets depending on which sub-modules are enabled - -if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then - if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then - echo "Building Debian package(s)" - - sudo apt-get install devscripts debhelper fakeroot secure-delete expect; - - # Build source packages first, since they zip up the entire source folder, - # binaries and all - if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then - . ../debian_template.sh main; - OLDPWD=$PWD; # [repo]/build - cd ..; # repo root - - if [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then - echo "Building main source Debian package"; - expect <(cat < key.asc; - echo "$DPL_PGP_KEY_PASSPHRASE" > phrase.txt; - gpg --import key.asc; - - if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then - echo "Signing main package(s)"; - - PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - - PACKAGEFILENAMES=( - $PACKAGEFILENAME - $PACKAGEDBGFILENAME - #$PACKAGENIGHTLYFILENAME - #$PACKAGENIGHTLYDBGFILENAME - #$PACKAGEPATCHFILENAME - #$PACKAGEPATCHDBGFILENAME - #$PACKAGEPATCHNIGHTLYFILENAME - #$PACKAGEPATCHNIGHTLYDBGFILENAME - ); - - # Main packages are in parent of root repo folder - OLDPWD=$PWD; # [repo]/build - cd ../..; # parent of repo root - - for n in ${PACKAGEFILENAMES}; do - for f in ./$n*.changes; do - debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; - done; - done; - - cd $OLDPWD; - fi; - - if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then - echo "Signing asset package(s)"; - - PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - - PACKAGEFILENAMES=( - $PACKAGEFILENAME - #$PACKAGENIGHTLYFILENAME - #$PACKAGEPATCHFILENAME - #$PACKAGEPATCHNIGHTLYFILENAME - ) - - # Asset packages are in root repo folder - OLDPWD=$PWD; # [repo]/build - cd ..; # repo root - - for n in ${PACKAGEFILENAMES}; do - for f in ./$n*.changes; do - debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; - done; - done; - - cd $OLDPWD; - fi; - - # Delete the keys :eyes: - srm key.asc; - srm phrase.txt; - fi; - fi; - - # all other OSes - if [[ "$TRAVIS_OS_NAME" != "linux" ]]; then - # - # Check for binary building - # - if [[ "$_DPL_BINARY" == "1" ]]; then - echo "Building a Binary"; - make -k; - fi; - - # - # Check for package building - # - if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then - echo "Building a Package"; - - # Make an OSX package; superuser is required for library bundling - # - # HACK: OSX packaging can't write libraries to .app package unless we're superuser - # because the original library files don't have WRITE permission - # Bug may be sidestepped by using CHMOD_BUNDLE_ITEMS=TRUE - # But I don't know where this is set. Not `cmake -D...` because this var is ignored. - # https://cmake.org/Bug/view.php?id=9284 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - sudo make -k package; - else - # Some day, when Windows is supported, we'll just make a standard package - make -k package; - fi; - fi; - fi; -fi; diff --git a/deployer/travis/deployer_ftp.sh b/deployer/travis/deployer_ftp.sh deleted file mode 100644 index 1f6bd08b5..000000000 --- a/deployer/travis/deployer_ftp.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -# Deployer for Travis-CI -# FTP Uploader -# -# Package files are uploaded to, e.g., ftp://username:password@example.com:21/path/to/upload/STJr/SRB2/master/460873812-151.1 -# With file `commit.txt` and folder(s) `bin` and `package` -# -# Set these environment variables in your Travis-CI settings, where they are stored securely. -# See other shell scripts for more options. -# -# DPL_FTP_PROTOCOL = ftp (ftp or sftp or ftps or however your FTP URI begins) -# DPL_FTP_USER = username -# DPL_FTP_PASS = password -# DPL_FTP_HOSTNAME = example.com -# DPL_FTP_PORT = 21 -# DPL_FTP_PATH = path/to/upload (do not add trailing slash) - -if [[ "$__DPL_FTP_ACTIVE" == "1" ]]; then - if [[ "$TRAVIS_JOB_NAME" != "" ]]; then - JOBNAME=$TRAVIS_JOB_NAME; - else - if [[ "$_DPL_JOB_NAME" != "" ]]; then - JOBNAME=$_DPL_JOB_NAME; - else - JOBNAME=$TRAVIS_OS_NAME; - fi; - fi; - - # Generate commit.txt file - echo "Travis-CI Build $TRAVIS_OS_NAME - $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH - $TRAVIS_JOB_NUMBER - $JOBNAME" > "commit.txt"; - echo "Job ID $TRAVIS_JOB_ID" >> "commit.txt"; - echo "" >> "commit.txt"; - echo "Commit $TRAVIS_COMMIT" >> "commit.txt"; - echo "$TRAVIS_COMMIT_MESSAGE" >> "commit.txt"; - echo "" >> "commit.txt"; - - # Initialize FTP parameters - if [[ "$DPL_FTP_PORT" == "" ]]; then - DPL_FTP_PORT=21; - fi; - if [[ "$DPL_FTP_PROTOCOL" == "" ]]; then - DPL_FTP_PROTOCOL=ftp; - fi; - __DPL_FTP_LOCATION=$DPL_FTP_PROTOCOL://$DPL_FTP_HOSTNAME:$DPL_FTP_PORT/$DPL_FTP_PATH/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_JOB_ID-$TRAVIS_JOB_NUMBER-$JOBNAME; - - # Upload to FTP! - echo "Uploading to FTP..."; - curl --ftp-create-dirs -T "commit.txt" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/commit.txt"; - - if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then - if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then - PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - - PACKAGEFILENAMES=( - $PACKAGEFILENAME - $PACKAGEDBGFILENAME - #$PACKAGENIGHTLYFILENAME - #$PACKAGENIGHTLYDBGFILENAME - #$PACKAGEPATCHFILENAME - #$PACKAGEPATCHDBGFILENAME - #$PACKAGEPATCHNIGHTLYFILENAME - #$PACKAGEPATCHNIGHTLYDBGFILENAME - ); - - # Main packages are in parent of root repo folder - OLDPWD=$PWD; # [repo]/build - cd ../..; - - for n in ${PACKAGEFILENAMES}; do - for f in ./$n*; do - # Binary builds also generate source builds, so exclude the source - # builds if desired - if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then - if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then - continue; - fi; - fi; - curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/main/$f"; - done; - done; - - # Go back to [repo]/build folder - cd $OLDPWD; - fi; - - if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then - PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; - - PACKAGEFILENAMES=( - $PACKAGEFILENAME - #$PACKAGENIGHTLYFILENAME - #$PACKAGEPATCHFILENAME - #$PACKAGEPATCHNIGHTLYFILENAME - ) - - # Asset packages are in root repo folder - OLDPWD=$PWD; # [repo]/build - cd ..; - - for n in ${PACKAGEFILENAMES}; do - for f in ./$n*; do - # Binary builds also generate source builds, so exclude the source - # builds if desired - if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then - if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then - continue; - fi; - fi; - curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/asset/$f"; - done; - done; - - # Go back to [repo]/build folder - cd $OLDPWD; - fi; - else - if [[ "$_DPL_BINARY" == "1" ]]; then - find bin -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; - fi; - - if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then - sudo rm -r package/_CPack_Packages - find package -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; - fi; - fi; -fi diff --git a/deployer/travis/deployer_defaults.sh b/travis/defaults.sh old mode 100644 new mode 100755 similarity index 56% rename from deployer/travis/deployer_defaults.sh rename to travis/defaults.sh index fe7ba6993..59c0704d6 --- a/deployer/travis/deployer_defaults.sh +++ b/travis/defaults.sh @@ -7,49 +7,33 @@ # See the "Cross-platform deployment" page on SRB2 Wiki for documentation. # Core Parameters -: ${DPL_ENABLED} # Enable Deployer behavior; must be set for any deployment activity -: ${DPL_TAG_ENABLED} # Trigger Deployer for all tag releases -: ${DPL_JOB_ENABLE_ALL} # Enable all jobs for deployment -: ${DPL_TERMINATE_TESTS} # Terminate all build test jobs (used in .travis.yml) -: ${DPL_TRIGGER} # Use a [word] in the commit message to trigger Deployer -: ${DPL_JOBNAMES} # Trigger Deployer by job name -: ${DPL_OSNAMES} # Trigger Deployer by OS name (osx,linux) -: ${DPL_BRANCHES} # Trigger Deployer by git branch name - -# Job Parameters -: ${_DPL_JOB_ENABLED} # Enable Deployer for this specific job. DPL_ENABLED must be set too. -: ${_DPL_JOB_NAME} # Identifier for the job, used for logging and trigger word matching -: ${_DPL_FTP_TARGET} # Deploy to FTP -: ${_DPL_DPUT_TARGET} # Deploy to DPUT -: ${_DPL_PACKAGE_SOURCE} # Build packages into a Source distribution. Linux only. -: ${_DPL_PACKAGE_BINARY} # Build packages into a Binary distribution. -: ${_DPL_PACKAGE_MAIN:=1} # Build main installation package. Linux only; OS X assumes this. -: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only. +: ${DPL_FORCE_ON} # Force-enable Deployer for branches +: ${DPL_FORCE_ON_GITHUB} # Force-enable Deployer for GitHub Releases +: ${DPL_FORCE_ON_FTP} # Force-enable Deployer for FTP +: ${DPL_FORCE_OFF} # Force-disable Deployer for tags +: ${DPL_FORCE_OFF_GITHUB} # Force-disable Deployer for GitHub Releases +: ${DPL_FORCE_OFF_FTP} # Force-disable Deployer for FTP +: ${DPL_BRANCH_TRIGGER:=deployer} # Use a word in the branch name to trigger Deployer +: ${DPL_COMMIT_TRIGGER:=deployer} # Use a [word] in the commit message to trigger Deployer +: ${DPL_UPLOAD_BINARY:=1} # Upload an archive containing the binary file plus $ASSET_FILES_DOCS +: ${DPL_UPLOAD_ASSETS} # Upload an archive containing the binary file plus $ASSET_FILES_DOCS plus all other assets +: ${DPL_UPLOAD_INSTALLER} # Upload an archive containing an installer +: ${DPL_ARCHIVE_NAME} # Name to use for deployed archives. Defaults to $TRAVIS_TAG-$TRAVIS_OS_NAME or "srb2$TRAVIS_OS_NAME-$TRAVIS_BRANCH-${TRAVIS_COMMIT:0:8}-${TRAVIS_JOB_ID}" # Asset File Parameters -: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z} -: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z} -: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta} # POST v2.2 NOTE: Don't forget to add patch.pk3! +: ${ASSET_ARCHIVE_PATHS:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-2.2.4-assets.7z;https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-2.2.4-optional-assets.7z} +: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta patch.pk3} : ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt README-SDL.txt} -: ${ASSET_FILES_OPTIONAL_GET:=0} # FTP Parameters -: ${DPL_FTP_PROTOCOL} +: ${DPL_FTP_PROTOCOL:=ftp} : ${DPL_FTP_USER} : ${DPL_FTP_PASS} : ${DPL_FTP_HOSTNAME} -: ${DPL_FTP_PORT} +: ${DPL_FTP_PORT:=21} : ${DPL_FTP_PATH} -# DPUT Parameters -: ${DPL_DPUT_DOMAIN:=ppa.launchpad.net} -: ${DPL_DPUT_METHOD:=sftp} -: ${DPL_DPUT_INCOMING} -: ${DPL_DPUT_LOGIN:=anonymous} -: ${DPL_SSH_KEY_PRIVATE} # Base64-encoded private key file. Used to sign repository uploads -: ${DPL_SSH_KEY_PASSPHRASE} # Decodes the private key file. - -# Package Parameters +# Debian Package Parameters : ${PACKAGE_NAME:=srb2} : ${PACKAGE_VERSION:=2.2.0} : ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic) @@ -71,9 +55,6 @@ : ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.} : ${PROGRAM_FILENAME:=srb2} -: ${DPL_PGP_KEY_PRIVATE} # Base64-encoded private key file. Used to sign Debian packages -: ${DPL_PGP_KEY_PASSPHRASE} # Decodes the private key file. - # Export Asset and Package Parameters for envsubst templating export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}" diff --git a/travis/deployer.sh b/travis/deployer.sh new file mode 100755 index 000000000..5d1ddea72 --- /dev/null +++ b/travis/deployer.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Pre-Deployment Script + +# Determine whether we are deploying this job. +if [[ ("$DPL_GITHUB_TOKEN" != "" && + "$TRAVIS_PULL_REQUEST" == "false" && + "$DPL_FORCE_OFF" != "1" && + "$DPL_FORCE_OFF_GITHUB" != "1" && + ( + "$DPL_FORCE_ON" = "1" || + "$DPL_FORCE_ON_GITHUB" = "1" || + "$TRAVIS_TAG" != "" || + "$TRAVIS_BRANCH" =~ ^.*$DPL_BRANCH_TRIGGER.*$ || + "$TRAVIS_COMMIT_MESSAGE" =~ ^.*\[$DPL_COMMIT_TRIGGER\].*$ + )) ]]; then + __DPL_ENABLED=1; +fi; + +# On OSX, use sudo to make packages +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + __MAKE="sudo make"; + __RM="sudo rm"; + __MV="sudo mv"; +else + __RM="rm"; + __MV="mv"; +fi; + +# Construct our package name +if [[ "$DPL_PACKAGE_NAME" == "" ]]; then + if [[ "$TRAVIS_TAG" != "" ]]; then + DPL_PACKAGE_NAME="$TRAVIS_TAG-$TRAVIS_OS_NAME"; + else + DPL_PACKAGE_NAME="$PROGRAM_FILENAME-$TRAVIS_OS_NAME-$TRAVIS_BRANCH-${TRAVIS_COMMIT:0:8}-${TRAVIS_JOB_ID}"; + fi; +fi; + +# As-is tradition, generate 7Z archives for Windows. +if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then + __CPACK_GENERATOR="7Z" +fi; + +mkdir deploy; + +# Use CMAKE to build no-asset and asset packages. +# NOTE: When specifying an archive generator (ZIP, TGZ, 7Z), the filename +# should be specified by CPACK_ARCHIVE_FILE_NAME, but currently the effective +# variable is CPACK_PACKAGE_FILE_NAME. Per +# https://gitlab.kitware.com/cmake/cmake/-/issues/20419 + +# Build no-asset package +if [[ "$__DPL_ENABLED" == "1" ]] && [[ "$DPL_UPLOAD_BINARY" == "1" ]]; then + cmake .. -DSRB2_ASSET_INSTALL=OFF -DSRB2_DEBUG_INSTALL=ON -DSRB2_CPACK_GENERATOR="${__CPACK_GENERATOR}" -DCPACK_PACKAGE_FILE_NAME="${DPL_PACKAGE_NAME}-no-assets"; + $__MAKE -k package; + if [ -d "package/_CPack_Packages" ]; then + $__RM -r package/_CPack_Packages; + fi; + $__MV package/* deploy/; +fi; + +# Build package including binary and assets +if [[ "$__DPL_ENABLED" == "1" ]] && [[ "$DPL_UPLOAD_ASSETS" == "1" ]]; then + cmake .. -DSRB2_ASSET_INSTALL=ON -DSRB2_DEBUG_INSTALL=ON -DSRB2_CPACK_GENERATOR="${__CPACK_GENERATOR}" -DCPACK_PACKAGE_FILE_NAME="${DPL_PACKAGE_NAME}"; + $__MAKE -k package; + if [ -d "package/_CPack_Packages" ]; then + $__RM -r package/_CPack_Packages; + fi; + $__MV package/* deploy/; +fi; + +# Build installer +# We expect the filetype to be different than the asset package, above. +# For now, only build for OSX. +if [[ "$__DPL_ENABLED" == "1" ]] && [[ "$DPL_UPLOAD_INSTALLER" == "1" ]]; then + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + cmake .. -DSRB2_ASSET_INSTALL=ON -DSRB2_DEBUG_INSTALL=OFF -DSRB2_CPACK_GENERATOR=DragNDrop -DCPACK_PACKAGE_FILE_NAME="${DPL_PACKAGE_NAME}"; + $__MAKE -k package; + if [ -d "package/_CPack_Packages" ]; then + $__RM -r package/_CPack_Packages; + fi; + $__MV package/* deploy/; + else + echo "Building an installer is not supported on $TRAVIS_OS_NAME."; + fi; +fi; diff --git a/travis/deployer_build.sh b/travis/deployer_build.sh new file mode 100755 index 000000000..9e7896fd9 --- /dev/null +++ b/travis/deployer_build.sh @@ -0,0 +1,156 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Build Script for Debian packages +# +# NOTE: RETAINED FOR REFERENCE; NOT CURRENTLY USED + +if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then + echo "Building Debian package(s)" + + sudo apt-get install devscripts debhelper fakeroot secure-delete expect; + + # Build source packages first, since they zip up the entire source folder, + # binaries and all + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + . ../debian_template.sh main; + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + if [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then + echo "Building main source Debian package"; + expect <(cat < key.asc; + echo "$DPL_PGP_KEY_PASSPHRASE" > phrase.txt; + gpg --import key.asc; + + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + echo "Signing main package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; # parent of repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + echo "Signing asset package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + # Delete the keys :eyes: + srm key.asc; + srm phrase.txt; + fi; +fi; diff --git a/deployer/travis/deployer_dput.sh b/travis/deployer_dput.sh similarity index 98% rename from deployer/travis/deployer_dput.sh rename to travis/deployer_dput.sh index 863a928cd..7f454ad4d 100644 --- a/deployer/travis/deployer_dput.sh +++ b/travis/deployer_dput.sh @@ -3,6 +3,7 @@ # Deployer for Travis-CI # DPUT uploader (e.g., Launchpad PPA) # +# NOTE: RETAINED FOR REFERENCE; NOT CURRENTLY USED if [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then # Install APT dependencies diff --git a/travis/deployer_ftp.sh b/travis/deployer_ftp.sh new file mode 100755 index 000000000..6d4154f75 --- /dev/null +++ b/travis/deployer_ftp.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +# Deployer for Travis-CI +# FTP Uploader +# +# Package files are uploaded to, e.g., ftp://username:password@example.com:21/path/to/upload/STJr/SRB2/master/460873812-151.1 +# With file `commit.txt` and folder(s) `bin` and `package` +# +# Set these environment variables in your Travis-CI settings, where they are stored securely. +# See other shell scripts for more options. +# +# DPL_FTP_PROTOCOL = ftp (ftp or sftp or ftps or however your FTP URI begins) +# DPL_FTP_USER = username +# DPL_FTP_PASS = password +# DPL_FTP_HOSTNAME = example.com +# DPL_FTP_PORT = 21 +# DPL_FTP_PATH = path/to/upload (do not add trailing slash) + +# Old variables for Debian package builds +: ${__DPL_DEBIAN_ACTIVE} +: ${_DPL_PACKAGE_MAIN} +: ${_DPL_PACKAGE_ASSET} +: ${_DPL_PACKAGE_BINARY} +: ${_DPL_PACKAGE_SOURCE} + +# Generate commit.txt file +echo "Travis-CI Build $TRAVIS_OS_NAME - $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH - $TRAVIS_OS_NAME" > "commit.txt"; +echo "Job ID $TRAVIS_JOB_ID" >> "commit.txt"; +echo "" >> "commit.txt"; +echo "Commit $TRAVIS_COMMIT" >> "commit.txt"; +echo "$TRAVIS_COMMIT_MESSAGE" >> "commit.txt"; +echo "" >> "commit.txt"; + +# Initialize FTP parameters +if [[ "$DPL_FTP_PORT" == "" ]]; then + DPL_FTP_PORT=21; +fi; +if [[ "$DPL_FTP_PROTOCOL" == "" ]]; then + DPL_FTP_PROTOCOL=ftp; +fi; +if [[ "$DPL_FTP_PATH" == "" ]]; then + DPL_FTP_PATH="/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_JOB_ID-$TRAVIS_OS_NAME"; +fi; +__DPL_FTP_LOCATION=$DPL_FTP_PROTOCOL://$DPL_FTP_HOSTNAME:$DPL_FTP_PORT/$DPL_FTP_PATH; + +# Upload to FTP! +echo "Uploading to FTP..."; +curl --ftp-create-dirs -T "commit.txt" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/commit.txt"; + +if [[ "$__DPL_DEBIAN_ACTIVE" != "1" ]]; then + find deploy -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; +else + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/main/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/asset/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; +fi; \ No newline at end of file diff --git a/travis/osx_brew_upgrade.sh b/travis/osx_brew_upgrade.sh new file mode 100755 index 000000000..ccc2c4123 --- /dev/null +++ b/travis/osx_brew_upgrade.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +build_from_source="" +package=$1 +if [[ "$package" == "--build-from-source" ]]; then + build_from_source="--build-from-source"; + package=$2; + args=${a[@]:2}; +else + args=${a[@]:1}; +fi +pkg_installed=false +pkg_updated=false +verbose=true + +# TODO: ensure valid input + +list_output=`brew list | grep $package` +outdated_output=`brew outdated | grep $package` + +# now enable error checking +set -e + +if [[ ! -z "$list_output" ]]; then + pkg_installed=true + $verbose && echo "package $package is installed" + if [[ -z "$outdated_output" ]]; then + pkg_updated=true + $verbose && echo "package $package is up-to-date." + else + $verbose && echo "package $package is out-of-date. updating..." + brew upgrade $build_from_source $package $args + fi +else + $verbose && echo "package $package is not installed. installing..." + brew install $build_from_source $package $args +fi diff --git a/travis/windows_install.sh b/travis/windows_install.sh new file mode 100755 index 000000000..e2da0a13b --- /dev/null +++ b/travis/windows_install.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Windows Setup + +# Install MSYS and MINGW-W64 +# Right now, we only use MSYS2 for installing packages. IF YOU USE MSYS2 IN OTHER WAYS, NOTE: +# - MSYS2 does NOT inherit environment variables from Bash. +# - MSYS2 CAN inherit PATH from Windows because we invoke msys2_shell.cmd with --full-path. +# - Each call to MSYS2 is a NEW SHELL! +if [ ! -f "C:/tools/msys64/msys2_shell.cmd" ]; then + rm -rf C:/tools/msys64; +fi; +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 mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" +export msys2+=" -msys2 -c "\"\$@"\" --" +# It would be better to download specific build versions, +# but the toolchain contains a lot of packages. We target GCC 10. +if [[ "$MSYS2_PACKAGES" == "" ]]; then + MSYS2_PACKAGES="mingw-w64-i686-toolchain;mingw-w64-i686-nasm;mingw-w64-i686-ccache"; +fi +IFS=';' read -r -a pkgs <<< "$MSYS2_PACKAGES"; +for pkg in "${pkgs[@]}"; +do + $msys2 pacman --sync -u --noconfirm --needed $pkg; +done; +## Install more MSYS2 packages from https://packages.msys2.org/base here +#taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967 +export PATH=/c/tools/msys64/mingw64/bin:/c/tools/msys64/mingw32/bin:$PATH +export MAKE=mingw32-make # so that Autotools can find it