2019-04-04 23:08:44 +02:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
executors:
|
2019-06-01 14:33:31 +02:00
|
|
|
py:
|
|
|
|
docker:
|
|
|
|
- image: circleci/python:latest
|
|
|
|
working_directory: ~/repo
|
2019-04-04 23:08:44 +02:00
|
|
|
go:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:latest
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
ci:
|
|
|
|
jobs:
|
|
|
|
- checkout:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /.*/
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- linting:
|
|
|
|
requires:
|
|
|
|
- checkout
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /.*/
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- testing:
|
|
|
|
requires:
|
|
|
|
- checkout
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /.*/
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- build:
|
|
|
|
requires:
|
|
|
|
- testing
|
|
|
|
- linting
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /.*/
|
2019-04-14 21:37:17 +02:00
|
|
|
tags:
|
|
|
|
ignore: /^v[0-9]+(\.[0-9]+)*$/
|
2019-04-04 23:08:44 +02:00
|
|
|
- publishing:
|
|
|
|
requires:
|
|
|
|
- testing
|
|
|
|
- linting
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /^v[0-9]+(\.[0-9]+)*$/
|
2019-06-01 14:33:31 +02:00
|
|
|
- publish-docs:
|
|
|
|
requires:
|
|
|
|
- testing
|
|
|
|
- linting
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /^v[0-9]+(\.[0-9]+)*$/
|
2019-04-04 23:08:44 +02:00
|
|
|
jobs:
|
|
|
|
checkout:
|
|
|
|
executor: go
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- persist_to_workspace:
|
|
|
|
paths:
|
|
|
|
- .
|
|
|
|
root: ~/repo
|
|
|
|
linting:
|
|
|
|
executor: go
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run: go build .
|
|
|
|
- run: go get -u golang.org/x/lint/golint
|
|
|
|
- run: golint -set_exit_status ./...
|
|
|
|
testing:
|
|
|
|
executor: go
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run: go build ./...
|
2019-04-16 10:00:30 +02:00
|
|
|
- run: go get github.com/schrej/godacov
|
|
|
|
- run: go get -u github.com/haya14busa/goverage
|
|
|
|
- run: goverage -v -coverprofile=coverage.out ./...
|
|
|
|
- run: godacov -t $CODACY_TOKEN -r ./coverage.out -c $CIRCLE_SHA1
|
2019-04-04 23:08:44 +02:00
|
|
|
build:
|
|
|
|
executor: go
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
|
|
name: Install Goreleaser
|
|
|
|
command: |
|
|
|
|
cd .. && \
|
|
|
|
wget https://github.com/goreleaser/goreleaser/releases/download/v0.104.1/goreleaser_Linux_x86_64.tar.gz && \
|
|
|
|
tar -xvf goreleaser_Linux_x86_64.tar.gz && \
|
|
|
|
./goreleaser -v
|
|
|
|
- run:
|
|
|
|
name: Execute goreleaser
|
2019-04-06 14:05:01 +02:00
|
|
|
command: CGO_ENABLED=${CGO_ENABLED:-0} ../goreleaser --snapshot --skip-publish --debug
|
2019-04-04 23:08:44 +02:00
|
|
|
publishing:
|
|
|
|
executor: go
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
|
|
name: Install Goreleaser
|
|
|
|
command: |
|
|
|
|
cd .. && \
|
|
|
|
wget https://github.com/goreleaser/goreleaser/releases/download/v0.104.1/goreleaser_Linux_x86_64.tar.gz && \
|
|
|
|
tar -xvf goreleaser_Linux_x86_64.tar.gz && \
|
|
|
|
./goreleaser -v
|
|
|
|
- run:
|
|
|
|
name: Login to docker hub
|
|
|
|
command: |
|
|
|
|
echo "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin
|
|
|
|
- run:
|
|
|
|
name: Execute goreleaser
|
2019-04-14 08:35:55 +02:00
|
|
|
command: CGO_ENABLED=${CGO_ENABLED:-0} ../goreleaser --debug
|
|
|
|
- run:
|
2019-04-14 21:37:17 +02:00
|
|
|
name: Enable experimental docker features
|
2019-04-14 08:35:55 +02:00
|
|
|
command: |
|
|
|
|
mkdir -p ~/.docker/ && \
|
2019-04-14 21:37:17 +02:00
|
|
|
echo '{"experimental": "enabled"}' > ~/.docker/config.json
|
|
|
|
- run:
|
|
|
|
name: Create manifest for version
|
|
|
|
command: |
|
|
|
|
docker manifest create \
|
2019-04-14 22:50:23 +02:00
|
|
|
containrrr/watchtower:$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:amd64-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:i386-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:armhf-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:arm64v8-$(echo $CIRCLE_TAG | sed 's/^v*//')
|
2019-04-14 21:37:17 +02:00
|
|
|
- run:
|
|
|
|
name: Annotate i386 version
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
2019-04-14 22:50:23 +02:00
|
|
|
containrrr/watchtower:$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:i386-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
2019-04-14 21:37:17 +02:00
|
|
|
--os linux \
|
|
|
|
--arch 386
|
|
|
|
- run:
|
|
|
|
name: Annotate ARM version
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
2019-04-14 22:50:23 +02:00
|
|
|
containrrr/watchtower:$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:armhf-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
2019-04-14 21:37:17 +02:00
|
|
|
--os linux \
|
|
|
|
--arch arm
|
|
|
|
- run:
|
|
|
|
name: Annotate ARM64 version
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
2019-04-14 22:50:23 +02:00
|
|
|
containrrr/watchtower:$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
|
|
|
containrrr/watchtower:arm64v8-$(echo $CIRCLE_TAG | sed 's/^v*//') \
|
2019-04-14 21:37:17 +02:00
|
|
|
--os linux \
|
|
|
|
--arch arm64 \
|
|
|
|
--variant v8
|
|
|
|
- run:
|
|
|
|
name: Create manifest for latest
|
|
|
|
command: |
|
|
|
|
docker manifest create \
|
|
|
|
containrrr/watchtower:latest \
|
|
|
|
containrrr/watchtower:amd64-latest \
|
|
|
|
containrrr/watchtower:i386-latest \
|
|
|
|
containrrr/watchtower:armhf-latest \
|
|
|
|
containrrr/watchtower:arm64v8-latest
|
|
|
|
- run:
|
|
|
|
name: Annotate i386 latest
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
|
|
|
containrrr/watchtower:latest \
|
|
|
|
containrrr/watchtower:i386-latest \
|
|
|
|
--os linux \
|
|
|
|
--arch 386
|
|
|
|
- run:
|
|
|
|
name: Annotate ARM latest
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
|
|
|
containrrr/watchtower:latest \
|
|
|
|
containrrr/watchtower:armhf-latest \
|
|
|
|
--os linux \
|
|
|
|
--arch arm
|
|
|
|
- run:
|
|
|
|
name: Annotate ARM64 latest
|
|
|
|
command: |
|
|
|
|
docker manifest annotate \
|
|
|
|
containrrr/watchtower:latest \
|
|
|
|
containrrr/watchtower:arm64v8-latest \
|
|
|
|
--os linux \
|
|
|
|
--arch arm64 \
|
|
|
|
--variant v8
|
|
|
|
- run:
|
|
|
|
name: Push manifests to Dockerhub
|
|
|
|
command: |
|
2019-04-14 23:16:07 +02:00
|
|
|
echo "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin &&
|
2019-04-14 22:50:23 +02:00
|
|
|
docker manifest push containrrr/watchtower:$(echo $CIRCLE_TAG | sed 's/^v*//') && \
|
2019-04-14 08:35:55 +02:00
|
|
|
docker manifest push containrrr/watchtower:latest
|
|
|
|
- run:
|
|
|
|
name: Sync Readme to Dockerhub
|
|
|
|
command: |
|
|
|
|
docker pull lsiodev/readme-sync && \
|
|
|
|
docker run --rm=true \
|
|
|
|
-e DOCKERHUB_USERNAME=$DOCKER_USER \
|
|
|
|
-e DOCKERHUB_PASSWORD="$DOCKER_PASS" \
|
|
|
|
-e GIT_REPOSITORY=containrrr/watchtower \
|
|
|
|
-e DOCKER_REPOSITORY=containrrr/watchtower \
|
|
|
|
-e GIT_BRANCH=master \
|
|
|
|
lsiodev/readme-sync bash -c 'node sync'
|
2019-06-01 14:33:31 +02:00
|
|
|
publish-docs:
|
|
|
|
executor: py
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run:
|
|
|
|
name: Install prerequisites
|
|
|
|
command: |
|
2019-06-26 13:37:42 +02:00
|
|
|
sudo pip install \
|
2019-06-01 14:33:31 +02:00
|
|
|
mkdocs \
|
|
|
|
mkdocs-material \
|
|
|
|
md-toc
|
|
|
|
- run:
|
|
|
|
name: Generate and publish
|
|
|
|
command: mkdocs gh-deploy
|