From 644edc33bd77d48fdc6f61a58677f7397b1f9602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= <torjus@usit.uio.no> Date: Tue, 5 Dec 2023 21:51:15 +0100 Subject: [PATCH] Add go test workflow --- .gitea/workflows/go-test.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitea/workflows/go-test.yml diff --git a/.gitea/workflows/go-test.yml b/.gitea/workflows/go-test.yml new file mode 100644 index 0000000..6230546 --- /dev/null +++ b/.gitea/workflows/go-test.yml @@ -0,0 +1,54 @@ +name: Run go tests +on: + - test + - pull_request + +env: + GOPATH: /go_path + GOCACHE: /go_cache + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + env: + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: https://github.com/actions/setup-go@v4 + with: + go-version: 1.21 + use-latest: true + + - name: Hash go.mod and go.sum + uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + go.mod + go.sum + + - name: Cache go + uses: actions/cache@v3 + + - name: Go mod download + run: go mod download + + - name: Go mod verify + run: go mod verify + + - name: Go mod tidy + run: go mod tidy && git diff --exit-code + + - name: Check gofmt + run: gofmt -s -w . && git diff --exit-code + + - name: Check go vet + run: go vet ./... + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -cover -v ./...