62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
stages:
|
|
- build
|
|
- test
|
|
- deploy
|
|
- doc
|
|
|
|
before_script:
|
|
- go get -u github.com/jstemmer/go-junit-report
|
|
- go get -u github.com/t-yuki/gocover-cobertura
|
|
|
|
Create Documentation:
|
|
stage: doc
|
|
script:
|
|
- chmod +x docs/gradlew
|
|
- cd docs; ./gradlew asciidoctor
|
|
artifacts:
|
|
paths:
|
|
- docs/build/asciidoc/pdf/kalorienmanager.pdf
|
|
|
|
Compile Go Application:
|
|
stage: build
|
|
script: make build
|
|
|
|
Test Go Application:
|
|
stage: test
|
|
script:
|
|
- make test
|
|
- GOPATH=$HOME/go go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml
|
|
- GOPATH=$HOME/go go vet ./...
|
|
- ansible-playbook kalorienmanager-ansible.yml
|
|
artifacts:
|
|
reports:
|
|
junit: report.xml
|
|
|
|
Deploy To Staging:
|
|
stage: deploy
|
|
script:
|
|
- make build
|
|
- ssh kalorienmanager /home/kalorienmanager/app-test_service stop
|
|
- rsync -av templates kalorienmanager:/home/kalorienmanager/staging
|
|
- rsync -av bin/kalorienmanager kalorienmanager:/home/kalorienmanager/staging
|
|
- ssh kalorienmanager /home/kalorienmanager/app-test_service start
|
|
environment:
|
|
name: staging
|
|
only:
|
|
- master
|
|
|
|
Deploy to Production:
|
|
stage: deploy
|
|
script:
|
|
- make build
|
|
- ssh kalorienmanager /home/kalorienmanager/app_service stop
|
|
- rsync -av templates kalorienmanager:/home/kalorienmanager/production
|
|
- rsync -av bin/kalorienmanager kalorienmanager:/home/kalorienmanager/production
|
|
- ssh kalorienmanager /home/kalorienmanager/app_service start
|
|
environment:
|
|
name: production
|
|
only:
|
|
- master
|
|
when: manual
|
|
|