From 09185461e5df13f6268903a63fd2cb8f9cd152c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Sat, 26 Mar 2022 17:45:34 +0100 Subject: [PATCH] Add Github Actions for Tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukas Kämmerling --- .github/workflows/goimports.yml | 16 ++++++++++++++++ .github/workflows/test.yml | 14 ++++++++++++++ Makefile | 4 ++-- pkg/aggregator/bindata.go | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/goimports.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/goimports.yml b/.github/workflows/goimports.yml new file mode 100644 index 00000000..e7f15b94 --- /dev/null +++ b/.github/workflows/goimports.yml @@ -0,0 +1,16 @@ +name: Check imports +on: [ push, pull_request ] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + - uses: actions/checkout@master + - name: Check imports + shell: bash + run: | + export PATH=$(go env GOPATH)/bin:$PATH + go get golang.org/x/tools/cmd/goimports + diff -u <(echo -n) <(goimports -d .) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..81c82c26 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +--- +name: Run tests +on: [ push, pull_request ] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + - uses: actions/checkout@master + - name: Run tests + run: | + make test diff --git a/Makefile b/Makefile index 1b1696ab..51cf2c93 100644 --- a/Makefile +++ b/Makefile @@ -62,9 +62,9 @@ lint: .PHONY: test test: - for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done; + for PKG in $(PACKAGES); do go test $$PKG || exit 1; done; .PHONY: referrer-spam-blacklist referrer-spam-blacklist: wget https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt -O pkg/aggregator/data/blacklist.txt - go-bindata -prefix "pkg/aggregator/data/" -o pkg/aggregator/bindata.go -pkg aggregator pkg/aggregator/data/ \ No newline at end of file + go-bindata -prefix "pkg/aggregator/data/" -o pkg/aggregator/bindata.go -pkg aggregator pkg/aggregator/data/ diff --git a/pkg/aggregator/bindata.go b/pkg/aggregator/bindata.go index ceca106e..fbb2237d 100644 --- a/pkg/aggregator/bindata.go +++ b/pkg/aggregator/bindata.go @@ -182,6 +182,7 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "blacklist.txt": &bintree{blacklistTxt, map[string]*bintree{}}, }} @@ -232,4 +233,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } -