stages: - build - test - analysis - deploy before_script: - go get -u github.com/jstemmer/go-junit-report - go get -u github.com/t-yuki/gocover-cobertura Create Documentation: stage: build 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 - go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml - go vet ./... artifacts: reports: junit: report.xml Code analysis: stage: analysis script: - go test -json ./... > test-report.out - go test -coverprofile=coverage.out ./... - /home/gitlab-runner/go/bin/golint ./... > golint-report.out - go vet ./... 2> govet-report.out - /data/sonar-scanner/bin/sonar-scanner -Dsonar.projectVersion=$(git describe --abbrev=0) -Dsonar.host.url=https://sonar.thpeetz.de -Dsonar.login=ed0634e05811fb2b1cdd0f16b0a924f943623520 Deploy To Staging: stage: deploy script: - make build - sudo service kalorienmanager stop - rsync -av templates kalorienmanager:/home/kalorienmanager/staging - rsync -av bin/kalorienmanager kalorienmanager:/home/kalorienmanager/staging - sudo service kalorienmanager start environment: name: staging only: - master Deploy to Production: stage: deploy script: - make build - echo "ansible-playbook kalorienmanager-ansible.yml" - sudo service kalorienmanager stop - rsync -av templates kalorienmanager:/home/kalorienmanager/production - rsync -av bin/kalorienmanager kalorienmanager:/home/kalorienmanager/production - sudo service kalorienmanager start environment: name: production only: - master when: manual