diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d01fb54 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +--- +name: Tests + +on: [push, pull_request] + +jobs: + tests: + if: (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository) + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@master + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.19' + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + continue-on-error: true + with: + # The first run is for GitHub Actions error format. + args: --config=golangci-lint.yml + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # The second run is for human-readable error format with a file name + # and a line number. + args: --out-${NO_FUTURE}format colored-line-number --config=golangci-lint.yml + + - name: Unit tests + run: | + go test -race ./... diff --git a/golangci-lint.yml b/golangci-lint.yml new file mode 100644 index 0000000..2f0eab3 --- /dev/null +++ b/golangci-lint.yml @@ -0,0 +1,30 @@ +run: + timeout: 3m + +linters: + disable-all: true + enable: + - lll + - govet + - gofmt + - stylecheck + - godot + +linters-settings: + lll: + line-length: 100 + tab-width: 4 + gofmt: + simplify: false + stylecheck: + # Temporary disable "Poorly chosen identifier" check. + checks: ["all", "-ST1003"] + godot: + scope: toplevel + period: true + +issues: + exclude-rules: + - linters: + - lll + source: "\t?// (see )?https://"