run golangci-lint on Github Actions instead of Travis

This commit is contained in:
Marten Seemann
2020-08-06 17:10:43 +07:00
parent 32b3ce645a
commit 562cf11b11
4 changed files with 13 additions and 10 deletions

13
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check that no non-test files import Ginkgo or Gomega
run: .github/workflows/no_ginkgo.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.30

24
.github/workflows/no_ginkgo.sh vendored Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Verify that no non-test files import Ginkgo or Gomega.
set -e
HAS_TESTING=false
cd ..
for f in $(find . -name "*.go" ! -name "*_test.go"); do
if grep -q "github.com/onsi/ginkgo" $f; then
echo "$f imports github.com/onsi/ginkgo"
HAS_TESTING=true
fi
if grep -q "github.com/onsi/gomega" $f; then
echo "$f imports github.com/onsi/gomega"
HAS_TESTING=true
fi
done
if "$HAS_TESTING"; then
exit 1
fi
exit 0