Skip to content

Commit c529c90

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into feat/usb-audio
2 parents 9d12dd1 + 3e7d8fb commit c529c90

File tree

131 files changed

+8576
-4077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+8576
-4077
lines changed

.devcontainer/devcontainer.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@
44
"features": {
55
"ghcr.io/devcontainers/features/node:1": {
66
// Should match what is defined in ui/package.json
7-
"version": "21.1.0"
7+
"version": "22.15.0"
88
}
99
},
1010
"mounts": [
1111
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
12-
]
12+
],
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"bradlc.vscode-tailwindcss",
17+
"GitHub.vscode-pull-request-github",
18+
"dbaeumer.vscode-eslint",
19+
"golang.go",
20+
"ms-vscode.makefile-tools",
21+
"esbenp.prettier-vscode",
22+
"github.vscode-github-actions"
23+
]
24+
}
25+
}
1326
}
1427

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: github-actions
9+
directory: /
10+
schedule:
11+
interval: monthly
12+
open-pull-requests-limit: 10
13+
- package-ecosystem: npm
14+
directory: /ui
15+
open-pull-requests-limit: 10
16+
schedule:
17+
interval: monthly

.github/workflows/build.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,33 @@ jobs:
1919
- name: Set up Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: v21.1.0
22+
node-version: "22"
2323
cache: "npm"
2424
cache-dependency-path: "**/package-lock.json"
2525
- name: Set up Golang
26-
uses: actions/setup-go@v4
26+
uses: actions/setup-go@v5
2727
with:
28-
go-version: "1.24.0"
28+
go-version: "1.24.4"
2929
- name: Build frontend
3030
run: |
3131
make frontend
3232
- name: Build application
3333
run: |
3434
make build_dev
35+
- name: Run tests
36+
run: |
37+
go test ./... -json > testreport.json
38+
- name: Make test cases
39+
run: |
40+
make build_dev_test
41+
- name: Golang Test Report
42+
uses: becheran/[email protected]
43+
with:
44+
input: "testreport.json"
3545
- name: Upload artifact
3646
uses: actions/upload-artifact@v4
3747
with:
3848
name: jetkvm-app
39-
path: bin/jetkvm_app
49+
path: |
50+
bin/jetkvm_app
51+
device-tests.tar.gz

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
- name: Checkout repository
2525
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2626
- name: Install Go
27-
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
27+
uses: actions/setup-go@19bb51245e9c80abacb2e91cc42b33fa478b8639 # v4.2.1
2828
with:
29-
go-version: 1.24.x
29+
go-version: 1.24.4
3030
- name: Create empty resource directory
3131
run: |
3232
mkdir -p static && touch static/.gitkeep

