# 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 .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" script: - test -z "$(go fmt ./...)" - go vet ./... - go test -v -race ./... - cd $CI_PROJECT_DIR/client/ - go get - go build # build for Android if this is the right job - test "$CI_JOB_NAME" = "android" || exit 0 - export GRADLE_USER_HOME=$PWD/.gradle # This build was setup before go.mod was a thing, go back to the old days! # 920f6791f3ec8e7467c43ee0cefffe63200bed2b broke the gomobile build. # https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k - export GO111MODULE=off - 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/gomobile - go install golang.org/x/mobile/cmd/gobind - echo y | $ANDROID_HOME/tools/bin/sdkmanager 'ndk-bundle' > /dev/null - gomobile init # Create symbolic links under $GOPATH, this is needed for local build - export src=$GOPATH/src - mkdir -p $src/git.torproject.org/pluggable-transports - mkdir -p $src/github.com/keroserene - mkdir -p $src/gitlab.com/$CI_PROJECT_NAMESPACE - ln -s $CI_PROJECT_DIR $src/git.torproject.org/pluggable-transports/snowflake - ln -s $CI_PROJECT_DIR $src/github.com/keroserene/snowflake - ln -s $CI_PROJECT_DIR $src/gitlab.com/$CI_PROJECT_PATH - 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 client_test.go - gomobile bind -v -target=android git.torproject.org/pluggable-transports/snowflake/client # -- jobs ------------------------------------------------------------ android: image: registry.gitlab.com/fdroid/ci-images-client variables: GOPATH: "/go" 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.13.12.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 "9cacc6653563771b458c13056265aa0c21b8a23ca9408278484e4efde4160618 ${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 <<: *test-template go-1.13: image: golang:1.13-stretch <<: *golang-docker-debian-template <<: *test-template go-1.14: image: golang:1.14-stretch <<: *golang-docker-debian-template <<: *test-template debian-testing: image: debian:testing <<: *debian-native-template <<: *test-template