Skip to content

Commit da8b89f

Browse files
Vishal VaibhavGitHub Enterprise
authored andcommitted
vela changes (#15)
* vela changes * more docker steps * more docker steps * more docker steps * more docker steps * removed drone file * removed drone file * vela badge link
1 parent 278b3a1 commit da8b89f

5 files changed

Lines changed: 128 additions & 98 deletions

File tree

.drone.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ coverage.txt
44
coverage.xml
55
vendor/
66
/plugin
7+
pull-request-code-coverage

.vela.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
version: "1"
2+
3+
build: &build
4+
image: golang:1.13
5+
environment:
6+
- CGO_ENABLED=0
7+
- GOOS=linux
8+
- GO111MODULE=on
9+
commands:
10+
- go get github.com/axw/gocov/gocov
11+
- go get github.com/AlekSi/gocov-xml
12+
- go test -v -coverpkg=./... -coverprofile=coverage.txt ./...
13+
- go tool cover -func=coverage.txt
14+
- gocov convert coverage.txt | gocov-xml > ./coverage.xml
15+
- cat ./coverage.xml
16+
- go build -a -installsuffix cgo -o bin/plugin
17+
18+
check-pr-code-coverage: &check-pr-code-coverage
19+
image: alpine:latest
20+
environment:
21+
- PLUGIN_COVERAGE_FILE=./coverage.xml
22+
- PLUGIN_COVERAGE_TYPE=cobertura
23+
- PLUGIN_SOURCE_DIRS=git.target.com/searchoss/pull-request-code-coverage
24+
- PLUGIN_RUN_DIR=bin
25+
- PLUGIN_GH_API_BASE_URL=https://git.target.com
26+
secrets:
27+
- source: pull_request_api_key
28+
target: plugin_gh_api_key
29+
commands:
30+
- apk --no-cache add ca-certificates git bash openssh-client
31+
- ./scripts/start.sh
32+
steps:
33+
- name: build-push
34+
image: golang:1.13
35+
<<: *build
36+
ruleset:
37+
branch:
38+
- master
39+
event:
40+
- push
41+
42+
- name : check-format-on-pr
43+
image: golang:1.13
44+
commands:
45+
- make format
46+
ruleset:
47+
branch:
48+
- master
49+
event:
50+
- pull_request
51+
52+
- name : check-lint-on-pr
53+
image: golangci/golangci-lint
54+
pull: true
55+
commands:
56+
- golangci-lint run
57+
ruleset:
58+
branch:
59+
- master
60+
event:
61+
- pull_request
62+
63+
- name : build-on-pr
64+
<<: *build
65+
ruleset:
66+
branch:
67+
- master
68+
event:
69+
- pull_request
70+
71+
- name: check-pr-code-coverage
72+
<<: *check-pr-code-coverage
73+
ruleset:
74+
branch:
75+
- master
76+
event:
77+
- pull_request
78+
when:
79+
event: [pull_request]
80+
81+
- name: docker-pull-request
82+
image: docker.target.com/vela-plugins/docker:v0.2.3-1
83+
ruleset:
84+
branch:
85+
- master
86+
event:
87+
- pull_request
88+
secrets: [ docker_password ]
89+
parameters:
90+
dry_run: true
91+
registry: docker.target.com
92+
repo: docker.target.com/app/pull-request-code-coverage
93+
tags:
94+
- latest
95+
- 1-${BUILD_COMMIT:0:7}
96+
dockerfile: Dockerfile
97+
username: svcpejkn001
98+
99+
100+
- name: docker-push
101+
image: docker.target.com/vela-plugins/docker:v0.2.3-1
102+
ruleset:
103+
branch:
104+
- master
105+
event:
106+
- push
107+
secrets: [ docker_password ]
108+
parameters:
109+
registry: docker.target.com
110+
repo: docker.target.com/app/pull-request-code-coverage
111+
tags:
112+
- latest
113+
- 1-${BUILD_COMMIT:0:7}
114+
dockerfile: Dockerfile
115+
username: svcpejkn001
116+
117+
secrets:
118+
- name: docker_password
119+
key: tap/vela-secrets/ARTIFACTORY_SVCPEJKN001_BINREPO
120+
engine: native
121+
type: shared
122+

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
12
# pull-request-code-coverage
23

4+
[![Build Status](https://vela-server.prod.target.com/badge/TargetOSS/pull-request-code-coverage/status.svg)](https://vela.prod.target.com/TargetOSS/pull-request-code-coverage)
5+
36
Drone plugin to allow detecting code coverage for only the lines changed in a PR.
47

58
Sometimes when working to get a repo to an acceptable level of code coverage, it can be hard to tell if one change is

scripts/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ git config --global user.name "drone"
3838
git config --global user.email "drone@drone.shipt.com"
3939

4040

41-
git fetch --no-tags origin $branch
42-
git --no-pager diff --unified=0 origin/$branch $PLUGIN_MODULE | $PLUGIN_RUN_DIR/plugin
41+
git fetch --no-tags origin "$branch"
42+
git --no-pager diff --unified=0 origin/"$branch" $PLUGIN_MODULE | $PLUGIN_RUN_DIR/plugin

0 commit comments

Comments
 (0)