diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..b1ab393 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,49 @@ +name: validate +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: + branches: + - master + - main + +jobs: + linters: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + timeout-minutes: 10 + + strategy: + matrix: + # We only run on the latest version of go, as some linters may be + # version-dependent (for example gofmt can change between releases). + go-version: [stable] + os: [ubuntu-22.04, windows-2022] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v3 + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + skip-cache: true + args: --print-resources-usage --verbose + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the action don't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. + # skip-build-cache: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..600bef7 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,2 @@ +run: + timeout: 5m