travis: separate lint build (#3778)
* Create travis-lint.sh * separate lint * Update travis-lint.sh * Update travis-lint.sh * use default image * call lint externally * add xenial again for tests * Update .travis.yml * fix path * move test to docker build * remove --format argument test / passed * add test label * use bash command * source > execute
This commit is contained in:
parent
2ef3e6fc93
commit
a8b34d51a5
3 changed files with 44 additions and 59 deletions
|
@ -54,43 +54,7 @@ done
|
||||||
|
|
||||||
# Check formatting using clang-format
|
# Check formatting using clang-format
|
||||||
if [[ $CHECK_FORMAT ]]; then
|
if [[ $CHECK_FORMAT ]]; then
|
||||||
echo "Checking your code using clang-format..."
|
source ./.ci/travis-lint.sh
|
||||||
diff="$(./clangify.sh --diff --cf-version)"
|
|
||||||
err=$?
|
|
||||||
case $err in
|
|
||||||
1)
|
|
||||||
cat <<EOM
|
|
||||||
***********************************************************
|
|
||||||
*** ***
|
|
||||||
*** Your code does not comply with our styleguide. ***
|
|
||||||
*** ***
|
|
||||||
*** Please correct it or run the "clangify.sh" script. ***
|
|
||||||
*** Then commit and push those changes to this branch. ***
|
|
||||||
*** Check our CONTRIBUTING.md file for more details. ***
|
|
||||||
*** ***
|
|
||||||
*** Thank you ♥ ***
|
|
||||||
*** ***
|
|
||||||
***********************************************************
|
|
||||||
|
|
||||||
Used clang-format version:
|
|
||||||
${diff%%
|
|
||||||
*}
|
|
||||||
|
|
||||||
The following changes should be made:
|
|
||||||
${diff#*
|
|
||||||
}
|
|
||||||
|
|
||||||
Exiting...
|
|
||||||
EOM
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
0)
|
|
||||||
echo "Thank you for complying with our code standards."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Something went wrong in our formatting checks: clangify returned $err" >&2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
37
.ci/travis-lint.sh
Normal file
37
.ci/travis-lint.sh
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check formatting using clang-format
|
||||||
|
echo "Checking your code using clang-format..."
|
||||||
|
diff="$(./clangify.sh --diff --cf-version)"
|
||||||
|
err=$?
|
||||||
|
case $err in
|
||||||
|
1)
|
||||||
|
cat <<EOM
|
||||||
|
***********************************************************
|
||||||
|
*** ***
|
||||||
|
*** Your code does not comply with our styleguide. ***
|
||||||
|
*** ***
|
||||||
|
*** Please correct it or run the "clangify.sh" script. ***
|
||||||
|
*** Then commit and push those changes to this branch. ***
|
||||||
|
*** Check our CONTRIBUTING.md file for more details. ***
|
||||||
|
*** ***
|
||||||
|
*** Thank you ♥ ***
|
||||||
|
*** ***
|
||||||
|
***********************************************************
|
||||||
|
Used clang-format version:
|
||||||
|
${diff%%
|
||||||
|
*}
|
||||||
|
The following changes should be made:
|
||||||
|
${diff#*
|
||||||
|
}
|
||||||
|
Exiting...
|
||||||
|
EOM
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
echo "Thank you for complying with our code standards."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Something went wrong in our formatting checks: clangify returned $err" >&2
|
||||||
|
;;
|
||||||
|
esac
|
28
.travis.yml
28
.travis.yml
|
@ -7,32 +7,16 @@ git:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|
||||||
#Ubuntu Xenial (Debug only)
|
#Static Code Analysis
|
||||||
- name: Ubuntu Xenial (Debug)
|
- name: Check code style / Linting
|
||||||
if: tag IS NOT present
|
if: tag IS NOT present
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
group: stable
|
group: stable
|
||||||
cache: ccache
|
script: bash ./.ci/travis-lint.sh
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libprotobuf-dev
|
|
||||||
- protobuf-compiler
|
|
||||||
- liblzma-dev
|
|
||||||
- qt5-default
|
|
||||||
- qttools5-dev
|
|
||||||
- qttools5-dev-tools
|
|
||||||
- qtmultimedia5-dev
|
|
||||||
- libqt5multimedia5-plugins
|
|
||||||
- libqt5svg5-dev
|
|
||||||
- libqt5sql5-mysql
|
|
||||||
- libqt5websockets5-dev
|
|
||||||
script: bash ./.ci/travis-compile.sh --format --server --test --debug
|
|
||||||
|
|
||||||
|
|
||||||
#Ubuntu Bionic (on docker)
|
#Ubuntu Bionic (on Docker)
|
||||||
- name: Ubuntu Bionic (Debug)
|
- name: Ubuntu Bionic (Debug + Tests)
|
||||||
if: tag IS NOT present
|
if: tag IS NOT present
|
||||||
services: docker
|
services: docker
|
||||||
env: NAME=UbuntuBionic
|
env: NAME=UbuntuBionic
|
||||||
|
@ -43,7 +27,7 @@ matrix:
|
||||||
script: docker run --mount "type=bind,source=$(pwd),target=/src" -w="/src"
|
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"
|
--mount "type=bind,source=$HOME/$NAME/.ccache,target=/.ccache" -e "CCACHE_DIR=/.ccache"
|
||||||
"cockatrice_${NAME,,}"
|
"cockatrice_${NAME,,}"
|
||||||
bash .ci/travis-compile.sh --server --debug
|
bash .ci/travis-compile.sh --server --test --debug
|
||||||
|
|
||||||
- name: Ubuntu Bionic (Release)
|
- name: Ubuntu Bionic (Release)
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
||||||
|
|
Loading…
Reference in a new issue