]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Use Docker for easier test running (#86)
authorDaniel Hahler <github@thequod.de>
Sat, 21 Jul 2018 07:02:47 +0000 (09:02 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Jul 2018 07:02:47 +0000 (09:02 +0200)
Switches to CircleCI instead of Travis, which handles running tests in
Docker much better, especially since Travis is really slow (~30min vs
2.5min on CircleCI).

The Docker image is based on
https://github.com/tweekmonster/vim-testbed, and targets are added to
the Makefile to build/push it.

.circleci/config.yml [new file with mode: 0644]
.dockerignore [new file with mode: 0644]
.travis.yml [deleted file]
CONTRIBUTING.rst
Dockerfile [new file with mode: 0644]
Makefile
docker-compose.yml [new file with mode: 0644]

diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644 (file)
index 0000000..bc0bd36
--- /dev/null
@@ -0,0 +1,31 @@
+version: 2
+
+jobs:
+  test:
+    docker:
+      - image: blueyed/vim-python-pep8-indent-vims-for-test:1@sha256:8c77867e1fdf673a6df0ecf6628f8e4d80579a0a097ec196109ca0bc145d86c0
+    steps:
+      - checkout
+      - run:
+          name: Run tests
+          command: |
+            Xvfb :99 &
+            DISPLAY=:99 VIMRUNNER_REUSE_SERVER=1 rspec spec
+
+  checkqa:
+    docker:
+      - image: circleci/python:3.7
+    steps:
+      - checkout
+      - run:
+          name: Lint
+          command: |
+            pip install --user vim-vint
+            ~/.local/bin/vint **/*.vim
+
+workflows:
+  version: 2
+  test:
+    jobs:
+      - test
+      - checkqa
diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..8a03768
--- /dev/null
@@ -0,0 +1,4 @@
+*
+!Gemfile
+!indent
+!spec
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 9c9641c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-language: ruby
-dist: trusty
-sudo: false
-cache: bundler
-addons:
-  apt:
-    packages:
-      - vim-gtk
-branches:
-  only:
-    - master
-before_script:
-  - vim --version
-script:
-  - make test
index 8e1fc2f52809da5f298e548276e9feeb3fce9ec4..2c59e4109f9459d0faec06d1108361e677c299ec 100644 (file)
@@ -20,6 +20,14 @@ Running Tests
 - Run the tests with the command::
 
    $ rspec spec
+- Alternatively you can use Docker::
+
+   $ make test_docker
+
+- You can select tests based on line numbers, e.g.::
+
+   $ rspec ./spec/indent/indent_spec.rb:385
+   $ make test_docker RSPEC_ARGS=./spec/indent/indent_spec.rb:385
 
 Thank you for considering to contribute!
 
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..ce08f9d
--- /dev/null
@@ -0,0 +1,19 @@
+FROM testbed/vim:latest
+
+RUN apk --no-cache add gtk+2.0-dev libx11-dev libxt-dev mcookie xauth xvfb
+RUN install_vim -tag master --with-features=normal \
+  --disable-channel --disable-netbeans --disable-xim \
+  --enable-gui=gtk2 --with-x -build
+RUN ln -s /vim-build/bin/vim-master /usr/bin/gvim
+RUN gvim --version
+
+WORKDIR /vim-python-pep8-indent
+
+ADD Gemfile .
+RUN apk --no-cache add coreutils ruby-bundler
+RUN bundle install
+
+ADD indent ./indent
+ADD spec ./spec
+
+ENTRYPOINT ["rspec", "spec"]
index 5099a58c63adf1b6e48d5d863a1977bbc31f1fef..874c7ede58b101676d6dc951ec7759181ec30005 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,3 +6,23 @@ test_slow:
 
 test_visible:
        VIMRUNNER_REUSE_SERVER=1 bundle exec rspec
+
+# Run tests in dockerized Vims.
+DOCKER_REPO:=blueyed/vim-python-pep8-indent-vims-for-test
+DOCKER_TAG:=1
+DOCKER_IMAGE:=$(DOCKER_REPO):$(DOCKER_TAG)
+
+docker_image:
+       docker build -t $(DOCKER_REPO):$(DOCKER_TAG) .
+docker_push:
+       docker push $(DOCKER_REPO):$(DOCKER_TAG)
+docker_update_latest:
+       docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REPO):latest
+       docker push $(DOCKER_REPO):latest
+
+test_docker: XVFB_ERRORFILE:=/dev/null
+test_docker:
+       @set -x; export DISPLAY=$(if $(VIMRUNNER_TEST_DISPLAY),$(VIMRUNNER_TEST_DISPLAY),172.17.0.1:99; Xvfb -ac -listen tcp :99 >$(XVFB_ERRORFILE) 2>&1 & XVFB_PID=$$!); \
+         docker run --rm -ti -e DISPLAY -e VIMRUNNER_REUSE_SERVER=1 \
+         -v $(CURDIR):/vim-python-pep8-indent $(DOCKER_IMAGE) $(RSPEC_ARGS) \
+         $(if $(VIMRUNNER_TEST_DISPLAY),,; ret=$$?; kill $$XVFB_PID; exit $$ret)
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..71760c2
--- /dev/null
@@ -0,0 +1,6 @@
+version: '2'
+services:
+  rspec:
+    build: .
+    volumes:
+    - .:/vim-python-pep8-indent