代码拉取完成,页面将自动刷新
stages:
- tests
- build
- release
.tests-setup: &tests-setup
image: golang:1.14.4
# rules:
# - when: always
variables:
GITHUB_ROOT: "github.com/NVIDIA"
PROJECT_GOPATH: "${GITHUB_ROOT}/k8s-device-plugin"
before_script:
- mkdir -p ${GOPATH}/src/${GITHUB_ROOT}
- ln -s ${CI_PROJECT_DIR} ${GOPATH}/src/${PROJECT_GOPATH}
.build-and-release-setup: &build-and-release-setup
image: docker.4pd.io/build:11.0
# services:
# - docker:stable-dind
# before_script:
# - apk add make
# Run a series of sanity-check tests over the code
lint:
<<: *tests-setup
stage: tests
script:
- go get -u golang.org/x/lint/golint
- go mod vendor
- golint -set_exit_status ${PROJECT_GOPATH}
vet:
<<: *tests-setup
stage: tests
script:
- go vet ${PROJECT_GOPATH}
unit_test:
<<: *tests-setup
stage: tests
script:
- go test ${PROJECT_GOPATH}
fmt:
<<: *tests-setup
stage: tests
script:
- res=$(gofmt -l *.go)
- echo "$res"
- test -z "$res"
ineffassign:
<<: *tests-setup
stage: tests
script:
- go get -u github.com/gordonklaus/ineffassign
- go mod vendor
- ineffassign *.go
misspell:
<<: *tests-setup
stage: tests
script:
- go get -u github.com/client9/misspell/cmd/misspell
- go mod vendor
- misspell *.go
# Build pushes to the local gitlab registry
build:device-plugin:
<<: *build-and-release-setup
stage: build
# rules:
# - when: always
script:
# - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- make REGISTRY="${CI_REGISTRY_IMAGE}" VERSION="${CI_COMMIT_SHA}" all
- make REGISTRY="${CI_REGISTRY_IMAGE}" VERSION="${CI_COMMIT_SHA}" push
- make REGISTRY="${CI_REGISTRY_IMAGE}" VERSION="${CI_COMMIT_SHA}" push-short
- make REGISTRY="${CI_REGISTRY_IMAGE}" VERSION="${CI_COMMIT_SHA}" push-latest
# Release pushes to dockerhub
release:device-plugin:
<<: *build-and-release-setup
stage: release
only:
- tags
script:
- docker login -u "${REGISTRY_USER}" -p "${REGISTRY_TOKEN}"
- make VERSION="${CI_COMMIT_TAG}" all
- make VERSION="${CI_COMMIT_TAG}" push
- make VERSION="${CI_COMMIT_TAG}" push-short
- make VERSION="${CI_COMMIT_TAG}" push-latest
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。