CircleCI: finishing touches (#3340)

* junit test results; unfortunately this seems to conflict with the verbose out

* fix deps cache: two files can change independently

* verbose print obsoleted by gtest in upsream busted
pull/3341/head
Frans de Jonge 7 years ago committed by GitHub
parent f90973f73a
commit 53c0756def

@ -6,37 +6,42 @@ source "${CI_DIR}/common.sh"
set +e
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
if [ ! "$CIRCLE_NODE_INDEX" = 0 ]; then
echo -e "\\n${ANSI_GREEN}Not on first node. Skipping documentation update and coverage."
elif [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update."
git clone git@github.com:koreader/doc.git koreader_doc
if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
if [ "$CIRCLE_NODE_INDEX" = 1 ]; then
echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update."
git clone git@github.com:koreader/doc.git koreader_doc
# push doc update
pushd doc && {
luajit "$(which ldoc)" . 2>/dev/null
if [ ! -d html ]; then
echo "Failed to generate documents..."
exit 1
fi
} && popd || exit
# push doc update
pushd doc && {
luajit "$(which ldoc)" . 2>/dev/null
if [ ! -d html ]; then
echo "Failed to generate documents..."
exit 1
fi
} && popd || exit
cp -r doc/html/* koreader_doc/
pushd koreader_doc && {
git add -A
echo -e "\\n${ANSI_GREEN}Pushing document update..."
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
commit -a --amend -m 'Automated documentation build from travis-ci.'
git push -f --quiet origin gh-pages >/dev/null
echo -e "\\n${ANSI_GREEN}Documentation update pushed."
} && popd || exit
cp -r doc/html/* koreader_doc/
pushd koreader_doc && {
git add -A
echo -e "\\n${ANSI_GREEN}Pushing document update..."
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
commit -a --amend -m 'Automated documentation build from travis-ci.'
git push -f --quiet origin gh-pages >/dev/null
echo -e "\\n${ANSI_GREEN}Documentation update pushed."
} && popd || exit
travis_retry make coverage
pushd koreader-*/koreader && {
# see https://github.com/codecov/example-lua
bash <(curl -s https://codecov.io/bash)
} && popd || exit
echo -e "\\n${ANSI_GREEN}Running make testfront for timings."
make testfront BUSTED_OVERRIDES="--output=junit -Xoutput junit-test-results.xml"
fi
if [ "$CIRCLE_NODE_INDEX" = 0 ]; then
travis_retry make coverage
pushd koreader-*/koreader && {
# see https://github.com/codecov/example-lua
bash <(curl -s https://codecov.io/bash)
} && popd || exit
fi
else
echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping documentation update and coverage."
fi

@ -5,6 +5,8 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common.sh"
pushd koreader-emulator-x86_64-linux-gnu/koreader && {
circleci tests glob "spec/front/unit/*_spec.lua" | circleci tests split --split-by=timings --timings-type=filename | xargs -I{} sh -c 'make -C ../.. testfront BUSTED_SPEC_FILE="{}" || exit 255'
} && popd
#make testfront
# the circleci command spits out newlines; we want spaces instead
BUSTED_SPEC_FILE="$(circleci tests glob "spec/front/unit/*_spec.lua" | circleci tests split --split-by=timings --timings-type=filename | tr '\n' ' ')"
} && popd || exit
make testfront BUSTED_SPEC_FILE="${BUSTED_SPEC_FILE}"

@ -7,13 +7,13 @@ jobs:
EMULATE_READER: 1
# this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6
LC_ALL: en_US.UTF8
parallelism: 3
parallelism: 2
steps:
- checkout
- restore_cache:
keys:
# binary dependencies require {{ arch }} because there are different CPUs in use on the servers
- deps-{{ arch }}-{{ checksum ".ci/install.sh" }}
- deps-{{ arch }}-{{ checksum ".ci/install.sh" }}-{{ checksum ".ci/helper_luarocks.sh" }}
# need to init some stuff first or git will complain when sticking in base cache
- run: git submodule init base && git submodule update base && pushd base && git submodule init && git submodule update && popd
# we can't use command output directly for cache check so we write it to git-rev-base
@ -31,7 +31,7 @@ jobs:
name: install
command: .ci/install.sh
- save_cache:
key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }}
key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }}-{{ checksum ".ci/helper_luarocks.sh" }}
paths:
- "/home/ko/bin"
- "/home/ko/.luarocks"
@ -60,7 +60,10 @@ jobs:
name: test
command: .ci/test.sh
# docs and coverage, master branch only
# docs, coverage, and test timing (can we use two outputs at once?); master branch only
- run:
name: docs-and-coverage
command: .ci/after_success.sh
# by storing the test results CircleCI automatically distributes tests based on execution time
- store_test_results:
path: koreader-emulator-x86_64-linux-gnu/koreader/junit-test-results.xml

@ -102,7 +102,8 @@ testfront: $(INSTALL_DIR)/koreader/.busted
cd $(INSTALL_DIR)/koreader && ./luajit $(shell which busted) \
--sort-files \
--no-auto-insulate \
-o verbose_print --exclude-tags=notest $(BUSTED_SPEC_FILE)
--output=gtest \
--exclude-tags=notest $(BUSTED_OVERRIDES) $(BUSTED_SPEC_FILE)
test: $(INSTALL_DIR)/koreader/.busted
$(MAKE) -C $(KOR_BASE) test

@ -1,22 +0,0 @@
-- from Mashape/kong/spec/busted-print.lua
local ansicolors = require 'ansicolors'
return function(options)
local handler = require 'busted.outputHandlers.utfTerminal'(options)
handler.fileStart = function(file)
io.write('\n' .. ansicolors('%{cyan}' .. file.name) .. ':')
end
handler.testStart = function(element, parent, status, debug)
io.write('\n ' .. handler.getFullName(element) .. ' ... ')
io.flush()
end
local busted = require 'busted'
busted.subscribe({ 'file', 'start' }, handler.fileStart)
busted.subscribe({ 'test', 'start' }, handler.testStart)
return handler
end
Loading…
Cancel
Save