.github/workflows/smoketest.yml

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,54 @@ jobs:
6969
CI_USER: ${{ vars.JETKVM_CI_USER }}
7070
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
7171
CI_SSH_PRIVATE: ${{ secrets.JETKVM_CI_SSH_PRIVATE }}
72+
- name: Run tests
73+
run: |
74+
set -e
75+
echo "+ Copying device-tests.tar.gz to remote host"
76+
ssh jkci "cat > /tmp/device-tests.tar.gz" < device-tests.tar.gz
77+
echo "+ Running go tests"
78+
ssh jkci ash << 'EOF'
79+
set -e
80+
TMP_DIR=$(mktemp -d)
81+
cd ${TMP_DIR}
82+
tar zxf /tmp/device-tests.tar.gz
83+
./gotestsum --format=testdox \
84+
--jsonfile=/tmp/device-tests.json \
85+
--post-run-command 'sh -c "echo $TESTS_FAILED > /tmp/device-tests.failed"' \
86+
--raw-command -- ./run_all_tests -json
87+
88+
GOTESTSUM_EXIT_CODE=$?
89+
if [ $GOTESTSUM_EXIT_CODE -ne 0 ]; then
90+
echo "❌ Tests failed (exit code: $GOTESTSUM_EXIT_CODE)"
91+
rm -rf ${TMP_DIR} /tmp/device-tests.tar.gz
92+
exit 1
93+
fi
94+
95+
TESTS_FAILED=$(cat /tmp/device-tests.failed)
96+
if [ "$TESTS_FAILED" -ne 0 ]; then
97+
echo "❌ Tests failed $TESTS_FAILED tests failed"
98+
rm -rf ${TMP_DIR} /tmp/device-tests.tar.gz
99+
exit 1
100+
fi
101+
102+
echo "✅ Tests passed"
103+
rm -rf ${TMP_DIR} /tmp/device-tests.tar.gz
104+
EOF
105+
ssh jkci "cat /tmp/device-tests.json" > device-tests.json
106+
- name: Set up Golang
107+
uses: actions/setup-go@v5
108+
with:
109+
go-version: "1.24.4"
110+
- name: Golang Test Report
111+
uses: becheran/[email protected]
112+
with:
113+
input: "device-tests.json"
72114
- name: Deploy application
73115
run: |
74116
set -e
75117
# Copy the binary to the remote host
76118
echo "+ Copying the application to the remote host"
77-
cat jetkvm_app | gzip | ssh jkci "cat > /userdata/jetkvm/jetkvm_app.update.gz"
119+
cat bin/jetkvm_app | gzip | ssh jkci "cat > /userdata/jetkvm/jetkvm_app.update.gz"
78120
# Deploy and run the application on the remote host
79121
echo "+ Deploying the application on the remote host"
80122
ssh jkci ash <<EOF
@@ -108,15 +150,25 @@ jobs:
108150
run: |
109151
echo "+ Checking the status of the device"
110152
curl -v http://$CI_HOST/device/status && echo
111-
echo "+ Waiting for 10 seconds to allow all services to start"
112-
sleep 10
153+
echo "+ Waiting for 15 seconds to allow all services to start"
154+
sleep 15
113155
echo "+ Collecting logs"
114-
ssh jkci "cat /userdata/jetkvm/last.log" > last.log
115-
cat last.log
156+
local_log_tar=$(mktemp)
157+
ssh jkci ash > $local_log_tar <<'EOF'
158+
log_path=$(mktemp -d)
159+
dmesg > $log_path/dmesg.log
160+
cp /userdata/jetkvm/last.log $log_path/last.log
161+
tar -czf - -C $log_path .
162+
EOF
163+
tar -xf $local_log_tar
164+
cat dmesg.log last.log
116165
env:
117166
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
118167
- name: Upload logs
119168
uses: actions/upload-artifact@v4
120169
with:
121170
name: device-logs
122-
path: last.log
171+
path: |
172+
last.log
173+
dmesg.log
174+
device-tests.json

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
bin/*
22
static/*
33
.idea
4+
.DS_Store
5+
6+
device-tests.tar.gz

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ linters:
44
- forbidigo
55
- misspell
66
- whitespace
7+
- gochecknoinits
78
settings:
89
forbidigo:
910
forbid:
@@ -22,6 +23,9 @@ linters:
2223
- linters:
2324
- errcheck
2425
path: _test.go
26+
- linters:
27+
- gochecknoinits
28+
path: internal/logging/sse.go
2529
paths:
2630
- third_party$
2731
- builtin$

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"tailwindCSS.classFunctions": ["cva", "cx"]
3+
}

Makefile

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,64 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
22
BUILDDATE ?= $(shell date -u +%FT%T%z)
33
BUILDTS ?= $(shell date -u +%s)
44
REVISION ?= $(shell git rev-parse HEAD)
5-
VERSION_DEV := 0.4.0-dev$(shell date +%Y%m%d%H%M)
6-
VERSION := 0.3.9
5+
VERSION_DEV ?= 0.4.5-dev$(shell date +%Y%m%d%H%M)
6+
VERSION ?= 0.4.4
77

88
PROMETHEUS_TAG := github.com/prometheus/common/version
99
KVM_PKG_NAME := github.com/jetkvm/kvm
1010

11+
GO_BUILD_ARGS := -tags netgo
12+
GO_RELEASE_BUILD_ARGS := -trimpath $(GO_BUILD_ARGS)
1113
GO_LDFLAGS := \
1214
-s -w \
1315
-X $(PROMETHEUS_TAG).Branch=$(BRANCH) \
1416
-X $(PROMETHEUS_TAG).BuildDate=$(BUILDDATE) \
1517
-X $(PROMETHEUS_TAG).Revision=$(REVISION) \
1618
-X $(KVM_PKG_NAME).builtTimestamp=$(BUILDTS)
1719

20+
GO_CMD := GOOS=linux GOARCH=arm GOARM=7 go
21+
BIN_DIR := $(shell pwd)/bin
22+
23+
TEST_DIRS := $(shell find . -name "*_test.go" -type f -exec dirname {} \; | sort -u)
24+
1825
hash_resource:
1926
@shasum -a 256 resource/jetkvm_native | cut -d ' ' -f 1 > resource/jetkvm_native.sha256
2027

2128
build_dev: hash_resource
2229
@echo "Building..."
23-
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION_DEV)" -o bin/jetkvm_app cmd/main.go
30+
$(GO_CMD) build \
31+
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION_DEV)" \
32+
$(GO_RELEASE_BUILD_ARGS) \
33+
-o $(BIN_DIR)/jetkvm_app cmd/main.go
34+
35+
build_test2json:
36+
$(GO_CMD) build -o $(BIN_DIR)/test2json cmd/test2json
37+
38+
build_gotestsum:
39+
@echo "Building gotestsum..."
40+
$(GO_CMD) install gotest.tools/gotestsum@latest
41+
cp $(shell $(GO_CMD) env GOPATH)/bin/linux_arm/gotestsum $(BIN_DIR)/gotestsum
42+
43+
build_dev_test: build_test2json build_gotestsum
44+
# collect all directories that contain tests
45+
@echo "Building tests for devices ..."
46+
@rm -rf $(BIN_DIR)/tests && mkdir -p $(BIN_DIR)/tests
47+
48+
@cat resource/dev_test.sh > $(BIN_DIR)/tests/run_all_tests
49+
@for test in $(TEST_DIRS); do \
50+
test_pkg_name=$$(echo $$test | sed 's/^.\///g'); \
51+
test_pkg_full_name=$(KVM_PKG_NAME)/$$(echo $$test | sed 's/^.\///g'); \
52+
test_filename=$$(echo $$test_pkg_name | sed 's/\//__/g')_test; \
53+
$(GO_CMD) test -v \
54+
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION_DEV)" \
55+
$(GO_BUILD_ARGS) \
56+
-c -o $(BIN_DIR)/tests/$$test_filename $$test; \
57+
echo "runTest ./$$test_filename $$test_pkg_full_name" >> $(BIN_DIR)/tests/run_all_tests; \
58+
done; \
59+
chmod +x $(BIN_DIR)/tests/run_all_tests; \
60+
cp $(BIN_DIR)/test2json $(BIN_DIR)/tests/ && chmod +x $(BIN_DIR)/tests/test2json; \
61+
cp $(BIN_DIR)/gotestsum $(BIN_DIR)/tests/ && chmod +x $(BIN_DIR)/tests/gotestsum; \
62+
tar czfv device-tests.tar.gz -C $(BIN_DIR)/tests .
2463

2564
frontend:
2665
cd ui && npm ci && npm run build:device
@@ -33,7 +72,10 @@ dev_release: frontend build_dev
3372

3473
build_release: frontend hash_resource
3574
@echo "Building release..."
36-
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION)" -o bin/jetkvm_app cmd/main.go
75+
$(GO_CMD) build \
76+
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION)" \
77+
$(GO_RELEASE_BUILD_ARGS) \
78+
-o bin/jetkvm_app cmd/main.go
3779

3880
release:
3981
@if rclone lsf r2://jetkvm-update/app/$(VERSION)/ | grep -q "jetkvm_app"; then \

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/jetkvm.svg?style=social&label=Follow%20%40JetKVM)](https://twitter.com/jetkvm)
99

10+
[![Go Report Card](https://goreportcard.com/badge/github.com/jetkvm/kvm)](https://goreportcard.com/report/github.com/jetkvm/kvm)
11+
1012
</div>
1113

1214
JetKVM is a high-performance, open-source KVM over IP (Keyboard, Video, Mouse) solution designed for efficient remote management of computers, servers, and workstations. Whether you're dealing with boot failures, installing a new operating system, adjusting BIOS settings, or simply taking control of a machine from afar, JetKVM provides the tools to get it done effectively.

0 commit comments

Comments
 (0)