# Set things up to use the OS-native packages for Go. Anything that # is downloaded by go during the `go fmt` stage is not coming from the # Debian/Ubuntu repo. So those would need to be packaged for this to # make it into Debian and/or Ubuntu. .debian-native-template: &debian-native-template variables: DEBIAN_FRONTEND: noninteractive GOPATH: /usr/share/gocode before_script: - apt-get -qy update - apt-get -qy install --no-install-recommends build-essential ca-certificates git golang golang-github-cheekybits-genny-dev golang-github-jtolds-gls-dev golang-github-klauspost-reedsolomon-dev golang-github-lucas-clemente-quic-go-dev golang-github-smartystreets-assertions-dev golang-github-smartystreets-goconvey-dev golang-github-tjfoc-gmsm-dev golang-github-xtaci-kcp-dev golang-github-xtaci-smux-dev golang-golang-x-crypto-dev golang-golang-x-net-dev golang-golang-x-sys-dev golang-golang-x-text-dev golang-golang-x-xerrors-dev lbzip2 # use Go installed as part of the official, Debian-based Docker images .golang-docker-debian-template: &golang-docker-debian-template variables: DEBIAN_FRONTEND: noninteractive before_script: - apt-get -qy update - apt-get -qy install --no-install-recommends ca-certificates git lbzip2 .go_test: &go-test - test -z "$(go fmt ./...)" - go vet ./... - go test -v -race ./... - cd $CI_PROJECT_DIR/client/ - go get - go build .test-template: &test-template artifacts: name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}" paths: - client/*.aar - client/*.jar - client/client expire_in: 1 day when: on_success after_script: - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs" # -- jobs ------------------------------------------------------------ android: image: registry.gitlab.com/fdroid/ci-images-client variables: GOPATH: "/go" ANDROID_VERSION: 29 cache: paths: - .gradle/wrapper - .gradle/caches before_script: - apt-get -qy update - apt-get -qy install --no-install-recommends build-essential gnupg wget - cd /usr/local - export gotarball="go1.16.8.linux-amd64.tar.gz" - wget -q https://dl.google.com/go/${gotarball} - wget -q https://dl.google.com/go/${gotarball}.asc - curl https://dl.google.com/linux/linux_signing_key.pub | gpg --import - gpg --verify ${gotarball}.asc - echo "f32501aeb8b7b723bc7215f6c373abb6981bbc7e1c7b44e9f07317e1a300dce2 ${gotarball}" | sha256sum -c - tar -xzf ${gotarball} - export PATH="/usr/local/go/bin:$GOPATH/bin:$PATH" # putting this in 'variables:' cause weird runner errors - cd $CI_PROJECT_DIR script: - *go-test - export GRADLE_USER_HOME=$PWD/.gradle - go version - go env - go get golang.org/x/mobile/cmd/gomobile - go get golang.org/x/mobile/cmd/gobind - go install golang.org/x/mobile/cmd/gobind - go install golang.org/x/mobile/cmd/gomobile - echo y | $ANDROID_HOME/tools/bin/sdkmanager 'ndk-bundle' > /dev/null - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_VERSION}" > /dev/null - gomobile init - git -C $CI_PROJECT_DIR reset --hard - git -C $CI_PROJECT_DIR clean -fdx - cd $CI_PROJECT_DIR/client # gomobile builds a shared library not a CLI executable - sed -i 's,^package main$,package snowflakeclient,' snowflake.go - go get golang.org/x/mobile/bind - gomobile bind -v -target=android . <<: *test-template go-1.13: image: golang:1.13-stretch <<: *golang-docker-debian-template <<: *test-template script: - *go-test go-1.14: image: golang:1.14-stretch <<: *golang-docker-debian-template <<: *test-template script: - *go-test debian-testing: image: debian:testing <<: *debian-native-template <<: *test-template script: - *go-test