-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linting and acceptance test workflow
- Loading branch information
Showing
3 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |