diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1ac480e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: '>=1.25' + cache: true + + - name: Verify dependencies + run: | + go mod tidy + if [ -n "$(git status --porcelain)" ]; then + echo "Error: go.mod/go.sum are not tidy. Please run 'go mod tidy'." + git status + exit 1 + fi + + - name: Run tests + run: go test -v -race ./... + + - name: Build check + run: go build -o /dev/null -v ./cmd/cli/main.go + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: '>=1.25' + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest