-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
- name: Run tests | ||
run: | | ||
make install-tools | ||
make generate | ||
make test | ||
make coverage | ||
make check-tidy | ||
make check-headers | ||
make check-schema | ||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage.txt | ||
flags: unittests | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
- name: generate | ||
run: make generate | ||
- uses: golangci/[email protected] | ||
with: | ||
version: v1.52.2 | ||
args: --timeout=3m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Coverage artifacts | ||
coverage.zip | ||
coverage.txt | ||
cover.json | ||
cover-summary | ||
index.html | ||
|
||
.DS_Store | ||
|
||
# Ignore flow json config | ||
flow.json | ||
flow*.json | ||
!tests/flow.json | ||
|
||
# IDE related files | ||
.idea | ||
.vscode | ||
git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# The short Git commit hash | ||
SHORT_COMMIT := $(shell git rev-parse --short HEAD) | ||
# The Git commit hash | ||
COMMIT := $(shell git rev-parse HEAD) | ||
# The tag of the current commit, otherwise empty | ||
VERSION := $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) | ||
# Name of the cover profile | ||
COVER_PROFILE := coverage.txt | ||
# Disable go sum database lookup for private repos | ||
GOPRIVATE := github.com/dapperlabs/* | ||
# Ensure go bin path is in path (Especially for CI) | ||
GOPATH ?= $(HOME)/go | ||
PATH := $(PATH):$(GOPATH)/bin | ||
# OS | ||
UNAME := $(shell uname) | ||
|
||
MIXPANEL_PROJECT_TOKEN := 3fae49de272be1ceb8cf34119f747073 | ||
|
||
.PHONY: test | ||
test: | ||
GO111MODULE=on go test -coverprofile=$(COVER_PROFILE) $(if $(JSON_OUTPUT),-json,) ./... | ||
|
||
.PHONY: install-tools | ||
install-tools: | ||
cd ${GOPATH}; \ | ||
mkdir -p ${GOPATH}; \ | ||
GO111MODULE=on go install github.com/axw/gocov/gocov@latest; \ | ||
GO111MODULE=on go install github.com/matm/gocov-html/cmd/gocov-html@latest; \ | ||
GO111MODULE=on go install github.com/sanderhahn/gozip/cmd/gozip@latest; \ | ||
GO111MODULE=on go install github.com/vektra/mockery/[email protected]; | ||
|
||
.PHONY: generate-schema | ||
generate-schema: | ||
go run ./cmd/flow-schema/flow-schema.go ./schema.json | ||
|
||
.PHONY: check-schema | ||
check-schema: | ||
go run ./cmd/flow-schema/flow-schema.go --verify=true ./schema.json | ||
|
||
.PHONY: check-tidy | ||
check-tidy: | ||
go mod tidy | ||
|
||
.PHONY: check-headers | ||
check-headers: | ||
@./check-headers.sh | ||
|
||
.PHONY: generate | ||
generate: install-tools | ||
go generate ./... | ||
|
||
.PHONY: coverage | ||
coverage: | ||
ifeq ($(COVER), true) | ||
# file has to be called index.html | ||
gocov convert $(COVER_PROFILE) > cover.json | ||
./cover-summary.sh | ||
gocov-html cover.json > index.html | ||
# coverage.zip will automatically be picked up by teamcity | ||
gozip -c coverage.zip index.html | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
files=$(find . -name \*.go -type f -print0 | xargs -0 grep -L -E '(Licensed under the Apache License)|(Code generated (from|by))') | ||
if [ -n "$files" ]; then | ||
echo "Missing license header in:" | ||
echo "$files" | ||
exit 1 | ||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.