2018-10-30 19:28:48 +02:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
|
|
|
- checkout_code
|
2019-04-11 16:07:09 +02:00
|
|
|
- lint:
|
|
|
|
requires:
|
|
|
|
- checkout_code
|
2021-02-25 16:32:57 +02:00
|
|
|
go_version: "1.16"
|
2020-11-20 07:19:34 +02:00
|
|
|
vips_version: "8.10"
|
2019-06-13 15:20:01 +02:00
|
|
|
- build:
|
2020-11-20 07:19:34 +02:00
|
|
|
name: go<< matrix.go_version >>_vips<< matrix.vips_version >>
|
2019-06-13 15:20:01 +02:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
2020-11-20 07:19:34 +02:00
|
|
|
matrix:
|
|
|
|
parameters:
|
2021-09-29 15:12:09 +02:00
|
|
|
go_version: ["1.17", "1.16"] # Go 1.15 doesn't support io/fs
|
|
|
|
vips_version: ["8.11", "8.10", "8.9"]
|
2018-10-30 19:28:48 +02:00
|
|
|
|
2021-02-08 13:24:33 +02:00
|
|
|
release:
|
|
|
|
jobs:
|
|
|
|
- checkout_code:
|
|
|
|
filters: &release_tags_filter
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /^v\d+\.\d+\.\d+.*/
|
|
|
|
- publish_github_release:
|
|
|
|
requires:
|
|
|
|
- checkout_code # to grab changes from CHANGELOG
|
|
|
|
filters: *release_tags_filter
|
|
|
|
|
2019-06-13 14:09:57 +02:00
|
|
|
executors:
|
|
|
|
imgproxy:
|
|
|
|
docker:
|
|
|
|
- image: "darthsim/imgproxy-circleci:latest"
|
|
|
|
working_directory: /go/src/imgproxy
|
|
|
|
environment:
|
|
|
|
BASH_ENV: "/root/.bashrc"
|
2021-05-18 12:25:21 +02:00
|
|
|
TEST_RESULTS: /tmp/test-results
|
2019-06-13 14:09:57 +02:00
|
|
|
|
|
|
|
commands:
|
2019-06-13 14:18:07 +02:00
|
|
|
setup_vips:
|
|
|
|
parameters:
|
|
|
|
vips_version:
|
|
|
|
type: string
|
|
|
|
steps:
|
2019-06-13 14:23:51 +02:00
|
|
|
- run:
|
|
|
|
name: Setup Vips
|
|
|
|
command: |
|
|
|
|
echo 'LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/vips/<< parameters.vips_version >>/lib"' >> $BASH_ENV
|
|
|
|
echo 'PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/root/vips/<< parameters.vips_version >>/lib/pkgconfig"' >> $BASH_ENV
|
2019-06-13 14:18:07 +02:00
|
|
|
|
2019-06-13 14:09:57 +02:00
|
|
|
install_go:
|
|
|
|
parameters:
|
|
|
|
go_version:
|
|
|
|
type: string
|
|
|
|
steps:
|
2019-06-13 14:23:51 +02:00
|
|
|
- run:
|
|
|
|
name: Install Go
|
|
|
|
command: |
|
|
|
|
gvm install go<< parameters.go_version >> -B
|
|
|
|
gvm use go<< parameters.go_version >> --default
|
2019-09-16 12:45:47 +02:00
|
|
|
echo 'export GO111MODULE=on' >> $BASH_ENV
|
2019-06-13 14:23:51 +02:00
|
|
|
echo 'export GOPATH=/go' >> $BASH_ENV
|
|
|
|
echo 'export PATH="$PATH:$(go env GOPATH)/bin"' >> $BASH_ENV
|
|
|
|
echo 'export CGO_LDFLAGS_ALLOW="-s|-w"' >> $BASH_ENV
|
2021-05-18 12:25:21 +02:00
|
|
|
- run:
|
|
|
|
name: Install gotestsum
|
|
|
|
command: |
|
|
|
|
mkdir -p /usr/local/bin && \
|
|
|
|
curl -Ls https://github.com/gotestyourself/gotestsum/releases/download/v1.6.4/gotestsum_1.6.4_linux_amd64.tar.gz | \
|
|
|
|
tar -xzC /usr/local/bin
|
2019-06-13 14:09:57 +02:00
|
|
|
|
2018-10-30 19:28:48 +02:00
|
|
|
jobs:
|
|
|
|
checkout_code:
|
|
|
|
docker:
|
|
|
|
- image: circleci/slim-base:latest
|
|
|
|
working_directory: /go/src/imgproxy
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
path: /go/src/imgproxy
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: [.]
|
|
|
|
|
2019-04-11 16:07:09 +02:00
|
|
|
lint:
|
2019-06-13 14:09:57 +02:00
|
|
|
executor: imgproxy
|
2019-04-11 16:07:09 +02:00
|
|
|
parameters:
|
2019-06-13 14:18:07 +02:00
|
|
|
vips_version:
|
|
|
|
type: string
|
2019-04-11 16:07:09 +02:00
|
|
|
go_version:
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
2019-06-13 14:18:07 +02:00
|
|
|
- setup_vips:
|
|
|
|
vips_version: << parameters.vips_version >>
|
2019-06-13 14:09:57 +02:00
|
|
|
- install_go:
|
|
|
|
go_version: << parameters.go_version >>
|
2019-04-11 16:07:09 +02:00
|
|
|
- run:
|
2019-06-13 14:09:57 +02:00
|
|
|
name: Install golangci-lint
|
2019-09-11 11:51:11 +02:00
|
|
|
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint sh -s -- -b $(go env GOPATH)/bin v1.18.0
|
2019-06-13 14:09:57 +02:00
|
|
|
- run:
|
|
|
|
name: Lint imgproxy
|
2021-04-26 13:52:50 +02:00
|
|
|
command: golangci-lint run
|
2019-04-11 16:07:09 +02:00
|
|
|
|
2018-10-30 19:28:48 +02:00
|
|
|
build:
|
2019-06-13 14:09:57 +02:00
|
|
|
executor: imgproxy
|
2018-10-30 19:28:48 +02:00
|
|
|
parameters:
|
2019-06-13 14:18:07 +02:00
|
|
|
vips_version:
|
|
|
|
type: string
|
2018-10-30 19:28:48 +02:00
|
|
|
go_version:
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
2019-06-13 14:18:07 +02:00
|
|
|
- setup_vips:
|
|
|
|
vips_version: << parameters.vips_version >>
|
2019-06-13 14:09:57 +02:00
|
|
|
- install_go:
|
2019-06-13 14:18:07 +02:00
|
|
|
go_version: << parameters.go_version >>
|
2019-09-16 17:02:05 +02:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- go-modules-{{ checksum "go.sum" }}
|
2018-10-30 19:28:48 +02:00
|
|
|
- run:
|
|
|
|
name: Build imgproxy
|
2021-05-18 12:25:21 +02:00
|
|
|
command: |
|
|
|
|
mkdir -p $TEST_RESULTS && \
|
|
|
|
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- ./...
|
2019-09-16 17:02:05 +02:00
|
|
|
- save_cache:
|
|
|
|
key: go-modules-{{ checksum "go.sum" }}
|
|
|
|
paths:
|
|
|
|
- "/go/pkg/mod"
|
2021-05-18 12:25:21 +02:00
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/test-results
|
|
|
|
destination: raw-test-output
|
|
|
|
- store_test_results:
|
|
|
|
path: /tmp/test-results
|
2021-02-08 13:24:33 +02:00
|
|
|
|
|
|
|
publish_github_release:
|
|
|
|
executor: imgproxy
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- install_go:
|
|
|
|
go_version: "1.14"
|
|
|
|
- run:
|
|
|
|
name: Install github-release tool
|
|
|
|
command: go get github.com/github-release/github-release
|
|
|
|
- run:
|
|
|
|
name: Upload GitHub release
|
|
|
|
command: |
|
|
|
|
# Extract changelog entries between this and previous version headers
|
|
|
|
escaped_version=$(echo ${CIRCLE_TAG#v} | sed -e 's/[]\/$*.^[]/\\&/g')
|
|
|
|
description_body=$(awk "BEGIN{inrelease=0} /## \[${escaped_version}\]/{inrelease=1;next} /## \[[0-9]+\.[0-9]+\.[0-9]+\]/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md)
|
|
|
|
# Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH
|
|
|
|
[[ ${CIRCLE_TAG} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]] && prerelease="--pre-release"
|
|
|
|
# Create release!
|
|
|
|
github-release release \
|
|
|
|
--user ${CIRCLE_PROJECT_USERNAME} \
|
|
|
|
--repo ${CIRCLE_PROJECT_REPONAME} \
|
|
|
|
--tag ${CIRCLE_TAG} \
|
|
|
|
--name ${CIRCLE_TAG} \
|
|
|
|
--description "${description_body}" \
|
|
|
|
$prerelease
|