mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-22 15:11:16 +01:00
103 lines
3.1 KiB
YAML
103 lines
3.1 KiB
YAML
version: 2.0
|
|
workflows:
|
|
version: 2
|
|
build:
|
|
jobs:
|
|
- build-1.11
|
|
- build-1.12
|
|
- build-latest
|
|
jobs:
|
|
# build-latest serves as the template
|
|
# we use YAML anchors & aliases to exchange the docker image (and hence Go version used for the build)
|
|
build-latest: &build-latest
|
|
description: Builds zrepl
|
|
parameters:
|
|
image:
|
|
description: "the docker image that the job should use"
|
|
type: string
|
|
docker:
|
|
- image: circleci/golang:latest
|
|
environment:
|
|
# required by lazy.sh
|
|
TERM: xterm
|
|
working_directory: /go/src/github.com/zrepl/zrepl
|
|
steps:
|
|
- run:
|
|
name: Setup environment variables
|
|
command: |
|
|
# used by pip (for docs)
|
|
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $BASH_ENV
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- source
|
|
- vendor
|
|
- protobuf
|
|
|
|
- checkout
|
|
|
|
- save_cache:
|
|
key: source
|
|
paths:
|
|
- ".git"
|
|
|
|
# install deps
|
|
- run: wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
|
|
- run: echo "6003de742ea3fcf703cfec1cd4a3380fd143081a2eb0e559065563496af27807 protoc-3.6.1-linux-x86_64.zip" | sha256sum -c
|
|
- run: sudo unzip -d /usr protoc-3.6.1-linux-x86_64.zip
|
|
- save_cache:
|
|
key: protobuf
|
|
paths:
|
|
- "/usr/include/google/protobuf"
|
|
|
|
- run: sudo apt install python3 python3-pip libgirepository1.0-dev
|
|
- run: ./lazy.sh devsetup
|
|
|
|
- run:
|
|
name: Install minio client, prepare minio
|
|
command: |
|
|
curl -sSL https://dl.minio.io/client/mc/release/linux-amd64/mc -o ${GOPATH}/bin/mc
|
|
chmod +x ${GOPATH}/bin/mc
|
|
mc config host add --api s3v4 zrepl-minio https://minio.cschwarz.com ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY}
|
|
|
|
- run: make vendordeps
|
|
- save_cache:
|
|
key: vendor
|
|
paths:
|
|
- "./vendor"
|
|
|
|
- run: make
|
|
- run: make vet
|
|
- run: make test
|
|
- run: make lint
|
|
- run: make release
|
|
|
|
|
|
- store_artifacts:
|
|
path: ./artifacts/release
|
|
when: always
|
|
|
|
- run:
|
|
shell: /bin/bash -euo pipefail
|
|
when: always
|
|
command: |
|
|
echo "$CIRCLE_BUILD_URL" > ./artifacts/release/cirlceci_build_url
|
|
mc cp -r artifacts/release "zrepl-minio/zrepl-ci-artifacts/${CIRCLE_SHA1}/${CIRCLE_JOB}/"
|
|
REPO="zrepl/zrepl"
|
|
COMMIT="${CIRCLE_SHA1}"
|
|
JOB_NAME="${CIRCLE_JOB}"
|
|
curl "https://api.github.com/repos/$REPO/statuses/$COMMIT?access_token=$GITHUB_COMMIT_STATUS_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-X POST \
|
|
-d '{"context":"zrepl/publish-ci-artifacts", "state": "success", "description":"CI Build Artifacts for '"$JOB_NAME"'", "target_url":"https://minio.cschwarz.com/minio/zrepl-ci-artifacts/'"$COMMIT"'/"}'
|
|
|
|
|
|
build-1.11:
|
|
<<: *build-latest
|
|
docker:
|
|
- image: circleci/golang:1.11
|
|
build-1.12:
|
|
<<: *build-latest
|
|
docker:
|
|
- image: circleci/golang:1.12
|