-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Better testing #1476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+340
−128
Merged
Better testing #1476
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f013d84
Better testing
arp242 270e812
Make sure that a failure shows up correctly
arp242 5eb4ffc
Fix build again
arp242 593a888
Don't run install automatically for tests
arp242 ca7df35
Add Dockerfile to isolate tests
bhcleek 72f788d
Redirect potential `cd` output
arp242 a70dd5e
Add --depth 1 for vimhelplint
arp242 0e6bcf2
Split ./scripts/test to ./scripts/lint
arp242 3698da3
Fix cache
arp242 1b02c07
Do we need this?
arp242 9dd7017
Exit 6 for lint script on failures
arp242 53bf975
Enable modeline explicitly
bhcleek b9492fa
Run the test container as a user other than root
bhcleek df2fa69
fix documentation modeline
bhcleek cfa31a0
Replace multi-byte characters with ASCII equivalents
bhcleek f281e34
Remove cache
arp242 c7f12db
Final cleanup: fix some indent, add set -e, and add intentional fail
arp242 d531405
Fix intentional failures
arp242 ebb5030
Run lint on "make all"
arp242 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .git/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| Thanks for improving vim-go! Before you dive in please read the following: | ||
|
|
||
| 1. Please read our | ||
| [Documentation](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt), it might | ||
| have answers for your problem | ||
| 2. If you add a new feature please don't forget to update the documentation: | ||
| [Documentation](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt), | ||
| it might have a solution to your problem. | ||
| 2. If you add a new feature then please don't forget to update the documentation: | ||
| [doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt). | ||
| 3. If it's a breaking change or exceed +100 lines please open an issue first | ||
| and describe the changes you want to make. | ||
| 3. If it's a breaking change or exceeds 100 lines of code then please open an | ||
| issue first and describe the changes you want to make. | ||
| 4. See `:help go-development` for instructions on how to run and write tests. If | ||
| you add a new feature be sure you also include a test if feasible. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,2 @@ | ||
| doc/tags | ||
| .DS_Store | ||
|
|
||
| # Test specific files | ||
| FAILED | ||
| test.log | ||
| scripts/vim-vimhelplint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,11 @@ | ||
| language: go | ||
|
|
||
| env: | ||
| global: | ||
| - DEPS=$HOME/deps | ||
| - PATH=$DEPS/bin:$PATH | ||
| - PATCH="v8.0.0134" | ||
|
|
||
| install: | | ||
| git config --global user.email "you@example.com" | ||
| git config --global user.name "Your Name" | ||
|
|
||
| # check out if we can pre-compiled Vim releases somehow, | ||
| git clone --branch $PATCH --depth 1 https://github.com/vim/vim | ||
| cd vim | ||
| ./configure --prefix=$DEPS --with-features=huge --disable-gui | ||
| make | ||
| make install | ||
| cd - | ||
|
|
||
| script: ./scripts/test.sh | ||
| matrix: | ||
| include: | ||
| - env: SCRIPT=test VIM_VERSION=vim-7.4 | ||
| - env: SCRIPT=test VIM_VERSION=vim-8.0 | ||
| - env: SCRIPT=test VIM_VERSION=nvim | ||
| - env: SCRIPT=lint VIM_VERSION=vim-8.0 | ||
| install: | ||
| - ./scripts/install-vim $VIM_VERSION | ||
| script: | ||
| - ./scripts/$SCRIPT $VIM_VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM golang:1.9.1 | ||
|
|
||
| RUN apt-get update -y && \ | ||
| apt-get install -y build-essential curl git libncurses5-dev && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
|
||
| RUN useradd -ms /bin/bash -d /vim-go vim-go | ||
| USER vim-go | ||
| WORKDIR /vim-go | ||
| COPY . /vim-go/ | ||
|
|
||
| ENTRYPOINT ["make"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,24 @@ | ||
| all: test | ||
| all: install test lint | ||
|
|
||
| install: | ||
| @echo "==> Installing Vims" | ||
| @./scripts/install-vim vim-7.4 | ||
| @./scripts/install-vim vim-8.0 | ||
| @./scripts/install-vim nvim | ||
|
|
||
| test: | ||
| @echo "==> Running tests" | ||
| @./scripts/test.sh | ||
| @./scripts/test vim-7.4 | ||
| @./scripts/test vim-8.0 | ||
| @./scripts/test nvim | ||
|
|
||
| lint: | ||
| @echo "==> Running linting tools" | ||
| @./scripts/lint vim-8.0 | ||
|
|
||
| clean: | ||
| @echo "==> Cleaning /tmp/vim-go-test" | ||
| @rm -rf /tmp/vim-go-test | ||
|
|
||
|
|
||
| .PHONY: all test | ||
| .PHONY: all test install clean lint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Install and setup a Vim or Neovim for running tests. | ||
| # This should work on both Travis and people's desktop computers, and be 100% | ||
| # independent from any system installed Vim. | ||
| # | ||
| # It will echo the full path to a Vim binary, e.g.: | ||
| # /some/path/src/vim | ||
|
|
||
| set -euC | ||
|
|
||
| vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) | ||
| cd "$vimgodir" | ||
|
|
||
| vim=${1:-} | ||
|
|
||
| case "$vim" in | ||
| "vim-7.4") | ||
| # This is what the most recent Ubuntu LTS (16.04) ships with. | ||
| tag="v7.4.1689" | ||
| giturl="https://github.com/vim/vim" | ||
| ;; | ||
|
|
||
| "vim-8.0") | ||
| # This follows the version in Arch Linux. Vim's master branch isn't always | ||
| # stable, and we don't want to have the build fail because Vim introduced a | ||
| # bug. | ||
| tag="v8.0.1176" | ||
| giturl="https://github.com/vim/vim" | ||
| ;; | ||
|
|
||
| "nvim") | ||
| # Use latest stable version. | ||
| tag="v0.2.0" | ||
| giturl="https://github.com/neovim/neovim" | ||
| ;; | ||
|
|
||
| *) | ||
| echo "unknown version: '${1:-}'" | ||
| echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| srcdir="/tmp/vim-go-test/$1-src" | ||
| installdir="/tmp/vim-go-test/$1-install" | ||
|
|
||
| # Use cached installdir. | ||
| if [ -d "$installdir" ]; then | ||
| echo "$installdir exists; skipping build." | ||
|
|
||
| # The ./scripts/test script relies on this. | ||
| echo "installed to: $installdir" | ||
| exit 0 | ||
| fi | ||
|
|
||
| mkdir -p "$srcdir" | ||
| cd "$srcdir" | ||
|
|
||
| # Neovim build requires more deps than Vim and is annoying, so we use the | ||
| # binary. | ||
| # 0.2.0 doesn't have a binary build for Linux, so we use 0.2.1-dev for now. | ||
| if [ "$1" = "nvim" ]; then | ||
|
|
||
| # TODO: Use macOS binaries on macOS | ||
| curl -Ls https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz | | ||
| tar xzf - -C /tmp/vim-go-test/ | ||
| mv /tmp/vim-go-test/nvim-linux64 /tmp/vim-go-test/nvim-install | ||
| mkdir -p "$installdir/share/nvim/runtime/pack/vim-go/start" | ||
| ln -s "$vimgodir" "$installdir/share/nvim/runtime/pack/vim-go/start/vim-go" | ||
|
|
||
| # Consistent paths makes calling things easier. | ||
| mv "$installdir/bin/nvim" "$installdir/bin/vim" | ||
| mkdir -p "$installdir/share/vim/vimgo/pack" | ||
| ln -s "$installdir/share/nvim/runtime/pack/vim-go" "$installdir/share/vim/vimgo/pack/vim-go" | ||
|
|
||
| # Build Vim from source. | ||
| else | ||
| if [ -d "$srcdir/.git" ]; then | ||
| echo "Skipping clone as $srcdir/.git exists" | ||
| else | ||
| echo "Cloning $tag from $giturl" | ||
| git clone --branch "$tag" --depth 1 "$giturl" "$srcdir" | ||
| fi | ||
|
|
||
| ./configure --prefix="$installdir" --with-features=huge --disable-gui | ||
| make install | ||
| mkdir -p "$installdir/share/vim/vimgo/pack/vim-go/start" | ||
| ln -s "$vimgodir" "$installdir/share/vim/vimgo/pack/vim-go/start/vim-go" | ||
| fi | ||
|
|
||
| # Make sure all Go tools and other dependencies are installed. | ||
| export GOPATH=$installdir | ||
| export PATH=${GOPATH}/bin:$PATH | ||
| "$vimgodir/scripts/run-vim" $vim +':silent :GoUpdateBinaries' +':qa' | ||
|
|
||
| [ -d "$installdir/share/vim/vimgo/pack/vim-go/start/vim-vimhelplint" ] || \ | ||
| git clone --depth 1 --quiet https://github.com/machakann/vim-vimhelplint \ | ||
| "$installdir/share/vim/vimgo/pack/vim-go/start/vim-vimhelplint" | ||
|
|
||
| # Don't really need source after successful install. | ||
| rm -rf "$srcdir" | ||
|
|
||
| echo "installed to: $installdir" | ||
|
|
||
| # vim:ts=2:sts=2:sw=2:et |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Run all linting tools. | ||
| # | ||
|
|
||
| set -euC | ||
| vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) | ||
| cd "$vimgodir" | ||
|
|
||
| ### Setup Vim and other dependencies. | ||
| ##################################### | ||
| if [ -z "${1:-}" ]; then | ||
| echo "unknown version: '${1:-}'" | ||
| echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'." | ||
| exit 1 | ||
| fi | ||
|
|
||
| vim=$1 | ||
| vimdir="/tmp/vim-go-test/$vim-install" | ||
| export GOPATH=$vimdir | ||
| export PATH=${GOPATH}/bin:$PATH | ||
|
|
||
| if [ ! -f "$vimdir/bin/vim" ]; then | ||
| echo "$vimdir/bin/vim doesn't exist; did you install it with the install-vim script?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ### Run vimhelplint. | ||
| #################### | ||
| printf "Running vimhelplint ... " | ||
|
|
||
| # set modeline explicitly so that the modeline will be respected when run as root. | ||
| lint=$($vimdir/bin/vim -esNR \ | ||
| --cmd "set rtp+=$vimdir/share/vim/vimgo/pack/vim-go/start/vim-vimhelplint/" \ | ||
| --cmd 'set modeline' \ | ||
| +'filetype plugin on' \ | ||
| +"e $vimgodir/doc/vim-go.txt" \ | ||
| +'verbose VimhelpLintEcho' \ | ||
| +q \ | ||
| 2>&1) | ||
| if [ "$lint" ]; then | ||
| echo "FAILED" | ||
| echo "$lint" | ||
| exit 6 | ||
| else | ||
| echo "PASSED" | ||
| exit 0 | ||
| fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not smart quote hip :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hip, but vimhelplint wasn't in Linux without some particular encodings installed.