Skip to content

Commit de8ddba

Browse files
committed
Add CI and docker build
1 parent e3650d9 commit de8ddba

File tree

6 files changed

+44
-5
lines changed

6 files changed

+44
-5
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git

.travis.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: minimal
2+
3+
services:
4+
- docker
5+
6+
before_install:
7+
- docker build -t jsks/czhttpd .
8+
9+
script:
10+
- docker run jsks/czhttpd make
11+
12+
after_success:
13+
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
14+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
15+
docker push jsks/czhttpd;
16+
fi

Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM zshusers/zsh-master
2+
3+
RUN rm -rf /usr/share/zsh/*/scripts/newuser
4+
RUN install_packages make
5+
6+
RUN groupadd czhttpd \
7+
&& useradd -m -g czhttpd -d /home/czhttpd -s /sbin/nologin czhttpd
8+
USER czhttpd
9+
10+
ENV APP=/home/czhttpd/src
11+
RUN mkdir -p $APP/modules/ $APP/test/
12+
COPY --chown=czhttpd:czhttpd czhttpd Makefile $APP/
13+
COPY --chown=czhttpd:czhttpd modules/ $APP/modules/
14+
COPY --chown=czhttpd:czhttpd test/ $APP/test/
15+
16+
WORKDIR $APP
17+
RUN make clean
18+
19+
CMD ["zsh", "czhttpd", "-v"]

test/integration/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
for i in datetime pcre stat system; zmodload zsh/$i || exit 127
1212

13-
setopt err_return rematch_pcre
13+
setopt rematch_pcre
1414

1515
typeset -gA STATS
1616
STATS[count]=0

test/stress/stress.sh

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ if [[ -t 1 ]] && (( $terminfo[colors] >= 8 )); then
99
colors
1010
fi
1111

12-
setopt err_return
13-
1412
which vegeta >/dev/null || error "Missing vegeta, unable to run stress tests"
1513

1614
typeset -g VEGETA_OPTS VERBOSE DURATION

test/utils.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Utility functions/variables for testing czhttpd
22
###
33

4-
setopt local_options
4+
setopt err_return local_options
55

66
typeset -g SRC_DIR TESTTMP TESTROOT CONF PORT
77

@@ -68,6 +68,9 @@ function reload_conf() {
6868
}
6969

7070
function cleanup() {
71+
# Return value of previous command before trap was triggered
72+
private rv=$?
73+
7174
setopt noerr_return
7275
stop_server
7376

@@ -76,6 +79,8 @@ function cleanup() {
7679
[[ -d "/tmp/cztest-$$" ]] && rm -rf "/tmp/cztest-$$"
7780

7881
rm -rf $SRC_DIR/.czhttpd-pid
82+
83+
return $rv
7984
}
8085

81-
trap "cleanup; exit" INT TERM KILL EXIT ZERR
86+
trap "cleanup" INT TERM KILL EXIT

0 commit comments

Comments
 (0)