From 9e03d3c93490885145d475baee708d13299f25e7 Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Sun, 18 Feb 2018 01:00:39 +0100 Subject: [PATCH] Add concourse pipeline. --- _ci/build.sh | 17 +++++++++++++++++ _ci/build.yml | 12 ++++++++++++ _ci/pipeline.yml | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100755 _ci/build.sh create mode 100644 _ci/build.yml create mode 100644 _ci/pipeline.yml diff --git a/_ci/build.sh b/_ci/build.sh new file mode 100755 index 0000000..9b358de --- /dev/null +++ b/_ci/build.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e -u -x + +readonly NAME=netatmo-exporter +readonly PACKAGE=github.com/xperimental/netatmo-exporter +readonly BUILDS=(linux/amd64 linux/arm darwin/amd64 windows/amd64) + +mkdir -p gopath/src/github.com/xperimental/ +ln -s "$PWD/source" "gopath/src/${PACKAGE}" +export GOPATH=$PWD/gopath + +for build in "${BUILDS[@]}"; do + echo "Build: $build" + IFS="/" read -a buildinfo <<< "$build" + GOOS=${buildinfo[0]} GOARCH=${buildinfo[1]} go build -v -ldflags="-s -w" -o "binaries/${NAME}_${buildinfo[0]}_${buildinfo[1]}" "${PACKAGE}" +done diff --git a/_ci/build.yml b/_ci/build.yml new file mode 100644 index 0000000..15a8338 --- /dev/null +++ b/_ci/build.yml @@ -0,0 +1,12 @@ +platform: linux +image_resource: + type: docker-image + source: + repository: golang + tag: 1.10.0 +inputs: +- name: source +outputs: +- name: binaries +run: + path: source/_ci/build.sh \ No newline at end of file diff --git a/_ci/pipeline.yml b/_ci/pipeline.yml new file mode 100644 index 0000000..1834627 --- /dev/null +++ b/_ci/pipeline.yml @@ -0,0 +1,38 @@ +resource_types: + - name: github-status + type: docker-image + source: + repository: dpb587/github-status-resource + tag: master +resources: +- name: netatmo-exporter + type: git + source: + uri: git://github.com/xperimental/netatmo-exporter.git + branch: master +- name: status + type: github-status + source: + repository: xperimental/netatmo-exporter + access_token: ((repo_github_token)) +jobs: +- name: build + plan: + - get: source + resource: netatmo-exporter + trigger: true + - put: status + params: + state: pending + commit: source + - task: build + file: source/_ci/build.yml + on_failure: + put: status + params: + state: failure + commit: source + - put: status + params: + state: success + commit: source \ No newline at end of file