Skip to content

Commit

Permalink
Adding CI
Browse files Browse the repository at this point in the history
  • Loading branch information
shinji62 committed Apr 13, 2016
1 parent 8d0e6da commit e407d2e
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
all: test linux32 linux64 darwin64
all: test compile
compile: linux32 linux64 darwin64


test:
ginkgo -r .
ginkgo -r -v .

linux32:
GOARCH=386 GOOS=linux godep go build -o dist/firehose-to-syslog-linux32
GOARCH=386 GOOS=linux godep go build -o dist/linux/386/firehose-to-syslog_linux_386

linux64:
GOARCH=amd64 GOOS=linux godep go build -o dist/firehose-to-syslog-linux64
GOARCH=amd64 GOOS=linux godep go build -o dist/linux/amd64/firehose-to-syslog_linux_amd64

darwin64:
GOARCH=amd64 GOOS=darwin godep go build -o dist/firehose-to-syslog-darwin64
GOARCH=amd64 GOOS=darwin godep go build -o dist/darwin/amd64/firehose-to-syslog_darwin_amd64

clean:
-rm -rf dist/*
-rm -rf *.prof

docker-dev:
$(SHELL) ./Docker/build-dev.sh

docker-final:
$(SHELL) ./Docker/build.sh

clean:
$(RM) dist/*
$(RM) *.prof
$(SHELL) ./Docker/build.sh
16 changes: 16 additions & 0 deletions ci/build-all/build-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e -u -x
ls -lah
export ROOT_DIR=$PWD
mkdir -p $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
cp -R firehose-to-syslog-ci/* $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
cd $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
go get github.com/tools/godep
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega
go get github.com/golang/protobuf/proto
godep restore
make clean
make compile
mv dist ${ROOT_DIR}/firehose-to-syslog-ci-build/
17 changes: 17 additions & 0 deletions ci/build-all/build-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
platform: linux

image_resource:
type: docker-image
source:
repository: getourneau/alpine-golang-bash


inputs:
- name: firehose-to-syslog-ci

outputs:
- name: firehose-to-syslog-ci-build

run:
path: firehose-to-syslog-ci/ci/build-all/build-all
25 changes: 25 additions & 0 deletions ci/merge-master-to-develop/merge-master-to-develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -exu

MERGED_REPO="${PWD}/${MERGED_REPO:?"MERGED_REPO required"}"
MASTER_BRANCH="${MASTER_BRANCH:-master}"
GIT_USERNAME="${GIT_USERNAME:?"GIT_USERNAME required"}"
GIT_EMAIL="${GIT_EMAIL:?"GIT_EMAIL required"}"

# Cannot set -u before sourcing .bashrc because of all
# the unbound variables in things beyond our control.
set +u
set -u

pushd release-repo > /dev/null
git config user.name "${GIT_USERNAME}"
git config user.email "${GIT_EMAIL}"

git remote add -f master-repo ../release-repo-master
git merge --no-edit "master-repo/${MASTER_BRANCH}"

git status
git show --color | cat
popd > /dev/null

shopt -s dotglob
cp -R release-repo/* $MERGED_REPO
24 changes: 24 additions & 0 deletions ci/merge-master-to-develop/merge-master-to-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
platform: linux

image_resource:
type: docker-image
source:
repository: getourneau/alpine-bash-git

inputs:
- name: firehose-to-syslog-ci
- name: release-repo
- name: release-repo-master

outputs:
- name: final-release-repo

run:
path: firehose-to-syslog-ci/ci/merge-master-to-develop/merge-master-to-develop

params:
MASTER_BRANCH:
GIT_USERNAME:
GIT_EMAIL:
MERGED_REPO: final-release-repo
161 changes: 161 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
groups:
- name: firehose-to-syslog
jobs:
- unit-testing
- downstream-master
- unit-testing-master
- tag-master
- ship-it
- name: master
jobs:
- downstream-master
- unit-testing-master
- tag-master
- ship-it
- name: develop
jobs:
- unit-testing



jobs:
- name: unit-testing
public: true
serial: true
plan:
- get: firehose-to-syslog-ci
resource: firehose-to-syslog-develop
trigger: true
- task: unit-testing
file: firehose-to-syslog-ci/ci/unit-testing/unit-testing.yml


- name: unit-testing-master
public: true
serial: true
plan:
- get: firehose-to-syslog-ci
resource: firehose-to-syslog-master
trigger: true
- task: unit-testing
file: firehose-to-syslog-ci/ci/unit-testing/unit-testing.yml


- name: tag-master
public: true
serial: true
plan:
- get: firehose-to-syslog-ci
resource: firehose-to-syslog-master
passed: [unit-testing-master]
- put: version
params: {bump: minor}
- put: firehose-to-syslog-master
params:
only_tag: true
repository: firehose-to-syslog-ci
tag: version/number


- name: ship-it
public: true
serial: true
plan:
- get: firehose-to-syslog-ci
resource: firehose-to-syslog-master
passed: [tag-master]
trigger: true
- get: version
- task: build-binary
file: firehose-to-syslog-ci/ci/build-all/build-all.yml
- put: gh-release
params :
name: version/number
tag: version/number
globs:
- firehose-to-syslog-ci-build/dist/*/*/*







- name: downstream-master
public: true
serial: true
plan:
- aggregate:
- get: firehose-to-syslog-ci
resource: firehose-to-syslog-develop
- get: release-repo-master
resource: firehose-to-syslog-master
trigger: true
passed: [tag-master]
- get: release-repo
resource: firehose-to-syslog-merge-target
- task: merge-master-to-develop
file: firehose-to-syslog-ci/ci/merge-master-to-develop/merge-master-to-develop.yml
params:
GIT_USERNAME: {{github-username}}
GIT_EMAIL: {{github-mail}}




resources:
- name: firehose-to-syslog-merge-target
type: git
source:
branch: develop
private_key: {{private-key-github-concourse}}
uri: [email protected]:cloudfoundry-community/firehose-to-syslog.git

- name: firehose-to-syslog-develop
type: git
source:
uri: [email protected]:cloudfoundry-community/firehose-to-syslog.git
branch: develop
private_key: {{private-key-github-concourse}}

- name: firehose-to-syslog-master
type: git
source:
uri: [email protected]:cloudfoundry-community/firehose-to-syslog.git
branch: master
private_key: {{private-key-github-concourse}}

- name: slack-notification
type: slack
source:
url: {{firehose-to-syslog-hook}}



- name: gh-release
type: github-release
source:
user: cloudfoundry-community
repository: firehose-to-syslog
access_token: {{private-key-github-concourse}}

- name: version
type: semver-gwenn
source:
driver: git
uri: [email protected]:cloudfoundry-community/firehose-to-syslog.git
branch: version
file: version
private_key: {{private-key-github-concourse}}
git_user: {{concourse-user-gitinfo}}



resource_types:
- name: semver-gwenn
type: docker-image
source:
repository: getourneau/semver-resource


12 changes: 12 additions & 0 deletions ci/unit-testing/unit-testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e -u -x

mkdir -p $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
cp -R firehose-to-syslog-ci/* $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
cd $GOPATH/src/github.com/cloudfoundry-community/firehose-to-syslog/
go get github.com/tools/godep
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega
go get github.com/golang/protobuf/proto
godep restore
make test
14 changes: 14 additions & 0 deletions ci/unit-testing/unit-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
platform: linux

image_resource:
type: docker-image
source:
repository: getourneau/alpine-golang-bash

inputs:
- name: firehose-to-syslog-ci

run:
path: firehose-to-syslog-ci/ci/unit-testing/unit-testing

0 comments on commit e407d2e

Please sign in to comment.