From 3d77945981130382fc51997249a156b944f4c5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Sun, 8 Dec 2024 02:48:48 +0100 Subject: [PATCH] Add workflow for testing --- .gitea/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ Taskfile.yml | 7 ++++++- nodes/main.go | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..3dec1ca --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test Project + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: [moon, amd64] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + # - name: Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install -y task + + - name: Run tests + run: task test diff --git a/Taskfile.yml b/Taskfile.yml index cbfd07f..7a7dea0 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,4 +6,9 @@ tasks: docs: cmds: - swag i --parseDependency --dir api - silent: true + silent: false + test: + cmds: + - go mod tidy + - go test -v ./... + silent: false diff --git a/nodes/main.go b/nodes/main.go index 3ac4bc4..848084c 100644 --- a/nodes/main.go +++ b/nodes/main.go @@ -75,7 +75,7 @@ func (np *NodesProcessor) Dump() error { return true }) - body, err := json.Marshal(ns) + body, err := json.MarshalIndent(ns, "", " ") if err != nil { return fmt.Errorf("failed to marshal nodes: %w", err) }