2
0
mirror of https://github.com/koreader/koreader synced 2024-11-06 09:20:32 +00:00
koreader/.ci/after_success.sh

43 lines
1.5 KiB
Bash
Raw Normal View History

2016-02-19 08:00:59 +00:00
#!/usr/bin/env bash
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null
source "${CI_DIR}/common.sh"
set +e
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
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
# push doc update
pushd doc && {
luajit "$(which ldoc)" . 2>/dev/null
if [ ! -d html ]; then
echo "Failed to generate documents..."
exit 1
fi
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
} && popd || exit
cp -r doc/html/* koreader_doc/
pushd koreader_doc && {
git add -A
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
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
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
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)
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
} && popd || exit
else
CircleCI: run docs & coverage in first container only (#3335) I wrote this whole complicated wofkflow-based config file, but except in the case of a base rebuild it wouldn't really be any faster than this simple tweak. ``` defaults: &defaults docker: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 LC_ALL: en_US.UTF8 version: 2 jobs: install-and-build: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - run: name: setup command: .ci/before_install.sh - run: name: install command: .ci/install.sh - save_cache: key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" # compiled luarocks binaries - "install" - run: name: fetch command: .ci/fetch.sh - run: name: check command: .ci/check.sh - run: name: build command: .ci/build.sh - save_cache: key: build-{{ checksum "base/git-rev" }} paths: - "/home/ko/.ccache" - "base" - persist_to_workspace: # Must be an absolute path, or relative path from working_directory root: "./" # Must be relative path from root paths: # front build - "koreader-emulator-x86_64-linux-gnu/koreader" test: <<: *defaults parallelism: 4 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: test command: .ci/test.sh docs-and-coverage: <<: *defaults 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" }} # 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 - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base - restore_cache: keys: - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - attach_workspace: # Must be absolute path or relative path from working_directory at: "./" - run: name: cleanup command: .ci/after_success.sh workflows: version: 2 build-and-test: jobs: - install-and-build - test: requires: - install-and-build - docs-and-coverage: requires: - install-and-build ```
2017-10-10 14:18:53 +00:00
echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping documentation update and coverage."
fi