github.com/jghiloni/cli@v6.28.1-0.20170628223758-0ce05fe032a2+incompatible/ci/cli/tasks/build-binaries.yml (about)

     1  platform: linux
     2  
     3  image_resource:
     4    type: docker-image
     5    source:
     6      repository: cloudfoundry/cli-ci
     7  
     8  inputs:
     9  - name: cli
    10    path: gopath/src/code.cloudfoundry.org/cli
    11  
    12  outputs:
    13  - name: cross-compiled
    14  
    15  run:
    16    path: bash
    17    args:
    18    - -c
    19    - |
    20      set -ex
    21  
    22      cwd=$PWD
    23  
    24      export GOPATH=$PWD/gopath
    25      export PATH=$GOPATH/bin:$PATH
    26  
    27      go version
    28  
    29      pushd $GOPATH/src/code.cloudfoundry.org/cli
    30        BUILD_VERSION=$(cat ci/VERSION)
    31        BUILD_SHA=$(git rev-parse --short HEAD)
    32        BUILD_DATE=$(date -u +"%Y-%m-%d")
    33  
    34        VERSION_LDFLAGS="-X code.cloudfoundry.org/cli/version.binaryVersion=${BUILD_VERSION} -X code.cloudfoundry.org/cli/version.binarySHA=${BUILD_SHA} -X code.cloudfoundry.org/cli/version.binaryBuildDate=${BUILD_DATE}"
    35  
    36        echo "Building 32-bit Linux"
    37        CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_i686 .
    38  
    39        echo "Building 64-bit Linux"
    40        CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_x86-64 .
    41  
    42        # This to to add the CF Icon into the windows executable
    43        go get github.com/akavel/rsrc
    44        rsrc -ico ci/installers/windows/cf.ico
    45  
    46        echo "Building 32-bit Windows"
    47        GOARCH=386 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_win32.exe .
    48  
    49        echo "Building 64-bit Windows"
    50        GOARCH=amd64 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_winx64.exe .
    51  
    52        echo "Creating tarball"
    53        tar -cvzf $cwd/cross-compiled/cf-cli-binaries.tgz -C out .
    54      popd