stages:
- build
- test
+ - deploy
# build advent itself
binary:
artifacts:
paths:
- advent
+ - "*.gcda"
+ - "*.gcno"
# cache outputs to reduce the build time
cache:
paths:
stage: test
before_script:
- apk update
- - apk add make
+ - apk add make gcc
+ - apk add lcov --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
script:
- cd tests
- make
+ - cd ..
+ - lcov -t "advent" -o advent.info -c -d .
+ - genhtml -o coverage advent.info
+ artifacts:
+ paths:
+ - coverage
+
+pages:
+ stage: deploy
+ script:
+ - mv coverage public
+ artifacts:
+ paths:
+ - public
+ only:
+ - master
# Makefile for the open-source release of adventure 2.5
CC?=gcc
-CCFLAGS=-std=c99
+CCFLAGS=-std=c99 -O0 --coverage
LIBS=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SOURCES=$(OBJS:.o=.c) COPYING NEWS README TODO adventure.text advent.text control advent.h funcs.h
.c.o:
- $(CC) $(CCFLAGS) -O $(DBX) -c $<
+ $(CC) $(CCFLAGS) $(DBX) -c $<
advent: $(OBJS) database.o
- $(CC) $(CCFLAGS) -O $(DBX) -o advent $(OBJS) $(LIBS)
+ $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) $(LIBS)
main.o: advent.h funcs.h database.h
database.c database.h: compile adventure.text
./compile
- $(CC) $(CCFLAGS) -O $(DBX) -c database.c
+ $(CC) $(CCFLAGS) $(DBX) -c database.c
clean:
rm -f *.o advent advent.html advent.6 database.[ch] compile
# Show summary lines for all tests.
testlist:
- @grep --text '^##' *.log
+ @grep '^##' *.log
listcheck:
@for f in *.log; do \
- if ( head -3 $$f | grep --text -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
+ if ( head -3 $$f | grep -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \
done
# General regression testing of commands and output; look at the *.log and
done
regress:
@for file in $(TESTLOADS); do \
- $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \
+ $(ECHO) -n " $${file} "; grep '##' $${file}.log || echo ' ## (no description)'; \
if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \
then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
else echo "*** Nonzero return status on $${file}!"; exit 1; fi \