nnn/.circleci/config.yml
2020-01-25 08:36:50 +05:30

118 lines
3.7 KiB
YAML

version: 2
jobs:
compile:
docker:
- image: ubuntu:18.04
working_directory: ~/nnn
environment:
CI_FORCE_TEST: 1
steps:
- run:
command: |
apt update -qq
apt install -y --no-install-recommends software-properties-common wget gpg-agent shellcheck
apt-add-repository -y ppa:jonathonf/gcc-9.1
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
apt-add-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main"
apt update -qq
apt install -y --no-install-recommends git gcc gcc-8 gcc-9 clang clang-8 clang-tidy-8 make pkg-config libncursesw5-dev libreadline-dev
- checkout
- run:
command: |
export CFLAGS=-Werror
make clean
echo
echo "########## gcc ##########"
CC=gcc make strip
ls -l nnn
make clean
echo
echo "########## gcc-8 ##########"
CC=gcc-8 make strip
ls -l nnn
make clean
echo
echo "########## gcc-9 ##########"
CC=gcc-9 make strip
ls -l nnn
make clean
echo
echo "########## clang ##########"
CC=clang make strip
ls -l nnn
make clean
echo
echo "########## clang-8 ##########"
CC=clang-8 make strip
ls -l nnn
make clean
echo
echo "########## clang-tidy-8 ##########"
clang-tidy-8 src/* -- -I/usr/include -I/usr/include/ncursesw
echo "########## checllcheck ##########"
find plugins/ -type f -not -name "*.md" -exec shellcheck -e SC1090 {} +
package-and-publish:
machine: true
working_directory: ~/nnn
steps:
- checkout
- run:
name: "package with packagecore"
command: |
# Clean up
rm -rf ./dist/*
# Pack source
git archive -o ../${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG}.tar.gz --format tar.gz --prefix=${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG#v}/ ${CIRCLE_TAG}
# Use latest installed python3 from pyenv
export PYENV_VERSION="$(pyenv versions | grep -Po '\b3\.\d+\.\d+' | tail -1)"
pip install packagecore
packagecore -c misc/packagecore/packagecore.yaml -o ./dist/ ${CIRCLE_TAG#v}
# Move source pack to dist
mv ../${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG}.tar.gz dist/
- run:
name: "generate static package"
command: |
# Compile statically
make O_STATIC=1 O_NORL=1 strip
# Archive
tar -cvf ${CIRCLE_PROJECT_REPONAME}-static-${CIRCLE_TAG}.amd64.tar.gz ${CIRCLE_PROJECT_REPONAME}
# Move static package to dist
mv tar -cvf ${CIRCLE_PROJECT_REPONAME}-static-${CIRCLE_TAG}.amd64.tar.gz dist/
# Remove static binary
rm ${CIRCLE_PROJECT_REPONAME}
- run:
name: "publish to GitHub"
command: |
go get github.com/tcnksm/ghr
ghr -t ${GITHUB_API_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./dist/
workflows:
version: 2
test:
jobs: &all-tests
- compile
nightly:
triggers:
- schedule:
cron: "0 0 * * 6"
filters:
branches:
only:
- master
jobs: *all-tests
publish-github-release:
jobs:
- package-and-publish:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/