Skip to content

Fix the build #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM codeclimate/alpine-ruby:b36
FROM alpine:3.2

WORKDIR /usr/src/app
COPY bin/ /usr/src/app
ADD build/codeclimate-golint /usr/src/app/

RUN adduser -u 9000 -D app
USER app
Expand Down
18 changes: 18 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -ex

IMAGE="$1"
: "${IMAGE:=codeclimate/codeclimate-golint}"

DIR=$( cd "$( dirname "${0}" )" && pwd )
SRC_ROOT=$( cd "$DIR/.." && pwd )
cd "$SRC_ROOT"

BUILD_SCRIPT="cd /src && "\
"go get -t -d -v ./... && "\
"rm -rf build && mkdir build && "\
"go build -o build/codeclimate-golint ."

docker run -v "$SRC_ROOT:/src" yunspace/alpine-golang /bin/sh -c "$BUILD_SCRIPT"

docker build -t "$IMAGE" .
Binary file removed bin/codeclimate-golint
Binary file not shown.
22 changes: 12 additions & 10 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ machine:
- docker
environment:
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
image_name: codeclimate-golint

dependencies:
pre:
- echo $gcloud_json_key_base64 | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
- curl https://sdk.cloud.google.com | bash
- gcloud auth activate-service-account $gcloud_account_email --key-file /tmp/gcloud_key.json
- gcloud docker -a
PRIVATE_REGISTRY: us.gcr.io/code_climate

test:
override:
- docker build -t=$registry_root/$image_name:b$CIRCLE_BUILD_NUM .
- ./bin/build $PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM

deployment:
registry:
branch: master
owner: codeclimate-community
commands:
- docker push $registry_root/$image_name:b$CIRCLE_BUILD_NUM
- echo $gcloud_json_key_base64 | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
- curl https://sdk.cloud.google.com | bash
- gcloud auth activate-service-account --key-file /tmp/gcloud_key.json
- gcloud docker -a
- docker push $PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM

notify:
webhooks:
- url: https://cc-slack-proxy.herokuapp.com/circle
Binary file removed codeclimate-golint
Binary file not shown.
4 changes: 2 additions & 2 deletions codeclimate-golint.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
Description: "Could not read file",
Location: &engine.Location{
Path: path,
Lines: &engine.Position{
Lines: &engine.LinesOnlyPosition{
Begin: 1,
End: 1,
},
Expand Down Expand Up @@ -97,7 +97,7 @@ func codeClimateLocation(l *lint.Problem, path string, rootPath string) *engine.

return &engine.Location{
Path: strings.SplitAfter(path, rootPath)[1],
Lines: &engine.Position{
Lines: &engine.LinesOnlyPosition{
Begin: position.Line,
End: position.Line,
},
Expand Down