diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cfdc29d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build +on: + push: + branches: + - main + paths-ignore: + - '**.md' + - 'vulns/**' + - 'LICENSE' + pull_request: + paths-ignore: + - '**.md' + - 'vulns/**' + - 'LICENSE' +env: + GO_VERSION: '1.22' +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Checkout code into the Go module directory + uses: actions/checkout@v4 + + - name: Tidy + run: | + go mod tidy + if [ -n "$(git status --porcelain)" ]; then + echo "Run 'go mod tidy' and push it" + exit 1 + fi + + - name: Fmt + run: | + go fmt ./... + if [ -n "$(git status --porcelain)" ]; then + echo "Run 'go fmt ./...' and push it" + exit 1 + fi + + - name: Lint + uses: golangci/golangci-lint-action@v6.0.1 + with: + version: v1.59 + args: --verbose + + - name: Test + run: | + go test -v ./...