Skip to content

Commit

Permalink
travisci -> circleci + local concurrent test runner (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktasia authored Mar 15, 2019
1 parent 7c0d61e commit 59f91b4
Show file tree
Hide file tree
Showing 12 changed files with 496 additions and 37 deletions.
77 changes: 77 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: 2
aliases:
- &job_config
docker:
- image: jacktasia/dumb-jump-test-runner:v3
environment:
EVM_EMACS: $EVM_EMACS
COVERALLS_REPO_TOKEN: $COVERALLS_REPO_TOKEN

working_directory: /home/travis/dumb-jump

steps:
- checkout
- run: echo "$EVM_EMACS" > ~/EVM_EMACS.txt
- restore_cache:
keys:
- v1-dj-cache-evm-{{ checksum "~/EVM_EMACS.txt" }}
- run: evm install $EVM_EMACS --use --skip
- save_cache:
key: v1-dj-cache-evm-{{ checksum "~/EVM_EMACS.txt" }}
paths:
- /home/travis/.evm/
# cask
- restore_cache:
keys:
- v1-dj-cache-{{ checksum "~/EVM_EMACS.txt" }}
- run: cask
- save_cache:
key: v1-dj-cache-{{ checksum "~/EVM_EMACS.txt" }}
paths:
- .cask/

- run:
name: Run Tests
command: bash test/circleci-runner.sh

jobs:
"emacs-24.3-travis":
environment:
EVM_EMACS: "emacs-24.3-travis"
<<: *job_config

"emacs-24.4-travis":
environment:
EVM_EMACS: "emacs-24.4-travis"
<<: *job_config

"emacs-24.5-travis":
environment:
EVM_EMACS: "emacs-24.5-travis"
<<: *job_config

"emacs-25.1-travis":
environment:
EVM_EMACS: "emacs-25.1-travis"
<<: *job_config

"emacs-25.2-travis":
environment:
EVM_EMACS: "emacs-25.2-travis"
<<: *job_config

"emacs-26.1-travis":
environment:
EVM_EMACS: "emacs-26.1-travis"
<<: *job_config

workflows:
version: 2
build:
jobs:
- "emacs-24.3-travis"
- "emacs-24.4-travis"
- "emacs-24.5-travis"
- "emacs-25.1-travis"
- "emacs-25.2-travis"
- "emacs-26.1-travis"
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,22 @@ unit:

install:
${CASK} install

test-concurrent:
cask
@go run test/ert_runner.go -p ".*-ag-.*" -p ".*-rg-.*" test/dumb-jump-test.el

test-go:
@go test ./... -v

docker-build-test-runner:
docker build . -t jacktasia/dumb-jump-test-runner:v3 -f test/Dockerfile

docker-push-test-runner:
docker push jacktasia/dumb-jump-test-runner:v3

test-all-in-docker:
@bash test/run-local-in-docker.sh all

test-in-docker:
@bash test/run-local-in-docker.sh current
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dumb-jump

[![Join the chat at https://gitter.im/jacktasia/dumb-jump](https://badges.gitter.im/jacktasia/dumb-jump.svg)](https://gitter.im/jacktasia/dumb-jump?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/jacktasia/dumb-jump.svg)](https://travis-ci.org/jacktasia/dumb-jump) [![Coverage Status](https://coveralls.io/repos/jacktasia/dumb-jump/badge.svg?branch=master&service=github&x=1)](https://coveralls.io/github/jacktasia/dumb-jump?branch=master) [![MELPA](http://melpa.org/packages/dumb-jump-badge.svg?x=6)](http://melpa.org/#/dumb-jump) [![MELPA Stable](https://stable.melpa.org/packages/dumb-jump-badge.svg?x=1)](https://stable.melpa.org/#/dumb-jump)
[![Join the chat at https://gitter.im/jacktasia/dumb-jump](https://badges.gitter.im/jacktasia/dumb-jump.svg)](https://gitter.im/jacktasia/dumb-jump?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![CircleCI](https://circleci.com/gh/jacktasia/dumb-jump/tree/master.svg?style=svg)](https://circleci.com/gh/jacktasia/dumb-jump/tree/master) [![Coverage Status](https://coveralls.io/repos/jacktasia/dumb-jump/badge.svg?branch=master&service=github&x=1)](https://coveralls.io/github/jacktasia/dumb-jump?branch=master) [![MELPA](http://melpa.org/packages/dumb-jump-badge.svg?x=6)](http://melpa.org/#/dumb-jump) [![MELPA Stable](https://stable.melpa.org/packages/dumb-jump-badge.svg?x=1)](https://stable.melpa.org/#/dumb-jump)

![Dumb Jump GIF](media/dumb-jump-example-v2.gif?raw=true)

Expand All @@ -9,7 +9,7 @@


#### How it works
Dumb Jump uses [The Silver Searcher](https://github.com/ggreer/the_silver_searcher) `ag`, [ripgrep](https://github.com/BurntSushi/ripgrep) `rg`, or `grep` to find potential definitions of a function or variable under point. It uses a set of regular expressions based on the file extension, or `major-mode`, of the current buffer. The matches are run through a shared set of heuristic methods to find the best candidate to jump to. If it can't decide it will present the user with a list in a pop-menu.
Dumb Jump uses [The Silver Searcher](https://github.com/ggreer/the_silver_searcher) `ag`, [ripgrep](https://github.com/BurntSushi/ripgrep) `rg`, or `grep` to find potential definitions of a function or variable under point. It uses a set of regular expressions based on the file extension, or `major-mode`, of the current buffer. The matches are run through a shared set of heuristic methods to find the best candidate to jump to. If it can't decide it will present the user with a list in a pop-menu, helm, or ivy (see `dumb-jump-selector`).

#### Success Rate
For the currently [supported languages](#supported-languages) it seems to do a good job of finding what you want. If you find a case where it does not work as expected do not hesitate to [open an issue](https://github.com/jacktasia/dumb-jump/issues). It can be slow if it needs to use `grep` and/or a project is large. Although it can be sped up by [installing `ag`](https://github.com/ggreer/the_silver_searcher#installing) or [installing `rg`](https://github.com/BurntSushi/ripgrep#installation) and/or creating a `.dumbjump` file in your project's root directory with paths that should be excluded ([see configuration](#configuration)).
Expand Down Expand Up @@ -182,14 +182,46 @@ I wanted "jump to definition" functionality to "just work" in emacs. I use Intel
Feedback is very welcome via GitHub issues. I will consider supporting other languages either via issue request or PR. If submitting a PR then please add tests as well.

## Running Tests
Requires [Cask](https://github.com/cask/cask).

Opening a PR will use CircleCI to run all the tests against all the supported emacs versions and search programs.

### Running tests locally

There are a lot of options for running the tests locally:

#### Basic/Classic
requires [Cask](https://github.com/cask/cask) using your local emacs
```sh
cd /path/to/dumb-jump
cask
make test
```

#### Concurrent
requires golang and [Cask](https://github.com/cask/cask) using your local emacs
```sh
cd /path/to/dumb-jump
cask
make test-concurrent
```

#### Docker (latest emacs)
only requires docker and runs tests against emacs 26.1
```sh
cd /path/to/dumb-jump
cask
make test-in-docker
```

#### Docker (all supported emacs versions)
only requires docker and runs tests against all supported emacs versions
```sh
cd /path/to/dumb-jump
cask
make test-all-in-docker
```


## Alternatives

Here is a list of potential alternative packages for emacs:
Expand Down
7 changes: 0 additions & 7 deletions TODO.org

This file was deleted.

2 changes: 1 addition & 1 deletion dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ or most optimal searcher."
:regex "(^|\\W)alias(_method)?\\W+JJJ(\\W|$)"
:tests ("alias test some_method"
"alias_method :test, :some_method"
"alias_method test’ ’some_method"
"alias_method 'test' 'some_method'"
"some_class.send(:alias_method, :test, :some_method)")
:not ("alias some_method test"
"alias_method :some_method, :test"
Expand Down
24 changes: 24 additions & 0 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:14.04

RUN apt-get -qq update || ls
RUN apt-get install -y --no-install-recommends software-properties-common curl && rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true
RUN add-apt-repository ppa:gekkio/ag -y
RUN add-apt-repository ppa:git-core/ppa -y
RUN apt-get -qq update || ls
RUN apt-get install -y --no-install-recommends silversearcher-ag git python ruby && rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true
RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep_0.10.0_amd64.deb && sudo dpkg -i ripgrep_0.10.0_amd64.deb && rm ripgrep_0.10.0_amd64.deb && rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true
ENV PATH="/root/.evm/bin:$PATH"
ENV PATH="/root/.cask/bin:$PATH"
ENV EVM_EMACS=emacs-24.3-travis

RUN git clone https://github.com/rejeep/evm.git /root/.evm
RUN evm config path /tmp
RUN evm install emacs-24.3-travis --use --skip
RUN curl -fsSkL https://raw.github.com/cask/cask/master/go | python

RUN evm install $EVM_EMACS --use --skip

RUN apt-get install -y --no-install-recommends make libgtk2.0-0 libsm-dev && rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true

ADD test/circleci-runner.sh circleci-runner.sh
ENTRYPOINT ["bash", "circleci-runner.sh"]
17 changes: 17 additions & 0 deletions test/circleci-runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

source /root/.bashrc

evm install $EVM_EMACS --use --skip # should be a noop when cache

PATH="/root/.evm/bin:$PATH"
export PATH="/root/.cask/bin:$PATH"
rg --version
ag --version
grep --version
emacs --version
git --version
pwd
cd /home/travis/dumb-jump
cask install
make test
1 change: 0 additions & 1 deletion test/dumb-jump-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
(require 'noflet)
(require 'el-mock)
(require 'popup)

;;; Code:

(defun dumb-jump-output-rule-test-failures (failures)
Expand Down
Loading

0 comments on commit 59f91b4

Please sign in to comment.