Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI linting/formatting #14

Merged
merged 4 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: format
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
lua:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check formatting
uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
go:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Run gci
run: |
go install github.com/daixiang0/gci@latest
gci write --skip-generated --skip-vendor -s standard -s default .
working-directory: ./tests/go
- name: Run golines
run: |
go install mvdan.cc/gofumpt@latest
go install github.com/segmentio/golines@latest
golines --base-formatter=gofumpt --ignore-generated --tab-len=1 --max-len=120 --write-output .
working-directory: ./tests/go
- name: Check git diff
run: |
git diff --exit-code
working-directory: ./tests/go
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
go:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Run golangci-lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ./...
working-directory: ./tests/go
19 changes: 18 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: test
on: [pull_request, workflow_dispatch]
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
nvim:
strategy:
Expand All @@ -23,3 +28,15 @@ jobs:
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: nvim --headless -c "PlenaryBustedDirectory test {minimal_init = 'tests/minimal_init.lua', sequential = true}"
go:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Check tests
run: go test ./...
working-directory: ./tests/go
25 changes: 25 additions & 0 deletions .github/workflows/vuln.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: vuln
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
go:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Go vet (vulnerabilities)
run: go vet ./...
working-directory: ./tests/go
- name: Run gosec (security)
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...
working-directory: ./tests/go
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ My next focus areas:

- [ ] Refactoring, polish and tests.
- [ ] Make use of `pcall` to handle potential errors gracefully.
- [ ] Set up CI for linting, testing, require changes via PR.
- [x] Set up CI for linting, testing, require changes via PR.
- [ ] Versioning and releases via release-please.
- [x] Ability to debug test from sub-project (see
[nvim-dap-go#80](https://github.com/leoluz/nvim-dap-go/issues/80)).
Expand Down
Loading