diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bf8ab65 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: blacksmith-2vcpu-ubuntu-2204 + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Lint + run: make lint + + - name: Test + run: make test diff --git a/Makefile b/Makefile index 50a4854..6a6565a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,12 @@ format: gofmt -w . lint: - gofmt -l . | tee /dev/stderr | (! read) + @unformatted=$$(gofmt -l .); \ + if [ -n "$$unformatted" ]; then \ + echo "these files are not gofmt'ed:"; \ + echo "$$unformatted"; \ + exit 1; \ + fi go vet ./... test: