From 615ff4e7dbe2c4fc888ef489cf71dbca25d1b568 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Fri, 14 Jun 2019 15:20:42 -0400 Subject: [PATCH 1/3] lint: Run the linters against Mac OS on Travis This helps ensure ongoing compatibility with macOS-distributed version of GNU bash. --- .travis.yml | 22 ++++++++++++++++++++++ ci/lint/04_install.sh | 16 ++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3467103d100..0810e7ef3c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,6 +88,28 @@ jobs: script: - set -o errexit; source ./ci/extended_lint/06_script.sh + - stage: extended-lint + name: 'lint macOS 10.12 (compat)' + os: osx + # Use the earliest macOS that can build our lint dependencies: + # Xcode 8.3.3, macOS 10.12, JDK 1.8.0_112-b16 + # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version + osx_image: xcode8.3 + # TODO: if you're updating osx_image, try using "rvm:" to supply the + # version of ruby required by homebrew. Despite this "rvm:" declaration, + # brew update installs ruby 2.3.7 as its first action. + language: ruby + rvm: + - 2.3.7 + env: + cache: false + install: + - set -o errexit; source ./ci/lint/04_install.sh + before_script: + - set -o errexit; source ./ci/lint/05_before_script.sh + script: + - set -o errexit; source ./ci/lint/06_script.sh + - stage: test name: 'ARM [GOAL: install] [no unit or functional tests]' env: >- diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index 12c3bfce451..712d410cd39 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -6,9 +6,17 @@ export LC_ALL=C +if [ "$TRAVIS_OS_NAME" == "osx" ]; then + # update first to install required ruby dependency + travis_retry brew update + travis_retry brew install shellcheck + travis_retry brew upgrade python + export PATH="$(brew --prefix python)/bin:$PATH" +else + SHELLCHECK_VERSION=v0.6.0 + travis_retry curl --silent "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/ + export PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" +fi + travis_retry pip3 install codespell==1.15.0 travis_retry pip3 install flake8==3.7.8 - -SHELLCHECK_VERSION=v0.6.0 -curl -s "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/ -export PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" From eafa747ca5926d47f555820cecae0846ac01e20f Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Sun, 9 Jun 2019 18:34:10 +0200 Subject: [PATCH 2/3] lint: Fix shellcheck SC2155 Declare and assign separately to avoid masking return values. https://github.com/koalaman/shellcheck/wiki/SC2155 --- ci/lint/04_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index 712d410cd39..9d275e7b3bb 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -11,11 +11,13 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then travis_retry brew update travis_retry brew install shellcheck travis_retry brew upgrade python - export PATH="$(brew --prefix python)/bin:$PATH" + PATH="$(brew --prefix python)/bin:$PATH" + export PATH else SHELLCHECK_VERSION=v0.6.0 travis_retry curl --silent "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/ - export PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" + PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}" + export PATH fi travis_retry pip3 install codespell==1.15.0 From cd82f75a431967030d25bcfe7c4aaefe5b345a99 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Mon, 10 Jun 2019 04:55:47 +0200 Subject: [PATCH 3/3] lint: Install grep and git via brew on mac for --perl-regexp Particularly `--with-pcre2` is needed to run `git grep --perl-regexp` in `test/link/check-doc.py` --- ci/lint/04_install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index 9d275e7b3bb..9f7e1b310d3 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -9,6 +9,9 @@ export LC_ALL=C if [ "$TRAVIS_OS_NAME" == "osx" ]; then # update first to install required ruby dependency travis_retry brew update + travis_retry brew reinstall git -- --with-pcre2 # for --perl-regexp + travis_retry brew install grep # gnu grep for --perl-regexp support + PATH="$(brew --prefix grep)/libexec/gnubin:$PATH" travis_retry brew install shellcheck travis_retry brew upgrade python PATH="$(brew --prefix python)/bin:$PATH"