From 31ca7b1065f5d17451573ac696405b1c112f3fe4 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Mon, 1 Apr 2024 15:38:08 +0200 Subject: [PATCH] feat: add CI pipeline (#3) Addition of unit test in CI pipeline. Branch protection for merges to main setup, requiring "CI / test (pull_request)". Reviewed-on: https://gitea.t000-n.de/t.behrendt/realDynDNS/pulls/3 Co-authored-by: Timo Behrendt Co-committed-by: Timo Behrendt --- .gitea/workflows/ci.yaml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..8d5c7d9 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,45 @@ +name: CI +on: + pull_request: + push: + branches: + - main + +env: + GOPATH: /go_path + GOCACHE: /go_cache + RUNNER_TOOL_CACHE: /toolcache + +jobs: + testing: + name: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - name: Create cache key + uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + go.mod + go.sum + - name: cache go + id: cache-go + uses: actions/cache@v4 + with: + path: | + /go_path + /go_cache + key: go_path-${{ steps.hash-go.outputs.hash }} + restore-keys: |- + go_cache-${{ steps.hash-go.outputs.hash }} + - name: build + run: make build + - name: test + run: make test