.gitlab-ci.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # GDNative-Go Gitlab CI Pipelines
  2. image: golang:1.15-buster
  3. variables:
  4. TAG: $CI_BUILD_REF_NAME
  5. # release references
  6. .release_refs: &release_refs
  7. - "/^master$"
  8. - "tags"
  9. # Go Mod caching
  10. .go-cache:
  11. variables:
  12. GOPATH: $CI_PROJECT_DIR/.go
  13. before_script:
  14. - mkdir -p .go
  15. cache:
  16. paths:
  17. - .go/pkg/mod
  18. stages:
  19. - commits_check
  20. - linting
  21. - version
  22. # ---------------- commits check ----------------
  23. commit_messages_check:
  24. stage: commits_check
  25. image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
  26. script:
  27. - release test-git
  28. allow_failure: false
  29. except:
  30. *release_refs
  31. # ---------------- code checks ----------------
  32. code_linting:
  33. extends: .go-cache
  34. image:
  35. name: golangci/golangci-lint:latest
  36. entrypoint: [""]
  37. stage: linting
  38. script:
  39. # get goreturns and add it to the $PATH
  40. - go get -u github.com/sqs/goreturns
  41. - export PATH="$PATH:$GOPATH/bin"
  42. # checkout godot_headers submodule
  43. - git submodule update --init
  44. # make sure to download and tidy mods
  45. - go mod download
  46. - go mod tidy
  47. # generate bindings and build library
  48. - go run build/mage.go generate
  49. # run linters
  50. - golangci-lint run -v --timeout 5m
  51. # run goretuns formating
  52. - if [[ $(goreturns -d ./gdnative ./cmd) -eq "" ]]; then echo "goreturns check success"; exit 0; fi
  53. - echo "ERROR - goreturn check failed"
  54. - goreturns -d ./gdnative ./cmd
  55. - exit 1
  56. allow_failure: false
  57. except:
  58. - tags
  59. # ---------------- update version ----------------
  60. version_update:
  61. stage: version
  62. image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
  63. script:
  64. - release changelog
  65. - release commit-and-tag --create-tag-pipeline CHANGELOG.md
  66. allow_failure: true
  67. when: on_success
  68. only:
  69. - master