Skip to content

Commit 0eb8e03

Browse files
author
Jalander Ramagiri
committed
Adding workflow CI to test lint and unit test
Signed-off-by: Jalander Ramagiri <[email protected]>
1 parent 3626fe7 commit 0eb8e03

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

.github/workflows/ci.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types:
6+
- "opened"
7+
- "synchronize"
8+
paths-ignore:
9+
- "README.md"
10+
- ".gitignore"
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
env:
16+
GOPATH: /home/runner/go
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: 1.21
24+
- name: golangci-lint
25+
uses: golangci/golangci-lint-action@v4
26+
with:
27+
version: v1.54
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
env:
32+
GOPATH: /home/runner/go
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Setup Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version: 1.21
40+
- name: Test
41+
run: go test -v ./...
42+
- name: Upload coverage reports to Codecov
43+
uses: codecov/codecov-action@v3

pkg/gerrit/event.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package gerrit
1919

2020
import (
2121
"encoding/json"
22-
"errors"
2322
"fmt"
2423
"log"
2524
"net/http"
@@ -80,7 +79,7 @@ func (pEvent *GerritEvent) TranslateIntoCDEvent() (string, error) {
8079
}
8180
default:
8281
log.Printf("Not handling CDEvent translation for Gerrit event type: %s\n", eventMap["type"])
83-
return "", errors.New(fmt.Sprintf("Gerrit event %s, not supported for translation", eventType))
82+
return "", fmt.Errorf("gerrit event type %s, not supported for translation", eventType)
8483
}
8584
return cdEvent, nil
8685
}

0 commit comments

Comments
 (0)