12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- # GDNative-Go Gitlab CI Pipelines
- image: golang:1.15-buster
- variables:
- TAG: $CI_BUILD_REF_NAME
- # release references
- .release_refs: &release_refs
- - "/^master$"
- - "tags"
- # Go Mod caching
- .go-cache:
- variables:
- GOPATH: $CI_PROJECT_DIR/.go
- before_script:
- - mkdir -p .go
- cache:
- paths:
- - .go/pkg/mod
- stages:
- - commits_check
- - linting
- - version
- # ---------------- commits check ----------------
- commit_messages_check:
- stage: commits_check
- image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
- script:
- - release test-git
- allow_failure: false
- except:
- *release_refs
- # ---------------- code checks ----------------
- code_linting:
- extends: .go-cache
- image:
- name: golangci/golangci-lint:latest
- entrypoint: [""]
- stage: linting
- script:
- # get goreturns and add it to the $PATH
- - go get -u github.com/sqs/goreturns
- - export PATH="$PATH:$GOPATH/bin"
- # checkout godot_headers submodule
- - git submodule update --init
- # make sure to download and tidy mods
- - go mod download
- - go mod tidy
- # generate bindings and build library
- - go run build/mage.go generate
- # run linters
- - golangci-lint run -v --timeout 5m
- # run goretuns formating
- - if [[ $(goreturns -d ./gdnative ./cmd) -eq "" ]]; then echo "goreturns check success"; exit 0; fi
- - echo "ERROR - goreturn check failed"
- - goreturns -d ./gdnative ./cmd
- - exit 1
- allow_failure: false
- except:
- - tags
- # ---------------- update version ----------------
- version_update:
- stage: version
- image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
- script:
- - release changelog
- - release commit-and-tag --create-tag-pipeline CHANGELOG.md
- allow_failure: true
- when: on_success
- only:
- - master
|