From e547b6d4b7d58afa162ca3fe0d3df26a1de32891 Mon Sep 17 00:00:00 2001 From: Eliran Bivas Date: Mon, 25 Jan 2021 12:48:00 +0200 Subject: [PATCH 1/3] add go matrix and goverall action --- .github/workflows/go.yaml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index c63b316..3f5e388 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -2,16 +2,19 @@ name: go-build on: [push, pull_request] jobs: build: - name: build, test, lint + name: build ( ${{ matrix.go }} ), test, lint runs-on: ubuntu-latest + strategy: + matrix: + go: [ '1.15', '1.14', '1.13' ] steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 - - name: Check out source code - uses: actions/checkout@v1 + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} - name: Build env: @@ -21,10 +24,16 @@ jobs: - name: Test env: GOPROXY: "https://proxy.golang.org" - run: go test -v ./... + run: go test -v -race -coverprofile=profile.cov ./... - name: Install golangci-lint run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.20.0 - name: Run golangci-lint - run: $(go env GOPATH)/bin/golangci-lint run -E golint -E gosec -E gofmt + run: golangci-lint run -E golint -E gosec -E gofmt + + - name: Send coverage + if: ${{ matrix.go }} == '1.15' + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: profile.cov \ No newline at end of file From 9994c97b03dbe4dd161019c203591ef198ad4e19 Mon Sep 17 00:00:00 2001 From: Eliran Bivas Date: Mon, 25 Jan 2021 13:04:29 +0200 Subject: [PATCH 2/3] check with coverall action --- .github/workflows/go.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 3f5e388..483ba31 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -24,7 +24,7 @@ jobs: - name: Test env: GOPROXY: "https://proxy.golang.org" - run: go test -v -race -coverprofile=profile.cov ./... + run: go test -v -race ./... - name: Install golangci-lint run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.20.0 @@ -32,8 +32,8 @@ jobs: - name: Run golangci-lint run: golangci-lint run -E golint -E gosec -E gofmt - - name: Send coverage + - name: Coveralls + uses: coverallsapp/github-action@master if: ${{ matrix.go }} == '1.15' - uses: shogo82148/actions-goveralls@v1 with: - path-to-profile: profile.cov \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 9c012d5ae68e9eb54162201057f92a785c3e856d Mon Sep 17 00:00:00 2001 From: Eliran Bivas Date: Mon, 25 Jan 2021 13:23:22 +0200 Subject: [PATCH 3/3] convert coverage to lcov file --- .github/workflows/go.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 483ba31..af9448d 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -24,7 +24,7 @@ jobs: - name: Test env: GOPROXY: "https://proxy.golang.org" - run: go test -v -race ./... + run: go test -v -race -coverprofile=coverage.out ./... - name: Install golangci-lint run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.20.0 @@ -32,8 +32,15 @@ jobs: - name: Run golangci-lint run: golangci-lint run -E golint -E gosec -E gofmt + - name: convert to lcov + if: ${{ matrix.go }} == '1.15' + run: | + go get -u github.com/jandelgado/gcov2lcov + gcov2lcov -infile=coverage.out -outfile=coverage.lcov + - name: Coveralls uses: coverallsapp/github-action@master if: ${{ matrix.go }} == '1.15' with: - github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage.lcov \ No newline at end of file