From 27debfa8ddcb1f25da4a3074375aa50fce8c5b62 Mon Sep 17 00:00:00 2001 From: Daniil Fedotov Date: Wed, 5 Jun 2024 16:31:43 -0400 Subject: [PATCH] Add build workflows --- .github/workflows/ci.yaml | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..54ece1a --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,66 @@ + +name: Go + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + build: + strategy: + matrix: + go: ['stable', 'oldstable'] + os: ['ubuntu-latest'] + + runs-on: ${{ matrix.os }} + + name: Go ${{ matrix.go }} in ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + name: Install Go + with: + go-version: ${{ matrix.go }} + check-latest: true + cache: true + + - name: Go Environment + run: | + go version + go env + + - name: Get dependencies + run: go get -v -t -d ./... + + - name: Run Fmt + run: go fmt ./... + + - name: Run Vet + run: | + go vet -stdmethods=false $(go list ./...) + go mod tidy + if ! test -z "$(git status --porcelain)"; then + echo "Please run 'go mod tidy'" + exit 1 + fi + + - name: Run Lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + only-new-issues: true + skip-pkg-cache: true + + - name: Run Staticcheck + run: | + go install honnef.co/go/tools/cmd/staticcheck@latest + staticcheck ./... + + - name: Run Test + run: go test -race -coverpkg=./... -coverprofile=coverage.txt ./...