123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- ###################### Begin Defaults
- stages:
- - all
- variables:
- GIT_DEPTH: 0
- GIT_STRATEGY: clone
- default:
- before_script:
- - |
- # before_script
- echo "Starting before_script actions."
- echo "Finished before_script actions."
- after_script:
- - |
- # after_script
- echo "Starting after_script actions."
- echo "Finished after_script actions."
- ###################### End Defaults
- ###################### Begin Common Blocks
- .scriptCommon: &scriptCommon |
- # scriptCommon
- echo "Project Name : $CI_PROJECT_TITLE"
- echo "Project Git Commit : $CI_COMMIT_SHA"
- echo "Project Git Branch : $CI_COMMIT_BRANCH"
- echo "GitLab CI User Details : $GITLAB_USER_LOGIN - $GITLAB_USER_NAME ($GITLAB_USER_ID) $GITLAB_USER_EMAIL"
- echo "GitLab CI Job Name : $CI_JOB_NAME"
- echo "GitLab CI Job ID : $CI_JOB_ID"
- echo "GitLab CI Job Stage : $CI_JOB_STAGE"
- echo "GitLab CI Runner Details : $CI_RUNNER_VERSION ($CI_RUNNER_REVISION)"
- .scriptGoVersion: &scriptGoVersion |
- # scriptGoVersion
- echo "Go Compiler Version:"
- go version
- echo "Go Default Environment:"
- go env
- echo "Go Current Environment:"
- go tool dist env -p
- .scriptGitPre: &scriptGitPre |
- # scriptGitPre
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git --no-pager fetch --tags
- git --no-pager fetch --all --recurse-submodules=yes
- git --no-pager update-index -q --refresh --really-refresh
- git --no-pager for-each-ref --count=1
- git --no-pager reset --hard
- git --no-pager diff --full-index --exit-code
- ###################### End Common Blocks
- ###################### Begin Windows Build + Test
- windows job:
- tags:
- - Windows-x86_64
- stage: all
- script:
- - *scriptCommon
- - $env:Path += ";C:\Program Files\Git\cmd;C:\Go\bin"
- - $env:GO111MODULE="on"
- - $env:GOPROXY="https://proxy.golang.org,direct"
- - $env:CGO_ENABLED="0"
- - *scriptGoVersion
- - go clean -modcache -cache -r
- - go mod download
- - go mod verify
- - *scriptGitPre
- - go build -v -a -trimpath .\...
- - |
- # status
- echo "Build completed successfully - running tests; coverage and race detector enabled"
- echo "TODO: Port of full coverage tools to PowerShell"
- - $env:CGO_ENABLED="1"
- - go test -v -cover -covermode="atomic" -race -count="1" -cpu="2" -parallel="2" .\...
- ###################### End Windows Build + Test
- ###################### Begin Linux
- linux job:
- tags:
- - Linux-x86_64
- stage: all
- script:
- - *scriptCommon
- - |
- # upgrade system, install development tools
- - yum install dnf -y
- - yum clean all -y
- - dnf upgrade --refresh -y
- - dnf groupinstall "Development Tools" -y
- - dnf install epel-release centos-release-scl centos-release-scl-rh -y
- - dnf install ccache pv valgrind graphviz clang zsh scl-utils devtoolset-9 -y
- - dnf groupupdate base -y
- - source /opt/rh/devtoolset-9/enable
- - dnf clean all -y
- - |
- # gimme go 1.15.6
- bash --norc --noprofile --posix -o pipefail -c "set -e && mkdir -p /tools/bin && curl -fsSL -o /tools/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme && chmod a+x /tools/bin/gimme"
- bash --norc --noprofile --posix -o pipefail -c "set -e && mkdir -p /tools/gimme && GIMME_SILENT_ENV=1 GIMME_ENV_PREFIX=/tools/gimme/env GIMME_VERSION_PREFIX=/tools/gimme/ver GIMME_GO_VERSION=1.15.6 GIMME_CGO_ENABLED=1 /tools/bin/gimme" > /tools/genv && source /tools/genv
- - source /tools/genv
- - go env -w GO111MODULE=on && export GO111MODULE=on
- - export GOPROXY="https://proxy.golang.org,direct" && go env -w GOPROXY="${GOPROXY:?}"
- - *scriptGoVersion
- - go clean -modcache -cache -r -x
- - *scriptGitPre
- - CGO_ENABLED=0 go build -v -a -trimpath $(go list ./... | grep -v test | sort | uniq)
- - |
- # status
- echo "Build completed successfully - running race-enabled testing."
- - CGO_ENABLED=1 go test -v -a -cover -covermode=atomic -race -count=1 -cpu=2 -parallel=2 $(go list ./... | grep -v test | sort | uniq)
- ###################### End Linux Build + Test
- ###################### Begin macOS Build + Test
- macos job:
- tags:
- - macOS_X-x86_64
- stage: all
- script:
- - |
- # update tools
- bash --norc --noprofile --posix -c "brew update || true" || true
- bash --norc --noprofile --posix -c "brew upgrade || true" || true
- - *scriptCommon
- - if type brew >/dev/null 2>&1; then export HOMEBREW_PREFIX=$(brew --prefix 2>/dev/null); for dir in ${HOMEBREW_PREFIX:?}/opt/*/libexec/gnubin; do export PATH="${dir:?}:${PATH:?}"; done; fi
- - export PATH="/usr/local/opt/gcc/bin:${PATH:?}"
- - go env -w GO111MODULE=on && export GO111MODULE=on
- - export GOPROXY="https://proxy.golang.org,direct" && go env -w GOPROXY="${GOPROXY:?}"
- - export PRIVPATH=$(mktemp -d "${HOME:?}/.XXXXXXXXXXXXXXXX")
- - export NEW_GOPATH=$(mktemp -d "${PRIVPATH:?}/XXXXXXXXXXXXXXXX")
- - export NEW_GOCACHE=$(mktemp -d "${PRIVPATH:?}/XXXXXXXXXXXXXXXX")
- - export NEW_GOMODCACHE=$(mktemp -d "${PRIVPATH:?}/XXXXXXXXXXXXXXXX")
- - export GOPATH="${NEW_GOPATH:?}" && go env -w GOPATH="${NEW_GOPATH:?}"
- - export GOCACHE="${NEW_GOCACHE:?}" && go env -w GOCACHE="${NEW_GOCACHE:?}"
- - export GOMODCACHE="${NEW_GOMODCACHE:?}" && go env -w GOMODCACHE="${NEW_GOMODCACHE:?}"
- - *scriptGoVersion
- - go clean -testcache -modcache -cache -r -x
- - *scriptGitPre
- - GOMAXPROCS=8 CGO_ENABLED=0 go build -v -a -trimpath $(go list ./... | grep -v test | sort | uniq)
- - |
- # status
- echo "Build completed successfully - running race-enabled tests."
- - GOMAXPROCS=8 CGO_ENABLED=1 go test -v -a -cover -covermode=atomic -race -count=1 -cpu=2 -parallel=2 $(go list ./... | grep -v test | sort | uniq)
- - |
- # cleaning up
- - chmod -R u+rwx "${GOPATH:?}"/* 2>/dev/null && rm -rf -- "${GOPATH:?}"/* 2>/dev/null || true :;
- - chmod -R u+rwx "${GOCACHE:?}"/* 2>/dev/null && rm -rf -- "${GOCACHE:?}"/* 2>/dev/null || true :;
- - chmod -R u+rwx "${GOMODCACHE:?}"/* 2>/dev/null && rm -rf -- "${GOMODCACHE:?}"/* 2>/dev/null || true :;
- ###################### End macOS Build + Test
|