Skip to content

Commit

Permalink
Add workflow for static analysis (go vet, gofmt, staticcheck)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwiecz committed Oct 29, 2023
1 parent 82576cc commit b9055de
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Downgrate MinGW
- name: Downgrade MinGW
if: matrix.os == 'windows-latest'
run: choco install mingw --version 11.2.0.07112021 --allow-downgrade

Expand All @@ -32,5 +32,6 @@ jobs:
sudo apt-get update && sudo apt-get install -y libpango1.0-dev libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpng-dev libgl1-mesa-dev libglu1-mesa-dev
fi
shell: bash

- name: Build
run: go build -v ./...
41 changes: 41 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Check

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Download deps
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install -y libpango1.0-dev libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpng-dev libgl1-mesa-dev libglu1-mesa-dev
fi
shell: bash

- name: Install analysis tools
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.4.2
- name: Vet
run: go vet ./...

- name: Goimports
run: test -z "$(goimports -e -d . | tee /dev/stderr)"

- name: Staticcheck
run: staticcheck ./...

0 comments on commit b9055de

Please sign in to comment.