From 8d178bf4c6b0dc27e9d2037d5642c385e59ede9c Mon Sep 17 00:00:00 2001 From: Alessandro Resta Date: Mon, 23 Mar 2026 11:40:15 +0200 Subject: [PATCH] Add GH workflow CI --- .github/workflows/ci.yaml | 86 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 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..df10d22 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,86 @@ + +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + deps: + name: Dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Download modules + run: go mod download + + - name: Verify go.sum + run: go mod verify + + fmt: + name: Format + needs: deps + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Check formatting + run: | + output=$(gofmt -l .) + if [ -n "$output" ]; then + echo "The following files are not formatted:" + echo "$output" + exit 1 + fi + + vet: + name: Vet + needs: deps + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run go vet + run: go vet ./... + + test: + name: Test + needs: deps + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run tests + run: go test -race -count=1 -v -coverprofile=coverage.out ./... + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: alesr/disco