From 9ffedcf0482aef017e5fc9f686cd63f00bfc1379 Mon Sep 17 00:00:00 2001 From: Ronny Haryanto Date: Fri, 26 Apr 2024 02:39:23 +1000 Subject: [PATCH] Add CI pipeline Fixes #1 --- .github/workflows/tests.yml | 18 ++++++++++++++++++ Makefile | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 Makefile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f1a4995 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow + +name: tests + +on: + push: + workflow_dispatch: + +jobs: + tests: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - run: make ci-test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..84cab97 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +all: test + +test: + go test -v -shuffle=on -coverprofile=coverage.txt -count=1 ./... + +vet: + go vet ./... + +staticcheck: + staticcheck ./... + +format: + gofumpt -l -w . + +lint: vet staticcheck format + +install-tools: + go install mvdan.cc/gofumpt@latest + go install honnef.co/go/tools/cmd/staticcheck@latest + +ci-checks: lint + go mod tidy + git diff --exit-code + +ci-test: install-tools ci-checks test + +# Tell Make that these steps should always run, never cached, even if we have +# files with the same names as these in the filesystem. +.PHONY: all test vet staticcheck lint format mod-tidy ci-checks install-tools ci-test