Skip to content

Commit

Permalink
adds GHA (#205)
Browse files Browse the repository at this point in the history
* adds GHA
* make test and host lookup error reporting less env. dependent
  • Loading branch information
basvanbeek authored Oct 26, 2021
1 parent 4319f91 commit 5aa399b
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 62 deletions.
File renamed without changes.
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
jobs:
build:
working_directory: /go/src/github.com/openzipkin/zipkin-go
parallelism: 1
docker:
- image: circleci/golang
steps:
- checkout
- run: go mod download
- run: make vet test bench
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: test
on:
push:
branches:
- main
paths-ignore:
- "**/*.md"
- "LICENSE"
pull_request:

jobs:
"CI":
env:
GO111MODULE: on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: ["1.17"]
include:
- os: ubuntu-latest
go: "1.14"
- os: ubuntu-latest
go: "1.15"
- os: ubuntu-latest
go: "1.16"
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- name: Lint files
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest

- name: Run tests
run: go test -coverprofile coverage.txt -v ./...
env:
CGO_ENABLED: 1

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: zipkin-go test reports
fail_ci_if_error: true
files: ./coverage.txt
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ linters:

linters-settings:
dupl:
threshold: 400
lll:
threshold: 400
lll:
line-length: 170
gocyclo:
min-complexity: 20
Expand Down
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.

# Zipkin Library for Go

[![Travis CI](https://travis-ci.org/openzipkin/zipkin-go.svg?branch=master)](https://travis-ci.org/openzipkin/zipkin-go)
[![CircleCI](https://circleci.com/gh/openzipkin/zipkin-go.svg?style=shield)](https://circleci.com/gh/openzipkin/zipkin-go)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/1d0e5k96g10ajl63/branch/master?svg=true)](https://ci.appveyor.com/project/basvanbeek/zipkin-go)
[![Coverage Status](https://img.shields.io/coveralls/github/openzipkin/zipkin-go.svg)](https://coveralls.io/github/openzipkin/zipkin-go?branch=master)
Expand Down
19 changes: 0 additions & 19 deletions circle.yml

This file was deleted.

3 changes: 2 additions & 1 deletion endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package zipkin

import (
"fmt"
"net"
"strconv"
"strings"
Expand Down Expand Up @@ -54,7 +55,7 @@ func NewEndpoint(serviceName string, hostPort string) (*model.Endpoint, error) {

addrs, err := net.LookupIP(host)
if err != nil {
return nil, err
return nil, fmt.Errorf("host lookup failure: %w", err)
}

for i := range addrs {
Expand Down
2 changes: 1 addition & 1 deletion endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestNewEndpointFailsDueToLookupIP(t *testing.T) {
t.Fatal("expected error")
}

if !strings.Contains(err.Error(), "no such host") {
if !strings.Contains(err.Error(), "host lookup failure") {
t.Fatalf("expected no such host error, got: %s", err.Error())
}
}
Expand Down

0 comments on commit 5aa399b

Please sign in to comment.