128 lines
2.7 KiB
YAML
128 lines
2.7 KiB
YAML
image: registry.gitlab.com/inetmock/ci-image/go
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
- release
|
|
- deploy
|
|
|
|
variables:
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
DOCKER_CERT_PATH: "/certs/client"
|
|
DOCKER_TLS_VERIFY: 1
|
|
DOCKER_HOST: 'tcp://docker:2376'
|
|
SAST_EXCLUDED_ANALYZERS: "eslint"
|
|
DOCKER_IMAGE: registry.gitlab.com/inetmock/inetmock:$CI_COMMIT_SHORT_SHA
|
|
DOCKERFILE_PATH: build/docker/inetmock.dockerfile
|
|
|
|
.go-cache:
|
|
variables:
|
|
GOPATH: $CI_PROJECT_DIR/.go
|
|
before_script:
|
|
- mkdir -p .go
|
|
cache:
|
|
paths:
|
|
- .go/pkg/mod/
|
|
|
|
.integration-test:
|
|
stage: release
|
|
extends: .go-cache
|
|
services:
|
|
- name: $DOCKER_IMAGE
|
|
alias: inetmock
|
|
- docker:dind
|
|
script:
|
|
- task integration-test
|
|
|
|
test:
|
|
stage: test
|
|
extends: .go-cache
|
|
needs: []
|
|
script:
|
|
- task test-all html-cover-report
|
|
artifacts:
|
|
paths:
|
|
- out/coverage.html
|
|
expire_in: 7 days
|
|
expose_as: Coverage Report
|
|
reports:
|
|
junit: out/report.xml
|
|
cobertura: out/coverage.xml
|
|
|
|
lint:
|
|
stage: test
|
|
extends: .go-cache
|
|
script:
|
|
- task deps generate protobuf-lint
|
|
- golangci-lint run --timeout 5m --issues-exit-code 0 --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'
|
|
artifacts:
|
|
reports:
|
|
codequality: gl-code-quality-report.json
|
|
paths:
|
|
- gl-code-quality-report.json
|
|
|
|
snapshot-release:
|
|
stage: release
|
|
extends: .go-cache
|
|
services:
|
|
- docker:dind
|
|
needs:
|
|
- test
|
|
before_script:
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
script:
|
|
- task snapshot-release
|
|
- docker tag registry.gitlab.com/inetmock/inetmock:latest $DOCKER_IMAGE
|
|
- docker push $DOCKER_IMAGE
|
|
except:
|
|
- tags
|
|
|
|
release:
|
|
stage: release
|
|
extends: .go-cache
|
|
services:
|
|
- docker:dind
|
|
needs:
|
|
- test
|
|
only:
|
|
- tags
|
|
variables:
|
|
GIT_DEPTH: 0
|
|
script:
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
- task release
|
|
|
|
release-integration-test:
|
|
extends: .integration-test
|
|
only:
|
|
- tags
|
|
needs:
|
|
- release
|
|
|
|
snapshot-release-integration-test:
|
|
extends: .integration-test
|
|
except:
|
|
- tags
|
|
needs:
|
|
- snapshot-release
|
|
|
|
include:
|
|
- template: Dependency-Scanning.gitlab-ci.yml
|
|
- template: Security/License-Scanning.gitlab-ci.yml
|
|
- template: Security/SAST.gitlab-ci.yml
|
|
- template: Security/Secret-Detection.gitlab-ci.yml
|
|
- template: Security/Container-Scanning.gitlab-ci.yml
|
|
|
|
pages:
|
|
stage: deploy
|
|
image: registry.gitlab.com/inetmock/ci-image/mdbook
|
|
needs: []
|
|
only:
|
|
refs:
|
|
- master
|
|
- tags
|
|
script:
|
|
- mdbook build -d ./../public ./docs
|
|
artifacts:
|
|
paths:
|
|
- public
|