From f1563c56042561d15b23b261b53e4469eca66cfb Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Sun, 25 Nov 2018 11:25:47 +0100 Subject: [PATCH] add fedora docker image to travis compilation (#3447) * add fedora docker image to travis compilation fixes #1746 * add dockerfile * would you like to please install for me? [y/n] * remove bc dependency * save cache separately for different docker builds * add development packages to fedora dockerfile * add package names * use env values to make these all look the same * set docker image name correctly * add missing dependency * minor oversight, add %% to remove all braces in check schema --- .ci/Fedora29/Dockerfile | 17 +++++++ .ci/UbuntuBionic/Dockerfile | 1 - .travis.yml | 79 ++++++++++++++++++++++-------- servatrice/check_schema_version.sh | 8 +-- 4 files changed, 81 insertions(+), 24 deletions(-) create mode 100644 .ci/Fedora29/Dockerfile diff --git a/.ci/Fedora29/Dockerfile b/.ci/Fedora29/Dockerfile new file mode 100644 index 00000000..eafdfe5f --- /dev/null +++ b/.ci/Fedora29/Dockerfile @@ -0,0 +1,17 @@ +FROM fedora:29 + +RUN dnf install -y \ + @development-tools \ + ccache \ + cmake \ + desktop-file-utils \ + file \ + gcc-c++ \ + hicolor-icon-theme \ + libappstream-glib \ + protobuf-devel \ + qt5-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel \ + sqlite-devel \ + wget \ + zlib-devel \ + && dnf clean all diff --git a/.ci/UbuntuBionic/Dockerfile b/.ci/UbuntuBionic/Dockerfile index 65ef1f6d..9c41fb63 100644 --- a/.ci/UbuntuBionic/Dockerfile +++ b/.ci/UbuntuBionic/Dockerfile @@ -1,7 +1,6 @@ FROM ubuntu:bionic RUN apt-get update && apt-get install -y --no-install-recommends \ - bc \ build-essential \ clang-format \ file \ diff --git a/.travis.yml b/.travis.yml index 21a7a55d..ef741da8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,15 @@ language: cpp compiler: gcc -cache: ccache matrix: include: - #Ubuntu Bionic (on docker) - - name: Ubuntu Bionic (Debug) - if: tag IS NOT present - services: docker - before_install: docker build -t img .ci/UbuntuBionic - script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" - --mount "type=bind,source=$HOME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" - img - bash .ci/travis-compile.sh --server --debug - - name: Ubuntu Bionic (Release) - if: (branch = master AND NOT type = pull_request) OR tag IS present - services: docker - before_install: docker build -t img .ci/UbuntuBionic - script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" - --mount "type=bind,source=$HOME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" - img - bash .ci/travis-compile.sh --server --package "Ubuntu18.04" --release - #Ubuntu Xenial (Debug only) - name: Ubuntu Xenial (Debug) if: tag IS NOT present os: linux dist: xenial group: stable + cache: ccache addons: apt: packages: @@ -43,27 +25,84 @@ matrix: - libqt5websockets5-dev script: bash ./.ci/travis-compile.sh --format --server --test --debug + #Ubuntu Bionic (on docker) + - name: Ubuntu Bionic (Debug) + if: tag IS NOT present + services: docker + env: NAME=UbuntuBionic + cache: + directories: + - $HOME/$NAME/ + before_install: docker build -t "cockatrice_${NAME,,}" .ci/$NAME && mkdir -p $HOME/$NAME/.ccache + script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" + --mount "type=bind,source=$HOME/$NAME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" + "cockatrice_${NAME,,}" + bash .ci/travis-compile.sh --server --debug + + - name: Ubuntu Bionic (Release) + if: (branch = master AND NOT type = pull_request) OR tag IS present + services: docker + env: NAME=UbuntuBionic + cache: + directories: + - $HOME/$NAME/ + before_install: docker build -t "cockatrice_${NAME,,}" .ci/$NAME && mkdir -p $HOME/$NAME/.ccache + script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" + --mount "type=bind,source=$HOME/$NAME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" + "cockatrice_${NAME,,}" + bash .ci/travis-compile.sh --server --package "$NAME" --release + + #Fedora 29 (on docker) + - name: Fedora 29 (Debug) + if: tag IS NOT present + services: docker + env: NAME=Fedora29 + cache: + directories: + - $HOME/$NAME/ + before_install: docker build -t "cockatrice_${NAME,,}" .ci/$NAME && mkdir -p $HOME/$NAME/.ccache + script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" + --mount "type=bind,source=$HOME/$NAME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" + "cockatrice_${NAME,,}" + bash .ci/travis-compile.sh --server --debug + + - name: Fedora 29 (Release) + if: (branch = master AND NOT type = pull_request) OR tag IS present + services: docker + env: NAME=Fedora29 + cache: + directories: + - $HOME/$NAME/ + before_install: docker build -t "cockatrice_${NAME,,}" .ci/$NAME && mkdir -p $HOME/$NAME/.ccache + script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src" + --mount "type=bind,source=$HOME/$NAME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache" + "cockatrice_${NAME,,}" + bash .ci/travis-compile.sh --server --package "$NAME" --release + #macOS - name: macOS (Debug) if: tag IS NOT present os: osx osx_image: xcode8 + cache: ccache before_install: - brew update - brew install ccache - brew install protobuf --without-python@2 - brew install qt script: bash ./.ci/travis-compile.sh --server --install --debug + - name: macOS (Release) if: (branch = master AND NOT type = pull_request) OR tag IS present os: osx osx_image: xcode8 + cache: ccache before_install: - brew update - brew install ccache - brew install protobuf --without-python@2 - brew install qt - script: bash ./.ci/travis-compile.sh --server --package "" --release + script: bash ./.ci/travis-compile.sh --server --package "$TRAVIS_OS_NAME" --release # Builds for pull requests skip the deployment step altogether diff --git a/servatrice/check_schema_version.sh b/servatrice/check_schema_version.sh index d59edc7a..ed877234 100755 --- a/servatrice/check_schema_version.sh +++ b/servatrice/check_schema_version.sh @@ -2,13 +2,15 @@ set -e -schema_ver="$(grep 'INSERT INTO cockatrice_schema_version' servatrice/servatrice.sql | sed 's/.*VALUES(//' | sed 's/).*//')" +version_line="$(grep 'INSERT INTO cockatrice_schema_version' servatrice/servatrice.sql)" +version_line="${version_line#*VALUES(}" +declare -i schema_ver="${version_line%%)*}" latest_migration="$(ls -1 servatrice/migrations/ | tail -n1)" xtoysql="${latest_migration#servatrice_}" xtoy="${xtoysql%.sql}" -old_ver="$(echo ${xtoy%%_to_*} | bc)" -new_ver="$(echo ${xtoy##*_to_} | bc)" +declare -i old_ver="10#${xtoy%_to_*}" #declare as integer with base 10, numbers with a leading 0 are normally interpreted as base 16 +declare -i new_ver="10#${xtoy#*_to_}" if ((old_ver >= new_ver)); then echo "New version $new_ver is not newer than $old_ver"