Navigation Menu

Skip to content

Commit

Permalink
Configure Travis-Ci to build against OS X (10.11, xcode 7.3) (#365)
Browse files Browse the repository at this point in the history
Build zsh versions: master, 5.3, 5.2, 5.1, 5.0.0, 4.3.17, 4.3.5 (4.3.5 only linux)
  • Loading branch information
desyncr committed Dec 17, 2016
1 parent f4c1059 commit fefbd02
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
# Running tests creates this completion dump file.
tests/.zcompdump
tests/.zcompdump*

# Test failure reports
tests/*.t.err
Expand Down
71 changes: 57 additions & 14 deletions .travis.yml
@@ -1,5 +1,4 @@
# Using python for running the tests, using the `cram` test framework.
language: python
sudo: false

# Python version to run tests with.
python:
Expand All @@ -20,14 +19,53 @@ env:
- ZSH_REMOTE_URL=https://github.com/zsh-users/zsh.git
- BUILDS_PATH=$HOME/.zsh-builds
- ZSH_SOURCE=$HOME/zsh
matrix:
- ZSH_BUILD_VERSION=master
- ZSH_BUILD_VERSION=zsh-5.3
- ZSH_BUILD_VERSION=zsh-5.2
- ZSH_BUILD_VERSION=zsh-5.1
- ZSH_BUILD_VERSION=zsh-5.0.0
- ZSH_BUILD_VERSION=zsh-4.3.17
- ZSH_BUILD_VERSION=zsh-4.3.5

matrix:
include:
- os: linux
language: python
env: ZSH_BUILD_VERSION=master
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-5.3
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-5.2
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-5.1
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-5.0.0
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-4.3.17
- os: linux
language: python
env: ZSH_BUILD_VERSION=zsh-4.3.5

- os: osx
language: generic
env: ZSH_BUILD_VERSION=master
- os: osx
language: generic
env: ZSH_BUILD_VERSION=zsh-5.3
- os: osx
language: generic
env: ZSH_BUILD_VERSION=zsh-5.2
- os: osx
language: generic
env: ZSH_BUILD_VERSION=zsh-5.1
- os: osx
language: generic
env: ZSH_BUILD_VERSION=zsh-5.0.0
- os: osx
language: generic
env: ZSH_BUILD_VERSION=zsh-4.3.17
# zsh 4.3.5 fails on OS X. See https://travis-ci.org/zsh-users/antigen/jobs/184819719
#- os: osx
#language: generic
#env: ZSH_BUILD_VERSION=zsh-4.3.5

install:
# Install python requirements.
Expand All @@ -36,20 +74,25 @@ install:
# Install zsh versions from source.
- "./tests/build-zsh.sh $ZSH_BUILD_VERSION $BUILDS_PATH $ZSH_SOURCE"

before_script:
before_install:
# Show system information
- "uname -a"

# Show the git version being used to test.
- "git --version"

before_script:
# Show zsh version being deployed.
- "$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh --version"

# Test config for git.
- "git config --global user.name test"
- "git config --global user.email test@test.test"

# Show zsh version being deployed.
- "$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh --version"

# Run the tests.
script:
- "make tests PYENV= SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh"
- "make stats _ANTIGEN_CACHE_ENABLED=false _ANTIGEN_INIT_ENABLED=false SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh"
- "make stats _ANTIGEN_CACHE_ENABLED=true _ANTIGEN_INIT_ENABLED=false SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh"
- "make stats _ANTIGEN_CACHE_ENABLED=true _ANTIGEN_INIT_ENABLED=true SHELL=$BUILDS_PATH/$ZSH_BUILD_VERSION/zsh"

2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -70,6 +70,6 @@ deps:
pip install cram==0.6.*

stats:
${PROJECT}/tests/stats.sh "${PROJECT}" "${SHELL}"
"${SHELL}" ${PROJECT}/tests/stats.sh "${PROJECT}" "${SHELL}"

all: clean build install
13 changes: 13 additions & 0 deletions tests/.zshenv
Expand Up @@ -51,3 +51,16 @@ echo 'alias unsourced-alias="echo unsourced-alias"' > "$PLUGIN_DIR2"/aliases.zsh
pg2 add .
pg2 commit -m 'Initial commit'
} > /dev/null

# Wrapper around \wc command to handle wc format differences between GNU and BSD
# GNU:
# echo 1 | wc -l
# 1
# BSD:
# echo 1 | wc -l
# 1
#
# Using this wrapper output from both implementations resembles GNU's.
function wc () {
command wc "$@" | xargs
}
2 changes: 1 addition & 1 deletion tests/build-zsh.sh
Expand Up @@ -43,7 +43,7 @@ git checkout $ZSH_VERSION
./Util/preconfig

# Configure bindir for this branch
./configure --bindir=$BUILDS_PATH/$ZSH_VERSION --prefix=$BUILDS_PATH/$ZSH_VERSION
./configure --bindir=$BUILDS_PATH/$ZSH_VERSION --prefix=$BUILDS_PATH/$ZSH_VERSION --without-tcsetpgrp

# Make
make -j5
Expand Down
4 changes: 2 additions & 2 deletions tests/bundle.t
Expand Up @@ -27,7 +27,7 @@ Try to install an unexisting bundle.
$ antigen-bundle https://127.0.0.1/bundle/unexisting.git
Installing bundle/unexisting... Error! See * (glob)
[1]
$ echo $fpath | grep -Pco test-plugin
$ echo $fpath | grep -co test-plugin
1

Confirm there is still only one repository.
Expand All @@ -50,7 +50,7 @@ The alias defined in the other zsh file should not be available.

Fpath should be updated correctly.

$ echo ${(j:\n:)fpath} | grep -Pco test-plugin
$ echo ${(j:\n:)fpath} | grep -co test-plugin
2

Load plugin multiple times, doesn't cluters _ANTIGEN_BUNDLE_RECORD
Expand Down
10 changes: 5 additions & 5 deletions tests/cache.t
Expand Up @@ -61,13 +61,13 @@ Cache is saved correctly.
$ cat $_ZCACHE_PAYLOAD_PATH | wc -l
24
$ cat $_ZCACHE_PAYLOAD_PATH | grep -Pzc 'hehe2"\nalias prompt'
$ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'alias prompt'
1
$ cat $_ZCACHE_PAYLOAD_PATH | grep -Pc 'root=\${__ZCACHE_FILE_PATH}'
$ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'root=\${__ZCACHE_FILE_PATH}'
1
$ cat $_ZCACHE_PAYLOAD_PATH | grep -Pc 'echo \$root/\$0'
$ cat $_ZCACHE_PAYLOAD_PATH | grep -c 'echo \$root/\$0'
1
Cache is invalidated on antigen configuration changes.
Expand Down Expand Up @@ -95,8 +95,8 @@ Cache is invalidated on antigen configuration changes.
Cache version matches antigen version.
$ ANTIGEN_VERSION=$(antigen version | sed 's/Antigen //')
$ cat $_ZCACHE_PAYLOAD_PATH | grep -Pzc "$ANTIGEN_VERSION"
1
$ cat $_ZCACHE_PAYLOAD_PATH | grep -c "$ANTIGEN_VERSION"
2
$ if [[ "$ANTIGEN_VERSION" == "$_ZCACHE_CACHE_VERSION" ]]; then echo 1; else echo 0; fi
1
Expand Down
9 changes: 5 additions & 4 deletions tests/stats.sh
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/zsh
PROJECT=${1:-$HOME}
SHELL=${2:-zsh}
ZSHRC=$HOME/.zshrc
Expand All @@ -11,12 +11,13 @@ cp $ZSHRC $TMP

cp $PROJECT/tests/.zshrc $HOME/.zshrc
eval $CMD

for x in $(seq 1 20); do
/usr/bin/time -f "real %e user %U sys %S" -a -o $MTIME $CMD
(eval time $CMD) &>> $MTIME
tail -1 $MTIME
done
done

awk '{ et += $2; ut += $4; st += $6; count++ } END { printf "\nAverage:\nreal %.3f user %.3f sys %.3f\n", et/count, ut/count, st/count }' $MTIME
awk '{ total += $10; user += $4; sys += $6; count++ } END { printf "\nAverage:\ntotal %.3fs user %.3fs sys %.3fs\n", total/count, user/count, sys/count }' $MTIME

rm -f $MTIME
cp $TMP $ZSHRC

0 comments on commit fefbd02

Please sign in to comment.