From b5e52766de00b13ba85a77bbfd6e8f40cef4a1ab Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Sun, 3 Nov 2024 17:21:37 +0600 Subject: [PATCH] ci: add format, lint, build test jobs --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 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 0000000..5fcc0f1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: Go + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Dependencies + run: | + go get . + go get -u golang.org/x/lint/golint + - name: Check Format + run: + declare -r diff="$(gofmt -l .)" + echo "${diff}" + test -z "${diff}" + - name: Lint + run: go vet + - name: Build + run: go build -v ./... + - name: Test + run: go test