aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dmitriy Shirchenko <shirchen@users.noreply.github.com> 2021-05-17 15:14:22 -0700
committerGravatar GitHub <noreply@github.com> 2021-05-17 15:14:22 -0700
commitb627e361379b89802df4930abbc64ce26bd8f323 (patch)
tree90e48cb38da07f4b431be463c2c72fd887a891c7
parent3db7a7fc8ab9efc1cdb88dcfd3b974581c203236 (diff)
downloadsally-b627e361379b89802df4930abbc64ce26bd8f323.tar.gz
sally-b627e361379b89802df4930abbc64ce26bd8f323.tar.zst
sally-b627e361379b89802df4930abbc64ce26bd8f323.zip
Set up CI (#45)
Set up CI with GitHub actions.
-rw-r--r--.codecov.yml14
-rw-r--r--.github/workflows/go.yml45
-rw-r--r--Makefile5
3 files changed, 64 insertions, 0 deletions
diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index 0000000..b3da3cb
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1,14 @@
+coverage:
+ range: 80..100
+ round: down
+ precision: 2
+
+ status:
+ project: # measuring the overall project coverage
+ default: # context, you can create multiple ones with custom titles
+ enabled: yes # must be yes|true to enable this status
+ target: 40% # specify the target coverage for each commit status
+ # option: "auto" (must increase from parent commit or pull request base)
+ # option: "X%" a static target percentage to hit
+ if_not_found: success # if parent is not found report status as success, error, or failure
+ if_ci_failed: error # if ci fails report status as success, error, or failure
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
new file mode 100644
index 0000000..c1a24ea
--- /dev/null
+++ b/.github/workflows/go.yml
@@ -0,0 +1,45 @@
+name: Go
+
+on:
+ push:
+ branches: ['*']
+ tags: ['v*']
+ pull_request:
+ branches: ['*']
+
+jobs:
+
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ go: ["1.15.x", "1.16.x"]
+ include:
+ - go: 1.16.x
+ latest: true
+
+ steps:
+ - name: Setup Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: ${{ matrix.go }}
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Load cached dependencies
+ uses: actions/cache@v1
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: |
+ ${{ runner.os }}-go-
+ - name: Lint
+ if: matrix.latest
+ run: make lint
+
+ - name: Test
+ run: make cover
+
+ - name: Upload coverage to codecov.io
+ uses: codecov/codecov-action@v1
diff --git a/Makefile b/Makefile
index efa0d0a..7264206 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,11 @@ pretest: lint vet staticcheck
test: pretest
go test -race ./...
+.PHONY: cover
+cover:
+ go test -coverprofile=cover.out -covermode=atomic -coverpkg=./... ./...
+ go tool cover -html=cover.out -o cover.html
+
.PHONY: clean
clean:
rm -rf _tmp