diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0de88d5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,30 @@ +name: lint + +on: + pull_request: + branches: [main, master] + paths: + - 'mc2mc/**' + +permissions: + contents: read + +jobs: + golangci-lint: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: mc2mc/go.mod + cache: false + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: v2.10.1 + working-directory: mc2mc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45aded2..1be8057 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,26 @@ on: - 'mc2mc/v*' jobs: + lint: + if: startsWith(github.ref, 'refs/tags/mc2mc/v') + name: golangci-lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: mc2mc/go.mod + cache: false + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: v2.10.1 + working-directory: mc2mc + bq2bq: if: startsWith(github.ref, 'refs/tags/bq2bq/v') runs-on: ubuntu-latest @@ -44,6 +64,7 @@ jobs: run: docker logout mc2mc: if: startsWith(github.ref, 'refs/tags/mc2mc/v') + needs: lint runs-on: ubuntu-latest steps: - name: Checkout diff --git a/mc2mc/.golangci.yml b/mc2mc/.golangci.yml new file mode 100644 index 0000000..ac3dbff --- /dev/null +++ b/mc2mc/.golangci.yml @@ -0,0 +1,18 @@ +version: "2" + +linters: + default: none + enable: + - govet + - staticcheck + - ineffassign + - unused + - copyloopvar + settings: + staticcheck: + checks: + - "SA*" + +issues: + max-issues-per-linter: 0 + max-same-issues: 0