diff --git a/.ci/format-check.sh b/.ci/format-check.sh index 25260b8ef6..2822985c37 100755 --- a/.ci/format-check.sh +++ b/.ci/format-check.sh @@ -1,27 +1,29 @@ -# Clean git working directory -cleanstate=`git status | grep "modified"` -if ! [[ -z $cleanstate ]]; then - echo "Working directory not clean. Head resetting..." - git reset --hard HEAD -fi - -# Get all formattable files -filelist=`git ls-files --full-name ../src/ | grep -E "(cpp|h)$"` - -# Do the process -make format - -# Get modified files. (This should return no files if properly formatted.) -notcorrectlist=`git diff --name-only --diff-filter=M` - -if [[ -z $notcorrectlist ]]; then - echo "✅ clang-format success. Source files conform to formattings standards." - exit 0; -else - echo "❌ The following files have clang-format problems:" - for f in $notcorrectlist; do - printf "\t$f\n" - done - echo "Please ensure you have githooks properly setup, or that you are running the formatter before each commit." - exit 1; -fi \ No newline at end of file +# Clean git working directory +cleanstate=`git status | grep "modified"` +if ! [[ -z $cleanstate ]]; then + echo "Working directory not clean. Head resetting..." + git reset --hard HEAD +fi + +# Get all formattable files +filelist=`git ls-files --full-name ../src/ | grep -E "(cpp|h)$"` + +# Do the format +for f in $filelist; do + clang-format -i --style=file -verbose $f +done + +# Get modified files. (This should return no files if properly formatted.) +notcorrectlist=`git diff --name-only --diff-filter=M` + +if [[ -z $notcorrectlist ]]; then + echo "✅ clang-format success. Source files conform to formattings standards." + exit 0; +else + echo "❌ The following files have clang-format problems:" + for f in $notcorrectlist; do + printf "\t$f\n" + done + echo "Please ensure you have githooks properly setup, or that you are running the formatter before each commit." + exit 1; +fi diff --git a/.travis.yml b/.travis.yml index fbe7129b18..ae166ec4fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,101 +1,103 @@ -language: cpp -dist: xenial -sudo: required - -git: - depth: false - -stages: - - format - - compile - -# Path is modified here since we install CMake to the /usr/local/ prefix. Usually the system -# would check the full path until it reached CMake, but Travis specifically adds their CMake -# version to their path. We want our CMake to have priority, so we add it to the start of the -# search path. -env: - matrix: - - PATH=/usr/local/bin:${PATH} - # COVERITY_SCAN_TOKEN - global: - - secure: "dqRcKvhvVSV0+M9UuLTJvns4aFKHGdl7O2Bu5OkCt6hy2Fx6RErfNZKIhwoiIFSWbrLN5rbjiSrEttpGQR5lGBc3POxgW+578Ty7a8HUO5EMtXB5x4pFa8cWqkUe4xwX1tAZvHRZYpGutBwFDwLf2r6/RMZBV+FxwnjDOhpsFkIo7oIHo7qReeFoW5JkAYGOle+ZUyjjU/li/7svyO7dUmifQcdB3CQ8bMgF3Jyu8+HTzutsLep1rSN7vsw2X/NET+cvnqJ5fC//6B9stBcp80g5I3TMgx4w372VJ9Yn/Co/rqpkQ3toit+1KhJ39Wm3IaQiKctfeyvl1Wa8TDJqvmQxj/fsz+3Co+j0Afx0fW6IuF7i0aH0qJEH9sVohspyEdirlVc+QCaI2wBz06FaWZ9nIIy5fssRIzelf7MbjBHDD3iQU9TqeFZ+u4r30hUwRv1xrhpHg7f0zun0zQv29tfrroZTJQtBrCy8vscqIsP8GWPZeig/fW1Mn0vvCbI0Z7anmICYPjLWQDHjSVKexdWvmtux76PPIRlMB7FlQbQY5aar4olaSI8eFvLKV8/RUXICD36m+RNP1LXKhqJWmuvco88e+YUclvhYH+QAAqWN5f7qq4o0ujxeZvsQqYb9T5NEW+Wsap/g5RqX7S2D3XonNTGW3k14PEzdrpVVXfc=" - -matrix: - include: - - stage: format - os: linux - compiler: clang - script: - - sh .ci/build.sh - - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build - - cmake -G "Unix Makefiles" .. - - ../.ci/format-check.sh - - - ##### Linux ################## - - stage: compile - os: linux - compiler: clang - - stage: compile - os: linux - compiler: gcc - - ##### macOS ################## - - stage: compile - os: osx - osx_image: xcode10.1 - install: - - sudo gem install xcpretty - script: - - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build - - cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -G "Xcode" .. - - set -o pipefail && xcodebuild ARCHS="x86_64" -project Etterna.xcodeproj -target Etterna -destination 'platform=OSX,arch=x86_64' -configuration Release | xcpretty - -# This will only run for the linux builds -# The other os's have overridden the script tag -script: - - sh .ci/build.sh - - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build - - cmake -G "Unix Makefiles" .. - - make - -addons: - coverity_scan: - project: - name: etternagame/etterna - description: "Advanced cross-platform rhythm game focused on keyboard play" - notification_email: etternadev@gmail.com - build_command_prepend: "sh .ci/build.sh; mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build; cmake .." - build_command: "make -j 4" - branch_pattern: coverity_scan - homebrew: - packages: - - openssl - - cmake - - nasm - update: true - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise - packages: - - nasm - - libudev-dev - - gcc-5 - - g++-5 - - libmad0-dev - - libgtk2.0-dev - - binutils-dev - - libasound-dev - - libpulse-dev - - libjack-dev - - libc6-dev - - libogg-dev - - libvorbis-dev - - libxtst-dev - - libxrandr-dev - - libglew-dev - - libuv-dev - - clang-format-5.0 - update: true - +language: cpp +dist: xenial +sudo: required + +git: + depth: false + +stages: + - format + - compile + +# Path is modified here since we install CMake to the /usr/local/ prefix. Usually the system +# would check the full path until it reached CMake, but Travis specifically adds their CMake +# version to their path. We want our CMake to have priority, so we add it to the start of the +# search path. +env: + matrix: + - PATH=/usr/local/bin:${PATH} + # COVERITY_SCAN_TOKEN + global: + - secure: "dqRcKvhvVSV0+M9UuLTJvns4aFKHGdl7O2Bu5OkCt6hy2Fx6RErfNZKIhwoiIFSWbrLN5rbjiSrEttpGQR5lGBc3POxgW+578Ty7a8HUO5EMtXB5x4pFa8cWqkUe4xwX1tAZvHRZYpGutBwFDwLf2r6/RMZBV+FxwnjDOhpsFkIo7oIHo7qReeFoW5JkAYGOle+ZUyjjU/li/7svyO7dUmifQcdB3CQ8bMgF3Jyu8+HTzutsLep1rSN7vsw2X/NET+cvnqJ5fC//6B9stBcp80g5I3TMgx4w372VJ9Yn/Co/rqpkQ3toit+1KhJ39Wm3IaQiKctfeyvl1Wa8TDJqvmQxj/fsz+3Co+j0Afx0fW6IuF7i0aH0qJEH9sVohspyEdirlVc+QCaI2wBz06FaWZ9nIIy5fssRIzelf7MbjBHDD3iQU9TqeFZ+u4r30hUwRv1xrhpHg7f0zun0zQv29tfrroZTJQtBrCy8vscqIsP8GWPZeig/fW1Mn0vvCbI0Z7anmICYPjLWQDHjSVKexdWvmtux76PPIRlMB7FlQbQY5aar4olaSI8eFvLKV8/RUXICD36m+RNP1LXKhqJWmuvco88e+YUclvhYH+QAAqWN5f7qq4o0ujxeZvsQqYb9T5NEW+Wsap/g5RqX7S2D3XonNTGW3k14PEzdrpVVXfc=" + +matrix: + include: + ##### clang-format ########### + - stage: format + os: linux + compiler: clang + addons: + apt: + update: false + script: + - sh .ci/build.sh + - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build + - ../.ci/format-check.sh + + ##### Linux ################## + - stage: compile + os: linux + compiler: clang + - stage: compile + os: linux + compiler: gcc + + ##### macOS ################## + - stage: compile + os: osx + osx_image: xcode10.1 + install: + - sudo gem install xcpretty + script: + - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build + - cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -G "Xcode" .. + - set -o pipefail && xcodebuild ARCHS="x86_64" -project Etterna.xcodeproj -target Etterna -destination 'platform=OSX,arch=x86_64' -configuration Release | xcpretty + +# This will only run for the linux builds +# The other os's have overridden the script tag +script: + - sh .ci/build.sh + - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build + - cmake -G "Unix Makefiles" .. + - make + +addons: + coverity_scan: + project: + name: etternagame/etterna + description: "Advanced cross-platform rhythm game focused on keyboard play" + notification_email: etternadev@gmail.com + build_command_prepend: "sh .ci/build.sh; mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build; cmake .." + build_command: "make -j 4" + branch_pattern: coverity_scan + homebrew: + packages: + - openssl + - cmake + - nasm + update: true + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise + packages: + - nasm + - libudev-dev + - gcc-5 + - g++-5 + - libmad0-dev + - libgtk2.0-dev + - binutils-dev + - libasound-dev + - libpulse-dev + - libjack-dev + - libc6-dev + - libogg-dev + - libvorbis-dev + - libxtst-dev + - libxrandr-dev + - libglew-dev + - libuv-dev + - clang-format-5.0 + update: true +