mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* fn: remove confusing parallelism in test scripts *) Tests should be consistent when run from makefile versus running these test scripts from command line. Let go use GOMAXPROCS instead of hardcoded 4 cpus in Makefile. *) Moved docker pull for specific image versions into helpers scripts as well. Easier to maintain image version for tests in the same place. *) Minor Makefile cleanup: removed unused makefile targets. * fn: git-diff rename limit increase
71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
version: 2
|
|
jobs:
|
|
build:
|
|
machine:
|
|
image: circleci/classic:201708-01
|
|
working_directory: ~/go/src/github.com/fnproject/fn
|
|
environment: # apparently expansion doesn't work here yet: https://discuss.circleci.com/t/environment-variable-expansion-in-working-directory/11322
|
|
- GOPATH=/home/circleci/go
|
|
- GOVERSION=1.10
|
|
- OS=linux
|
|
- ARCH=amd64
|
|
- FN_LOG_LEVEL=debug
|
|
steps:
|
|
- checkout
|
|
# install Go
|
|
- run: |
|
|
go version
|
|
go env GOROOT
|
|
mkdir tmp
|
|
cd tmp
|
|
sudo rm -rf /usr/local/go
|
|
wget https://storage.googleapis.com/golang/go$GOVERSION.$OS-$ARCH.tar.gz
|
|
sudo tar -C /usr/local -xzf go$GOVERSION.$OS-$ARCH.tar.gz
|
|
- run: go version
|
|
# install latest Docker
|
|
- run: |
|
|
sudo rm -rf /var/cache/apt/archives && sudo ln -s ~/.apt-cache /var/cache/apt/archives && mkdir -p ~/.apt-cache/partial
|
|
sudo service docker stop
|
|
curl -fsSL https://get.docker.com/ | sudo sh
|
|
docker version
|
|
- run: docker version
|
|
- run: nproc
|
|
# fixes git-diff warning: "warning: inexact rename detection was skipped due to too many files.""
|
|
- run: git config diff.renamelimit 65535
|
|
- run: make clear-images
|
|
|
|
# Work out what needs rebuilding and what has changed
|
|
- run: |
|
|
( ./changed-since-last.sh
|
|
echo "export DIND_NEEDED DIND_TAG DIND_PREV"
|
|
echo "export FN_NEEDED FN_TAG FN_PREV"
|
|
) >> $BASH_ENV
|
|
|
|
# Rebuild the build tools if necessary
|
|
# This leaves local docker images around
|
|
- run: |
|
|
if [[ -n "$DIND_NEEDED" ]]; then
|
|
make build-dind
|
|
fi
|
|
|
|
# Rebuild fnserver if necessary
|
|
- run: |
|
|
if [[ -n "$FN_NEEDED" ]]; then
|
|
make test -j $(nproc)
|
|
fi
|
|
|
|
- deploy:
|
|
command: |
|
|
if [[ "${CIRCLE_BRANCH}" == "master" && -z "${CIRCLE_PR_REPONAME}" ]]; then
|
|
printenv DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
|
git config --global user.email "ci@fnproject.com"
|
|
git config --global user.name "CI"
|
|
git branch --set-upstream-to=origin/${CIRCLE_BRANCH} ${CIRCLE_BRANCH}
|
|
if [[ -n "$DIND_NEEDED" ]]; then
|
|
make release-dind
|
|
fi
|
|
if [[ -n "$FN_NEEDED" ]]; then
|
|
make release-fnserver
|
|
fi
|
|
fi
|