.gitlab-ci.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Set things up to use the OS-native packages for Go. Anything that
  2. # is downloaded by go during the `go fmt` stage is not coming from the
  3. # Debian/Ubuntu repo. So those would need to be packaged for this to
  4. # make it into Debian and/or Ubuntu.
  5. .debian-native-template: &debian-native-template
  6. variables:
  7. DEBIAN_FRONTEND: noninteractive
  8. GOPATH: /usr/share/gocode
  9. before_script:
  10. - apt-get -qy update
  11. - apt-get -qy install --no-install-recommends
  12. build-essential
  13. ca-certificates
  14. git
  15. golang
  16. golang-github-cheekybits-genny-dev
  17. golang-github-jtolds-gls-dev
  18. golang-github-klauspost-reedsolomon-dev
  19. golang-github-lucas-clemente-quic-go-dev
  20. golang-github-smartystreets-assertions-dev
  21. golang-github-smartystreets-goconvey-dev
  22. golang-github-tjfoc-gmsm-dev
  23. golang-github-xtaci-kcp-dev
  24. golang-github-xtaci-smux-dev
  25. golang-golang-x-crypto-dev
  26. golang-golang-x-net-dev
  27. golang-golang-x-sys-dev
  28. golang-golang-x-text-dev
  29. golang-golang-x-xerrors-dev
  30. lbzip2
  31. # use Go installed as part of the official, Debian-based Docker images
  32. .golang-docker-debian-template: &golang-docker-debian-template
  33. variables:
  34. DEBIAN_FRONTEND: noninteractive
  35. before_script:
  36. - apt-get -qy update
  37. - apt-get -qy install --no-install-recommends
  38. ca-certificates
  39. git
  40. lbzip2
  41. .go_test: &go-test
  42. - test -z "$(go fmt ./...)"
  43. - go vet ./...
  44. - go test -v -race ./...
  45. - cd $CI_PROJECT_DIR/client/
  46. - go get
  47. - go build
  48. .test-template: &test-template
  49. artifacts:
  50. name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
  51. paths:
  52. - client/*.aar
  53. - client/*.jar
  54. - client/client
  55. expire_in: 1 day
  56. when: on_success
  57. after_script:
  58. - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
  59. # -- jobs ------------------------------------------------------------
  60. android:
  61. image: registry.gitlab.com/fdroid/ci-images-client
  62. variables:
  63. GOPATH: "/go"
  64. ANDROID_VERSION: 29
  65. cache:
  66. paths:
  67. - .gradle/wrapper
  68. - .gradle/caches
  69. before_script:
  70. - apt-get -qy update
  71. - apt-get -qy install --no-install-recommends
  72. build-essential
  73. gnupg
  74. wget
  75. - cd /usr/local
  76. - export gotarball="go1.15.10.linux-amd64.tar.gz"
  77. - wget -q https://dl.google.com/go/${gotarball}
  78. - wget -q https://dl.google.com/go/${gotarball}.asc
  79. - curl https://dl.google.com/linux/linux_signing_key.pub | gpg --import
  80. - gpg --verify ${gotarball}.asc
  81. - echo "4aa1267517df32f2bf1cc3d55dfc27d0c6b2c2b0989449c96dd19273ccca051d ${gotarball}" | sha256sum -c
  82. - tar -xzf ${gotarball}
  83. - export PATH="/usr/local/go/bin:$GOPATH/bin:$PATH" # putting this in 'variables:' cause weird runner errors
  84. - cd $CI_PROJECT_DIR
  85. script:
  86. - *go-test
  87. - export GRADLE_USER_HOME=$PWD/.gradle
  88. - go version
  89. - go env
  90. - go get golang.org/x/mobile/cmd/gomobile
  91. - go get golang.org/x/mobile/cmd/gobind
  92. - go install golang.org/x/mobile/cmd/gomobile
  93. - go install golang.org/x/mobile/cmd/gobind
  94. - echo y | $ANDROID_HOME/tools/bin/sdkmanager 'ndk-bundle' > /dev/null
  95. - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_VERSION}" > /dev/null
  96. - gomobile init
  97. - git -C $CI_PROJECT_DIR reset --hard
  98. - git -C $CI_PROJECT_DIR clean -fdx
  99. - cd $CI_PROJECT_DIR/client
  100. # gomobile builds a shared library not a CLI executable
  101. - sed -i 's,^package main$,package snowflakeclient,' snowflake.go
  102. - gomobile bind -v -target=android .
  103. <<: *test-template
  104. go-1.13:
  105. image: golang:1.13-stretch
  106. <<: *golang-docker-debian-template
  107. <<: *test-template
  108. script:
  109. - *go-test
  110. go-1.14:
  111. image: golang:1.14-stretch
  112. <<: *golang-docker-debian-template
  113. <<: *test-template
  114. script:
  115. - *go-test
  116. debian-testing:
  117. image: debian:testing
  118. <<: *debian-native-template
  119. <<: *test-template
  120. script:
  121. - *go-test