Skip to content

Commit

Permalink
workflow fixes (#27)
Browse files Browse the repository at this point in the history
added codecov
  • Loading branch information
moshebe authored Jul 23, 2020
1 parent de26a74 commit ee0126f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: lint
on: [push, pull_request]
on: push

jobs:
lint:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test
on: [push, pull_request]
on: push
jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -15,5 +15,7 @@ jobs:
- run: go test -cover ./...
env:
CGO_ENABLED: 0
- name: Codecov
uses: codecov/[email protected]
- name: coverage
run: |
make coverage
bash <(curl -s https://codecov.io/bash)
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
WORKROOT := $(shell pwd)
OUTDIR := $(WORKROOT)/output

export PATH := $(shell go env GOPATH)/bin:$(PATH)
export GO111MODULE := on

GOFLAGS := -race
STATICCHECK := staticcheck

ARCH := $(shell getconf LONG_BIT)
ifeq ($(ARCH),64)
GOTEST += -race
endif

GEBUG_VERSION ?= $(shell cat VERSION)
GIT_COMMIT ?= $(shell git rev-parse HEAD)

PKGS := $(shell go list ./...)

all: compile package

compile: test build
build:
go build -ldflags "-X main.version=$(GEBUG_VERSION) -X main.commit=$(GIT_COMMIT)"

test: test-case vet-case
test-case:
go test -cover ./...
vet-case:
go vet ./...

coverage:
echo -n > coverage.txt
for pkg in $(PKGS) ; do go test -coverprofile=profile.out -covermode=atomic $${pkg} && cat profile.out >> coverage.txt; done

package:
mkdir -p $(OUTDIR)/bin
mv bfe $(OUTDIR)/bin
cp -r conf $(OUTDIR)

check:
go get honnef.co/go/tools/cmd/staticcheck
staticcheck ./...

clean:
rm -rf $(OUTDIR)
rm -rf $(WORKROOT)/gebug
rm -rf $(WORKROOT)/.gebug
rm -rf $(GOPATH)/pkg/linux_amd64

.PHONY: all compile test package clean build

0 comments on commit ee0126f

Please sign in to comment.