├── .gitignore ├── .travis.yml ├── LICENSE.markdown ├── Makefile ├── README.markdown ├── ert-tests └── my-library-test.el ├── my-library.el ├── travis_grid.pl └── travis_grid.png /.gitignore: -------------------------------------------------------------------------------- 1 | /ert-tests/ert.el 2 | *-autoloads.el 3 | *.elc 4 | *~ 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | ### 2 | ### Notes 3 | ### 4 | ### The travis web interface may choke silently and fail to 5 | ### update when there are issues with the .travis.yml file. 6 | ### 7 | ### The "travis-lint" command-line tool does not catch all 8 | ### errors which may lead to silent failure. 9 | ### 10 | ### Shell-style comments in this file must have "#" as the 11 | ### *first* character of the line. 12 | ### 13 | 14 | ### 15 | ### language 16 | ### 17 | 18 | # travis-lint no longer permits this value 19 | # language: emacs-lisp 20 | 21 | ### 22 | ### defining the build matrix 23 | ### 24 | ### ===> <=== 25 | ### ===> each variation in env/matrix will be built and tested <=== 26 | ### ===> <=== 27 | ### 28 | ### variables under env/global are available to the build process 29 | ### but don't cause the creation of a separate variation 30 | ### 31 | 32 | env: 33 | jobs: 34 | # - EMACS=xemacs21 35 | - EMACS=emacs22 36 | - EMACS=emacs23 37 | - EMACS=emacs24 38 | - EMACS=emacs25 39 | - EMACS=emacs-snapshot 40 | global: 41 | - SOME_TOKEN=some_value 42 | 43 | ### 44 | ### allowing build failures 45 | ### 46 | 47 | jobs: 48 | allow_failures: 49 | # - env: EMACS=xemacs21 50 | - env: EMACS=emacs22 51 | - env: EMACS=emacs-snapshot 52 | 53 | ### 54 | ### limit build attempts to defined branches 55 | ### 56 | ### notes 57 | ### 58 | ### This controls which branches are built. 59 | ### 60 | ### You can also control which branches affect the web badge, by 61 | ### appending "?branch=master,staging,production" to the end of the 62 | ### image URL (replacing "master,staging,production" with a 63 | ### comma-separated list of branches to be reflected in the badge). 64 | ### 65 | # 66 | # branches: 67 | # only: 68 | # - master 69 | # 70 | 71 | ### 72 | ### runtime initialization 73 | ### 74 | ### notes 75 | ### 76 | ### emacs22 is extracted manually from Ubuntu Maverick. 77 | ### 78 | ### emacs23 is the stock default, but is updated anyway to 79 | ### a GUI-capable version, which will have certain additional 80 | ### functions compiled in. 81 | ### 82 | ### emacs24 (current stable release) is obtained from the 83 | ### cassou PPA: http://launchpad.net/~cassou/+archive/emacs 84 | ### 85 | ### emacs-snapshot (trunk) is obtained from the Ubuntu Emacs Lisp PPA: 86 | ### https://launchpad.net/~ubuntu-elisp/+archive/ppa 87 | ### For the emacs-snapshot build, bleeding-edge versions 88 | ### of all test dependencies are also used. 89 | ### 90 | 91 | before_install: 92 | - git submodule --quiet update --init --recursive 93 | 94 | install: 95 | # - if [ "$EMACS" = 'xemacs21' ]; then 96 | # sudo apt-get -qq update && 97 | # sudo apt-get -qq -f install && 98 | # sudo apt-get -qq install xemacs21-basesupport xemacs21-basesupport-el xemacs21-supportel xemacs21-support xemacs21-mulesupport-el xemacs21-mulesupport xemacs21-mule-canna-wnn xemacs21-mule-canna-wnn; 99 | # fi 100 | - if [ "$EMACS" = 'emacs22' ]; then 101 | curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22_22.2-0ubuntu9_i386.deb && 102 | curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-bin-common_22.2-0ubuntu9_i386.deb && 103 | curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-common_22.2-0ubuntu9_all.deb && 104 | curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-el_22.2-0ubuntu9_all.deb && 105 | curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-gtk_22.2-0ubuntu9_i386.deb && 106 | sudo apt-get -qq update && 107 | sudo apt-get -qq remove emacs emacs23-bin-common emacs23-common emacs23-nox && 108 | sudo apt-get -qq --fix-missing install install-info emacsen-common libjpeg62:i386 xaw3dg:i386 liblockfile1:i386 libasound2:i386 libgif4:i386 libncurses5:i386 libpng12-0:i386 libtiff4:i386 libxpm4:i386 libxft2:i386 libglib2.0-0:i386 libgtk2.0-0:i386 && 109 | sudo apt-get -qq -f install && 110 | sudo dpkg -i emacs22-common_22.2-0ubuntu9_all.deb emacs22-el_22.2-0ubuntu9_all.deb && 111 | sudo dpkg -i --force-depends emacs22-bin-common_22.2-0ubuntu9_i386.deb && 112 | sudo dpkg -i emacs22_22.2-0ubuntu9_i386.deb emacs22-gtk_22.2-0ubuntu9_i386.deb && 113 | sudo update-alternatives --set emacs22 /usr/bin/emacs22-gtk; 114 | fi 115 | - if [ "$EMACS" = 'emacs23' ]; then 116 | sudo apt-get -qq update && 117 | sudo apt-get -qq -f install && 118 | sudo apt-get -qq install emacs23-gtk emacs23-el; 119 | fi 120 | - if [ "$EMACS" = 'emacs24' ]; then 121 | sudo add-apt-repository -y ppa:cassou/emacs && 122 | sudo apt-get -qq update && 123 | sudo apt-get -qq -f install && 124 | sudo apt-get -qq install emacs24 emacs24-el; 125 | fi 126 | - if [ "$EMACS" = 'emacs25' ]; then 127 | sudo add-apt-repository -y ppa:kelleyk/emacs && 128 | sudo apt-get -qq update && 129 | sudo apt-get -qq -f install && 130 | sudo apt-get -qq install emacs25 emacs25-el; 131 | fi 132 | - if [ "$EMACS" = 'emacs-snapshot' ]; then 133 | sudo add-apt-repository -y ppa:ubuntu-elisp/ppa && 134 | sudo apt-get -qq update && 135 | sudo apt-get -qq -f install && 136 | sudo apt-get -qq install emacs-snapshot && 137 | sudo apt-get -qq install emacs-snapshot-el; 138 | fi 139 | 140 | before_script: 141 | - if [ "$EMACS" = 'emacs-snapshot' ]; then 142 | make downloads-latest; 143 | else 144 | make downloads; 145 | fi 146 | 147 | ### 148 | ### the actual build/test command 149 | ### 150 | ### Use "make test-batch" to test without byte-compiling. 151 | ### The default command avoids byte-compiling on Emacs 22. 152 | ### 153 | 154 | script: 155 | $EMACS --version && ( test "$EMACS" != 'emacs22' && make test EMACS="$EMACS" || make test-batch EMACS="$EMACS" ) 156 | 157 | ### 158 | ### settings 159 | ### 160 | 161 | notifications: 162 | email: false 163 | 164 | # 165 | # Emacs 166 | # 167 | # Local Variables: 168 | # indent-tabs-mode: nil 169 | # coding: utf-8 170 | # End: 171 | # 172 | -------------------------------------------------------------------------------- /LICENSE.markdown: -------------------------------------------------------------------------------- 1 | All code and documentation herein is committed to the public domain, 2 | and is provided without any express or implied warranties. 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | EMACS=emacs 2 | 3 | EMACS_CLEAN=-Q 4 | EMACS_BATCH=$(EMACS_CLEAN) --batch 5 | TESTS= 6 | 7 | CURL=curl --silent 8 | WORK_DIR=$(shell pwd) 9 | PACKAGE_NAME=$(shell basename $(WORK_DIR)) 10 | AUTOLOADS_FILE=$(PACKAGE_NAME)-autoloads.el 11 | TRAVIS_FILE=.travis.yml 12 | TEST_DIR=ert-tests 13 | TEST_DEP_1=ert 14 | TEST_DEP_1_STABLE_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=emacs-24.3 15 | TEST_DEP_1_LATEST_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=master 16 | 17 | .PHONY : build downloads downloads-latest autoloads test-autoloads test-travis \ 18 | test test-interactive clean edit test-dep-1 test-dep-2 test-dep-3 \ 19 | test-dep-4 test-dep-5 test-dep-6 test-dep-7 test-dep-8 test-dep-9 20 | 21 | build : 22 | $(EMACS) $(EMACS_BATCH) --eval \ 23 | "(progn \ 24 | (setq byte-compile-error-on-warn t) \ 25 | (batch-byte-compile))" *.el 26 | 27 | test-dep-1 : 28 | @cd $(TEST_DIR) && \ 29 | $(EMACS) $(EMACS_BATCH) -L . -L .. -l $(TEST_DEP_1) || \ 30 | (echo "Can't load test dependency $(TEST_DEP_1).el, run 'make downloads' to fetch it" ; exit 1) 31 | 32 | downloads : 33 | $(CURL) '$(TEST_DEP_1_STABLE_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el 34 | 35 | downloads-latest : 36 | $(CURL) '$(TEST_DEP_1_LATEST_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el 37 | 38 | autoloads : 39 | $(EMACS) $(EMACS_BATCH) --eval \ 40 | "(progn \ 41 | (setq generated-autoload-file \"$(WORK_DIR)/$(AUTOLOADS_FILE)\") \ 42 | (update-directory-autoloads \"$(WORK_DIR)\"))" 43 | 44 | test-autoloads : autoloads 45 | @$(EMACS) $(EMACS_BATCH) -L . -l "./$(AUTOLOADS_FILE)" || \ 46 | ( echo "failed to load autoloads: $(AUTOLOADS_FILE)" && false ) 47 | 48 | test-travis : 49 | @if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi 50 | 51 | test : build test-dep-1 test-autoloads 52 | @cd $(TEST_DIR) && \ 53 | (for test_lib in *-test.el; do \ 54 | $(EMACS) $(EMACS_BATCH) -L . -L .. -l cl -l $(TEST_DEP_1) -l $$test_lib --eval \ 55 | "(progn \ 56 | (fset 'ert--print-backtrace 'ignore) \ 57 | (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))" || exit 1; \ 58 | done) 59 | 60 | clean : 61 | @rm -f $(AUTOLOADS_FILE) *.elc *~ */*.elc */*~ $(TEST_DIR)/$(TEST_DEP_1).el \ 62 | $(TEST_DIR)/$(TEST_DEP_2).el $(TEST_DIR)/$(TEST_DEP_3).el $(TEST_DIR)/$(TEST_DEP_4).el \ 63 | $(TEST_DIR)/$(TEST_DEP_5).el $(TEST_DIR)/$(TEST_DEP_6).el $(TEST_DIR)/$(TEST_DEP_7).el \ 64 | $(TEST_DIR)/$(TEST_DEP_8).el $(TEST_DIR)/$(TEST_DEP_9).el 65 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Overview 2 | ======== 3 | 4 | Travis CI recipe for Emacs libraries. 5 | 6 | ![Travis Grid](https://raw.github.com/rolandwalker/emacs-travis/master/travis_grid.png) 7 | 8 | Quickstart 9 | ---------- 10 | 11 | * Add the included .travis.yml and Makefile to your Emacs project on GitHub. 12 | 13 | * Adapt the `make test` target to your taste. 14 | 15 | * Create an account on http://travis-ci.org, and follow the instructions 16 | there to enable builds. 17 | 18 | * Edit travis_grid.pl to match your account if desired. 19 | 20 | * Add `[![Build Status](https://secure.travis-ci.org/my-github-id/my-library.png?branch=master,staging,production)](http://travis-ci.org/my-github-id/my-library)` 21 | to your Markdown README file. 22 | 23 | .travis.yml 24 | ----------- 25 | 26 | The .travis.yml file included here supports 27 | 28 | Emacs 22 29 | Emacs 23 30 | Emacs 24 (stable) 31 | Emacs 24 (snapshot) 32 | 33 | By default, the Emacs 23 and 24 environments are expected to build and test 34 | your library successfully. Emacs 22 and Emacs 24 (snapshot) are permitted 35 | to fail. See the `allow_failures:` section to change this. 36 | 37 | It is not required to use the included example Makefile, but the .travis.yml 38 | file expects working targets for `make test` and `make downloads`. (The 39 | `downloads` target fetches dependencies needed to run tests.) You must 40 | either 41 | 42 | 1. provide these targets, or 43 | 2. replace the `make` commands in .travis.yml with new build/test commands. 44 | See the `script` and `before_script` sections. The `before-script` may be 45 | removed entirely. 46 | 47 | Notes 48 | ----- 49 | 50 | An XEmacs 21 runtime is also included, but commented out. The included 51 | Makefile and test frameworks are also not compatible with XEmacs. 52 | 53 | See Also 54 | -------- 55 | 56 | [http://about.travis-ci.org/docs/user/build-configuration/](http://about.travis-ci.org/docs/user/build-configuration/) 57 | [http://about.travis-ci.org/docs/user/status-images/](http://about.travis-ci.org/docs/user/status-images/) 58 | -------------------------------------------------------------------------------- /ert-tests/my-library-test.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; 3 | ;;; this is a stub to go with a .travis.yml example 4 | ;;; 5 | 6 | (require 'my-library) 7 | 8 | ;;; interactive 9 | 10 | (ert-deftest interactive-test-01 nil 11 | "This test should not run on Travis" 12 | :tags '(:interactive) 13 | (should t)) 14 | 15 | ;;; noninteractive 16 | 17 | (ert-deftest has-feature-01 nil 18 | "This test should run on Travis" 19 | (should (featurep 'my-library))) 20 | 21 | ;; 22 | ;; Emacs 23 | ;; 24 | ;; Local Variables: 25 | ;; indent-tabs-mode: nil 26 | ;; coding: utf-8 27 | ;; End: 28 | ;; 29 | 30 | ;;; my-library-test.el ends here 31 | -------------------------------------------------------------------------------- /my-library.el: -------------------------------------------------------------------------------- 1 | ;;; my-library.el --- description of my library 2 | ;; 3 | ;; Copyright 4 | ;; 5 | ;; Author: 6 | ;; Homepage: 7 | ;; URL: 8 | ;; Version: 9 | ;; Last-Updated: 10 | ;; EmacsWiki: 11 | ;; Keywords: 12 | ;; 13 | ;; License 14 | ;; 15 | ;;; Commentary: 16 | ;; 17 | ;;; License 18 | ;; 19 | ;;; Code: 20 | ;; 21 | 22 | ;;; 23 | ;;; this is a stub to go with a .travis.yml example 24 | ;;; 25 | 26 | (defun my-library-function () 27 | "A function in my library." 28 | t) 29 | 30 | (provide 'my-library) 31 | 32 | ;; 33 | ;; Emacs 34 | ;; 35 | ;; Local Variables: 36 | ;; indent-tabs-mode: nil 37 | ;; coding: utf-8 38 | ;; byte-compile-warnings: (not cl-functions) 39 | ;; End: 40 | ;; 41 | 42 | ;;; my-library.el ends here 43 | -------------------------------------------------------------------------------- /travis_grid.pl: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl 2 | # 3 | # travis_grid.pl 4 | # 5 | # Quickie script to print the Travis build status for individual 6 | # Emacs runtimes across all of your libraries. 7 | # 8 | # How to use 9 | # 10 | # 1. Add your travis username where indicated in $travis_api_base 11 | # and $travis_browser_base 12 | # 13 | # 2. Add all desired repository names below __DATA__ 14 | # 15 | 16 | ### 17 | ### pragmas 18 | ### 19 | 20 | use strict; 21 | # use warnings; 22 | # no warnings qw/uninitialized numeric/; 23 | # no indirect; 24 | # use criticism; 25 | # ## no critic (SubroutinePrototypes MutatingListFunctions ExplicitReturnUndef ProhibitStringyEval) 26 | 27 | use encoding::warnings 'FATAL'; 28 | use utf8; 29 | use feature 'unicode_strings'; # perl 5.14+ 30 | use open ':utf8'; # not :encoding(utf8), which is currently incompatible with fork() 31 | use open ':std'; 32 | 33 | ### 34 | ### version 35 | ### 36 | 37 | our $VERSION = '0.001_001'; 38 | $VERSION = eval $VERSION; 39 | 40 | ### 41 | ### modules 42 | ### 43 | 44 | use LWP::Simple; 45 | use Term::ANSIColor; 46 | use JSON; 47 | 48 | ### 49 | ### configurable file-scoped lexical variables 50 | ### 51 | 52 | my $travis_api_base = "https://api.travis-ci.org/repos/YOUR_USER_NAME_HERE"; 53 | my $travis_browser_base = "http://travis-ci.org/YOUR_USER_NAME_HERE"; 54 | 55 | ### 56 | ### argument processing 57 | ### 58 | 59 | die "unknown arguments\n" if @ARGV; 60 | 61 | ### 62 | ### initialization 63 | ### 64 | 65 | # unbuffered output 66 | select STDERR; local $|=1; 67 | select STDOUT; local $|=1; 68 | 69 | my @repos; 70 | my $longest_repo; 71 | while () { 72 | s{#.*}{}; 73 | next unless m{\S}; 74 | s{\s+}{}; 75 | push @repos, $_; 76 | $longest_repo = length $_ if length $_ > $longest_repo; 77 | } 78 | 79 | die "add your username to the \$travis_api_base variable\n" if $travis_api_base =~ m/YOUR_USER_NAME/; 80 | die "add your username to the \$travis_browser_base variable\n" if $travis_browser_base =~ m/YOUR_USER_NAME/; 81 | die "add some repository names below the __DATA__ line\n" unless @repos; 82 | 83 | ### 84 | ### main program 85 | ### 86 | 87 | foreach my $repo (@repos) { 88 | my $json = get "${travis_api_base}/${repo}.json" or die "fetch failed in $repo\n"; 89 | $json = from_json $json; 90 | my $status = $json->{last_build_status}; 91 | print $repo; 92 | print ' ' x (1 + $longest_repo - (length $repo)); 93 | if ($status eq "0") { 94 | print ((color "bold green"), "success", (color "reset")); 95 | } elsif ($status > 0) { 96 | print ((color "bold red"), "failure", (color "reset")); 97 | } else { 98 | print ((color "white"), "unknown", (color "reset")); 99 | } 100 | if (($status eq "0") or $status > 0) { 101 | my $build_id = $json->{last_build_id}; 102 | $json = get "${travis_api_base}/${repo}/builds/${build_id}.json" or die "fetch failed in $repo\n"; 103 | $json = from_json $json; 104 | print " |"; 105 | foreach my $m (reverse @{$json->{matrix}}) { 106 | my $emacs = $m->{config}->{env}; 107 | unless ($emacs =~ s{\A.*?EMACS=([^\s]+).*?\Z}{$1}) { 108 | die "failed to read JSON for repo $repo\n"; 109 | } 110 | if ($m->{result} eq "0") { 111 | print ((color "bold green"), " ", $emacs, (color "reset")); 112 | } else { 113 | print ((color "bold red"), " ", $emacs, (color "reset")); 114 | } 115 | if ($status > 0) { 116 | print ((color "bold red"), " -- $travis_browser_base/$repo", (color "reset")); 117 | } 118 | } 119 | print "\n"; 120 | } 121 | } 122 | 123 | __DATA__ 124 | # list 125 | # repository 126 | # names 127 | # one 128 | # per 129 | # line 130 | -------------------------------------------------------------------------------- /travis_grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rolandwalker/emacs-travis/d782daae884487107b053507c79049368b0d5dd2/travis_grid.png --------------------------------------------------------------------------------