diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..85f992b --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,3 @@ +#!/bin/bash + +make lint \ No newline at end of file diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml new file mode 100644 index 0000000..d106159 --- /dev/null +++ b/.github/workflows/go-ci.yml @@ -0,0 +1,44 @@ +name: Go CI + +on: + pull_request: + +env: + GO_VERSION: '1.22.5' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.7.0 + with: + version: v1.59 + + unit_test: + needs: [lint] + name: Run Unit Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: set up go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: execute tests + run: make test \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b2ca01 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.exe +*.exe~ +*.dll +*.so +*.dylib +*.test +*.out +go.work +go.work.sum +.env +.idea/ +.vscode/ +coverage.txt \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..01fed86 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +all: help + +.PHONY: help +help: Makefile + @echo "Available commands:" + @echo + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' + @echo + +.PHONY: lint +## lint: Runs golangci-lint run +lint: + golangci-lint run + +.PHONY: test +## test: Runs `go test` on project test files. +test: + go test ./... -race + +## install-hooks: Install git-hooks from .githooks directory. +.PHONY: install-hooks +install-hooks: + git config core.hooksPath .githooks \ No newline at end of file