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) }