2018-06-07 17:16:51 +08:00
|
|
|
stages:
|
2018-08-13 02:40:33 +08:00
|
|
|
- check-dco
|
2018-06-17 20:18:35 +08:00
|
|
|
- go-fmt
|
2018-08-17 02:53:26 +08:00
|
|
|
- go-test
|
2018-06-07 17:16:51 +08:00
|
|
|
- build-src
|
|
|
|
- build-docker
|
2018-09-26 15:52:16 +08:00
|
|
|
- docker-registry-master
|
|
|
|
- docker-registry-tags
|
2018-06-07 17:16:51 +08:00
|
|
|
|
2018-08-13 02:40:33 +08:00
|
|
|
check-dco:
|
|
|
|
stage: check-dco
|
|
|
|
image: debian:buster
|
|
|
|
except:
|
|
|
|
- master
|
2018-09-26 15:52:16 +08:00
|
|
|
- tags
|
2018-08-13 02:40:33 +08:00
|
|
|
script:
|
|
|
|
- apt update
|
|
|
|
- apt install -y curl git jq
|
|
|
|
- bash ./scripts/check-dco
|
|
|
|
|
2018-06-07 17:16:51 +08:00
|
|
|
build-src:
|
|
|
|
stage: build-src
|
|
|
|
image: debian:buster
|
2018-06-08 16:33:45 +08:00
|
|
|
variables:
|
|
|
|
GOPATH: $CI_PROJECT_DIR
|
2018-07-27 00:26:04 +08:00
|
|
|
except:
|
|
|
|
- master
|
2018-09-26 15:52:16 +08:00
|
|
|
- tags
|
2018-10-18 13:18:01 +08:00
|
|
|
before_script:
|
2018-06-07 17:16:51 +08:00
|
|
|
- apt update
|
|
|
|
- apt install -y curl gnupg git make golang
|
2018-10-18 13:18:01 +08:00
|
|
|
- mkdir -p /go/src /go/bin /go/pkg
|
|
|
|
- export GOPATH=/go
|
|
|
|
- export PATH=$PATH:/go/bin
|
|
|
|
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
|
|
|
- ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME
|
2018-06-07 17:16:51 +08:00
|
|
|
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
|
|
|
|
- apt update
|
|
|
|
- apt install -y nodejs
|
2018-06-23 21:59:14 +08:00
|
|
|
- npm install -g html-minifier@3.5.7 uglify-js@3.4.1 sass@1.5.1
|
2018-10-18 13:18:01 +08:00
|
|
|
script:
|
|
|
|
- cd /go/src/$CI_PROJECT_NAME
|
2018-06-07 17:16:51 +08:00
|
|
|
- make devel
|
|
|
|
- make prod
|
|
|
|
|
|
|
|
build-docker:
|
|
|
|
stage: build-docker
|
|
|
|
image: docker:stable
|
2018-06-08 21:45:02 +08:00
|
|
|
services:
|
|
|
|
- docker:dind
|
2018-07-27 00:26:04 +08:00
|
|
|
except:
|
|
|
|
- master
|
2018-09-26 15:52:16 +08:00
|
|
|
- tags
|
2018-06-07 17:16:51 +08:00
|
|
|
script:
|
|
|
|
- docker build -t commento-ce .
|
|
|
|
|
|
|
|
go-test:
|
|
|
|
stage: go-test
|
|
|
|
image: golang:1.10.2
|
|
|
|
services:
|
|
|
|
- postgres:latest
|
|
|
|
variables:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: commento_test
|
|
|
|
COMMENTO_POSTGRES: postgres://postgres:postgres@postgres/commento_test?sslmode=disable
|
2018-07-27 00:26:04 +08:00
|
|
|
except:
|
|
|
|
- master
|
2018-09-26 15:52:16 +08:00
|
|
|
- tags
|
2018-10-18 13:18:01 +08:00
|
|
|
before_script:
|
|
|
|
- mkdir -p /go/src /go/bin /go/pkg
|
|
|
|
- export GOPATH=/go
|
|
|
|
- export PATH=$PATH:/go/bin
|
|
|
|
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
|
|
|
- ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME
|
2018-06-07 17:16:51 +08:00
|
|
|
script:
|
2018-10-18 13:18:01 +08:00
|
|
|
- cd /go/src/$CI_PROJECT_NAME
|
2018-06-10 22:32:52 +08:00
|
|
|
- make test
|
2018-06-09 13:41:13 +08:00
|
|
|
|
2018-06-17 20:18:35 +08:00
|
|
|
go-fmt:
|
|
|
|
stage: go-fmt
|
|
|
|
image: golang:1.10.2
|
2018-07-27 00:26:04 +08:00
|
|
|
except:
|
|
|
|
- master
|
2018-09-26 15:52:16 +08:00
|
|
|
- tags
|
2018-06-17 20:18:35 +08:00
|
|
|
script:
|
|
|
|
- cd api
|
|
|
|
- test -z $(go fmt)
|
|
|
|
|
2018-09-26 15:52:16 +08:00
|
|
|
docker-registry-master:
|
|
|
|
stage: docker-registry-master
|
2018-06-09 13:41:13 +08:00
|
|
|
image: docker:stable
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
2018-08-09 01:05:37 +08:00
|
|
|
- master@commento/commento-ce
|
2018-06-09 13:41:13 +08:00
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
|
|
|
|
script:
|
|
|
|
- docker pull registry.gitlab.com/commento/commento-ce:latest || true
|
|
|
|
- docker build --cache-from registry.gitlab.com/commento/commento-ce:latest --tag registry.gitlab.com/commento/commento-ce:latest .
|
|
|
|
- docker push registry.gitlab.com/commento/commento-ce:latest
|
2018-09-26 15:52:16 +08:00
|
|
|
|
|
|
|
docker-registry-tags:
|
|
|
|
stage: docker-registry-tags
|
|
|
|
image: docker:stable
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
before_script:
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
|
|
|
|
script:
|
2018-09-28 05:11:57 +08:00
|
|
|
- apk add git
|
2018-09-26 15:52:16 +08:00
|
|
|
- docker build --tag registry.gitlab.com/commento/commento-ce:$(git describe --tags) .
|
|
|
|
- docker push registry.gitlab.com/commento/commento-ce:$(git describe --tags)
|