Feat/add GitHub ci #1
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
name: Linter | |
on: [pull_request] | |
jobs: | |
go-staticcheck: | |
name: go-staticcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.23.x | |
- name: Run go-staticcheck | |
run: | | |
go get honnef.co/go/tools/cmd/staticcheck@latest # ideally we should version pin | |
PKGS=$(go list ./... | grep -v /vendor/ | grep -v pkg/ui | grep -v cmd/mte_service_ui ) | |
go run honnef.co/go/tools/cmd/staticcheck $PKGS | |
go-vet: | |
name: go-vet | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.23.x | |
- name: Run go-vet | |
run: | | |
PKGS=$(go list ./... | grep -v /vendor/ | grep -v pkg/ui | grep -v cmd/mte_service_ui ) | |
go vet -json $PKGS | tee vet-report.json | |
- name: Upload results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: go-vet-results | |
path: vet-report.json | |
golangci-lint: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.23.x | |
- name: Install golangci-lint | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0 | |
- name: Run golangci-lint | |
run: | | |
go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v --timeout 10m0s |