2018-06-07 17:16:51 +08:00
|
|
|
stages:
|
|
|
|
- build-src
|
|
|
|
- build-docker
|
|
|
|
- go-test
|
2018-06-09 13:41:13 +08:00
|
|
|
- docker-registry
|
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-06-07 17:16:51 +08:00
|
|
|
script:
|
|
|
|
- apt update
|
|
|
|
- apt install -y curl gnupg git make golang
|
|
|
|
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
|
|
|
|
- apt update
|
|
|
|
- apt install -y nodejs
|
|
|
|
- npm install -g html-minifier uglify-js sass
|
2018-06-08 16:33:45 +08:00
|
|
|
- mkdir -p src/gitlab.com/commento && cd src/gitlab.com/commento && ln -s $CI_PROJECT_DIR && cd $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-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
|
|
|
|
script:
|
|
|
|
- cd api
|
|
|
|
- (go get -v . || true) # TODO: remove this ugly hack
|
|
|
|
- go test -v .
|
2018-06-09 13:41:13 +08:00
|
|
|
|
|
|
|
docker-registry:
|
|
|
|
stage: docker-registry
|
|
|
|
image: docker:stable
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
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
|