johnsonjh/gfpsgo

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
###################### 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 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 upx 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 stable (latest release)
        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=stable 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
    - export GO=`which go` && gmake build && printf %s\\n "It built!"
###################### End Linux Build + Test