From 5a754c2e499a42682bb1a4d00fc37c615db29f53 Mon Sep 17 00:00:00 2001 From: still-flow <46608177+still-flow@users.noreply.github.com> Date: Thu, 1 Oct 2020 03:30:41 +0300 Subject: [PATCH] new round of CI improvements/fixes for Github CI: - exit->quit in gdb cmdlist - remove unnecessary backtrace gdb cmd - remove mymake output buffering for all platforms - remove `brew update` step - move from to-be-deprecated emscripten container - switch to podman instead of docker - cancel workflow if a more recent one is running also update Travis config in sync: - podman has to be installed manually - rework Mac dependency installation per https://docs.travis-ci.com/user/reference/osx/#homebrew recommendation --- .github/workflows/github_ci.yml | 7 ++++- .github/workflows/install_deps.sh | 6 ++-- .github/workflows/test_simple.sh | 3 +- .travis.yml | 46 ++++++++++++++++++------------- .travis/Brewfile.travis | 8 ++++++ mymake.cpp | 2 +- 6 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 .travis/Brewfile.travis diff --git a/.github/workflows/github_ci.yml b/.github/workflows/github_ci.yml index 5127f76da..e1d407d61 100644 --- a/.github/workflows/github_ci.yml +++ b/.github/workflows/github_ci.yml @@ -7,6 +7,11 @@ on: branches: [master] jobs: + cancel_previous: + name: Cancel workflows for outdated commits + runs-on: ubuntu-latest + steps: + - uses: technote-space/auto-cancel-redundant-job@v1 main_matrix: name: Unix runs-on: ${{ matrix.os }} @@ -77,7 +82,7 @@ jobs: - uses: actions/checkout@v2 - name: Build run: | - docker run --rm -v $(pwd):/src trzeci/emscripten make -f Makefile.simple emscripten + podman run --rm -v $(pwd):/src emscripten/emsdk make -f Makefile.simple emscripten - name: Do a simple test run: | ls -lAF hyper.html hyper.js hyper.wasm diff --git a/.github/workflows/install_deps.sh b/.github/workflows/install_deps.sh index c20481577..1c7513006 100755 --- a/.github/workflows/install_deps.sh +++ b/.github/workflows/install_deps.sh @@ -2,7 +2,7 @@ set -x -e o pipefail GH_DEPS_UBUNTU="$GH_COMPILER libsdl1.2-dev libsdl-ttf2.0-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev" -GH_DEPS_MACOS="sdl sdl_gfx sdl_mixer sdl_ttf" +GH_DEPS_MACOS="sdl sdl_gfx sdl_mixer sdl_ttf" # macos-latest already has both gcc and clang GH_DEPS_MINGW64="$GH_COMPILER:x SDL:x SDL_ttf:x SDL_gfx:x SDL_mixer:x make gdb:x" if [[ "$GH_HYP_GLEW" == "glew_1" ]]; then @@ -26,8 +26,8 @@ fi if [[ "$GH_OS" == "ubuntu-latest" ]]; then sudo apt-get -y install $GH_DEPS_UBUNTU elif [[ "$GH_OS" == "macos-latest" ]]; then - brew update - # macos-latest already has both gcc and clang + # As of 2020-09-30, brew update sometimes times out on Github CI, so we don't do it here + # it's also arguably not necessary because VM images already contain recent-ish homebrew database brew install $GH_DEPS_MACOS # work around https://stackoverflow.com/questions/51034399/ for now (cd /usr/local/include && ln -sf SDL/SDL.h) diff --git a/.github/workflows/test_simple.sh b/.github/workflows/test_simple.sh index 5cbff0dd0..c64cdb690 100755 --- a/.github/workflows/test_simple.sh +++ b/.github/workflows/test_simple.sh @@ -5,8 +5,7 @@ if [[ "$GH_OS" == "windows-latest" && "$GH_BUILDSYS" == "mymake" ]]; then cat << ENDOFCMDS > .github/workflows/gdb_cmds.txt run --version - backtrace - exit 1 + quit 1 ENDOFCMDS gdb --batch -x .github/workflows/gdb_cmds.txt ./hyperrogue diff --git a/.travis.yml b/.travis.yml index 5da342ab0..814238661 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: cpp -services: - - docker +addons: + homebrew: + brewfile: .travis/Brewfile.travis + update: true matrix: include: - os: linux # Linux GCC, autotools @@ -135,22 +137,21 @@ before_install: sudo apt-get update -qq sudo apt-get install -qq libsdl1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew update - brew install sdl sdl_gfx sdl_mixer sdl_ttf + # SDL installation is handled by Homebrew addon above # work around https://stackoverflow.com/questions/51034399/ for now (cd /usr/local/include && ln -sf SDL/SDL.h) else - exit 'Unsupported OS' + echo 'Unsupported OS' + exit 1 fi - |- # Install GLEW if asked for if [[ "$HYPERROGUE_USE_GLEW" == "1" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -qq libglew-dev - elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install glew - else - exit 'Unsupported OS' + elif [[ "$TRAVIS_OS_NAME" != "osx" ]]; then + echo 'Unsupported OS' + exit 1 fi fi - |- @@ -158,10 +159,9 @@ before_install: if [[ "$HYPERROGUE_USE_PNG" == "1" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo 'libpng is installed by default' - elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install libpng - else - exit 'Unsupported OS' + elif [[ "$TRAVIS_OS_NAME" != "osx" ]]; then + echo 'Unsupported OS' + exit 1 fi fi - |- @@ -169,12 +169,19 @@ before_install: if [[ "$TRAVIS_USE_AUTOTOOLS" == "1" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo 'autotools is installed by default' - elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew install automake - else - exit 'Unsupported OS' + elif [[ "$TRAVIS_OS_NAME" != "osx" ]]; then + echo 'Unsupported OS' + exit 1 fi fi +- |- + # Install podman if asked for + if [[ "$TRAVIS_BUILD_SYSTEM" == "emscripten" && "$TRAVIS_OS_NAME" == "linux" ]]; then + # partially stolen from https://github.com/junaruga/podman-experiment/blob/master/.travis.yml + sudo add-apt-repository -y ppa:projectatomic/ppa + sudo apt-get update -qq + sudo apt-get install -qq -y podman + fi script: - |- @@ -193,9 +200,10 @@ script: ./mymake fi elif [[ "$TRAVIS_BUILD_SYSTEM" == "emscripten" ]]; then - docker run --rm -v $(pwd):/src trzeci/emscripten make -f Makefile.simple emscripten + podman run --rm -v $(pwd):/src hub.docker.com/u/emscripten/emsdk make -f Makefile.simple emscripten else - exit 'Unsupported build system' + echo 'Unsupported build system' + exit 1 fi - |- # Test hyperrogue. diff --git a/.travis/Brewfile.travis b/.travis/Brewfile.travis new file mode 100644 index 000000000..bbb2fede4 --- /dev/null +++ b/.travis/Brewfile.travis @@ -0,0 +1,8 @@ +# using https://github.com/Homebrew/homebrew-bundle/blob/master/README.md#usage as example +brew "sdl" +brew "sdl_gfx" +brew "sdl_mixer" +brew "sdl_ttf" +brew "glew" unless system "[[ \"$HYPERROGUE_USE_GLEW\" != \"1\" ]]" +brew "libpng" unless system "[[ \"$HYPERROGUE_USE_PNG\" != \"1\" ]]" +brew "automake" unless system "[[ \"$TRAVIS_USE_AUTOTOOLS\" != \"1\" ]]" diff --git a/mymake.cpp b/mymake.cpp index e3a729881..f98d3b621 100644 --- a/mymake.cpp +++ b/mymake.cpp @@ -57,7 +57,6 @@ void set_mingw64() { linker = "g++ -o hyper"; opts = "-DWINDOWS -DCAP_GLEW=1 -DCAP_PNG=1"; libs = " savepng.o hyper.res -lopengl32 -lSDL -lSDL_gfx -lSDL_mixer -lSDL_ttf -lpthread -lz -lglew32 -lpng"; - setvbuf(stdout, NULL, _IONBF, 0); // MinGW is quirky with output buffering } vector modules; @@ -84,6 +83,7 @@ bool file_exists(string fname) { } int main(int argc, char **argv) { + setvbuf(stdout, nullptr, _IONBF, 0); // this should help with responsiveness of the real-time CI logs #if defined(MAC) set_mac(); #elif defined(WINDOWS)