Skip to content

Commit

Permalink
Add linting and acceptance test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrbasu committed Dec 4, 2024
1 parent 2f6612e commit 01fc5a7
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/10-test-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "10 - Test: Linting"
on:
push:
tags:
- v*
branches:
- main
- "v*"
workflow_dispatch:
pull_request:

jobs:
golangci:
name: Test Linting
runs-on: ubuntu-latest
steps:

- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@v4
with:
repository: turbot/pipe-fittings
path: pipe-fittings
ref: tp

- name: Checkout Tailpipe plugin SDK repository
uses: actions/checkout@v4
with:
repository: turbot/tailpipe-plugin-sdk
path: tailpipe-plugin-sdk
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: develop

# this is required, check golangci-lint-action docs
- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false # setup-go v4 caches by default, do not change this parameter, check golangci-lint-action doc: https://github.com/golangci/golangci-lint-action/pull/704

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61.0
args: --timeout=10m
working-directory: tailpipe-plugin-sdk
skip-cache: true
49 changes: 49 additions & 0 deletions .github/workflows/11-test-acceptance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "11 - Test: Acceptance"
on:
workflow_call:
push:
tags:
- v*
branches:
- main
workflow_dispatch:
pull_request:

env:
TAILPIPE_UPDATE_CHECK: false
SPIPETOOLS_TOKEN: ${{ secrets.SPIPETOOLS_TOKEN }}

jobs:
goreleaser:
name: Build
runs-on: ubuntu-latest
steps:

- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@v4
with:
repository: turbot/pipe-fittings
path: pipe-fittings
ref: tp

- name: Checkout Tailpipe plugin SDK repository
uses: actions/checkout@v4
with:
repository: turbot/tailpipe-plugin-sdk
path: tailpipe-plugin-sdk
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: develop

# this is required, check golangci-lint-action docs
- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false # setup-go v4 caches by default, do not change this parameter, check golangci-lint-action doc: https://github.com/golangci/golangci-lint-action/pull/704

- name: Run CLI Unit Tests
run: |
cd tailpipe-plugin-sdk
go clean -testcache
go test -timeout 30s ./... -test.v
# TODO - add SDK acceptance tests
42 changes: 42 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
linters:
disable-all: true
enable:
# default rules
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# other rules
- asasalint
- asciicheck
- bidichk
- durationcheck
- exportloopref
- forbidigo
- gocritic
- gocheckcompilerdirectives
- gosec
- makezero
- nilerr
- nolintlint
- reassign
- sqlclosecheck
- unconvert

linters-settings:
nolintlint:
require-explanation: true
require-specific: true

gocritic:
disabled-checks:
- ifElseChain # style
- singleCaseSwitch # style & it's actually not a bad idea to use single case switch in some cases
- assignOp # style
- commentFormatting # style

run:
timeout: 5m

0 comments on commit 01fc5a7

Please sign in to comment.