From bfcdc9b47b83d48b2a5f02b7a5b97a17be2ef512 Mon Sep 17 00:00:00 2001 From: Divyajoyt Virdee Date: Tue, 11 Nov 2025 23:04:36 +0530 Subject: [PATCH] ci: add GitHub Actions workflow for lint & unit tests ci: add GitHub Actions workflow for lint & unit tests --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..e8f24057c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: + pull_request: + branches: [ main, master ] + push: + branches: [ main, master ] + +jobs: + lint-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' # adjust to repo's required Go version + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + + - name: Install golangci-lint + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.56.0 + + - name: Run golangci-lint + run: golangci-lint run ./... + + - name: Run unit tests + run: go test ./... -v