mirror of https://github.com/jetkvm/kvm.git
Compare commits
12 Commits
3a41875cde
...
2a36e1b4ba
| Author | SHA1 | Date |
|---|---|---|
|
|
2a36e1b4ba | |
|
|
317218a682 | |
|
|
57fbee1490 | |
|
|
0e65c0a9a9 | |
|
|
2dafb5c9c1 | |
|
|
566305549f | |
|
|
1505c37e4c | |
|
|
564eee9b00 | |
|
|
fab575dbe0 | |
|
|
97958e7b86 | |
|
|
2f7042df18 | |
|
|
2cadda4e00 |
|
|
@ -0,0 +1,126 @@
|
|||
name: Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
go: [1.21, 1.23.4]
|
||||
node: [21]
|
||||
goos: [linux]
|
||||
goarch: [arm]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Install Dependencies
|
||||
working-directory: ui
|
||||
run: npm ci
|
||||
|
||||
- name: Build UI
|
||||
working-directory: ui
|
||||
run: npm run build:device
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
|
||||
- name: Install Go Dependencies
|
||||
run: |
|
||||
go mod download
|
||||
|
||||
- name: Build Binaries
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
run: |
|
||||
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X kvm.builtAppVersion=dev-${GIT_COMMIT:0:7}" -o bin/jetkvm_app cmd/main.go
|
||||
chmod 755 bin/jetkvm_app
|
||||
|
||||
- name: Upload Debug Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.21' }}
|
||||
with:
|
||||
name: jetkvm_app_debug
|
||||
path: bin/jetkvm_app
|
||||
|
||||
comment:
|
||||
name: Comment
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate Links
|
||||
id: linksa
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[0].id')
|
||||
echo "ARTIFACT_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID" >> $GITHUB_ENV
|
||||
echo "LATEST_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Comment on PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
TITLE="${{ github.event.pull_request.title }}"
|
||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||
else
|
||||
TITLE="main branch"
|
||||
fi
|
||||
|
||||
COMMENT=$(cat << EOF
|
||||
✅ **Build successfully for $TITLE!**
|
||||
|
||||
| Name | Link |
|
||||
|------------------|----------------------------------------------------------------------|
|
||||
| 🔗 Debug Binary | [Download](${{ env.ARTIFACT_URL }}) |
|
||||
| 🔗 Latest commit | [${{ env.LATEST_COMMIT }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
|
||||
EOF
|
||||
)
|
||||
|
||||
# Post Comment
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
# Look for an existing comment
|
||||
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments \
|
||||
--jq '.[] | select(.body | contains("✅ **Build successfully for")) | .id')
|
||||
|
||||
if [ -z "$COMMENT_ID" ]; then
|
||||
# Create a new comment if none exists
|
||||
gh pr comment $PR_NUMBER --body "$COMMENT"
|
||||
else
|
||||
# Update the existing comment
|
||||
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID \
|
||||
--method PATCH \
|
||||
-f body="$COMMENT"
|
||||
fi
|
||||
else
|
||||
# Log the comment for main branch
|
||||
echo "$COMMENT"
|
||||
fi
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 21
|
||||
|
||||
- name: Install Dependencies
|
||||
working-directory: ui
|
||||
run: npm ci
|
||||
|
||||
- name: Build UI
|
||||
working-directory: ui
|
||||
run: npm run build:device
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.21
|
||||
|
||||
- name: Build Release Binaries
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X kvm.builtAppVersion=${REF:11}" -o bin/jetkvm_app cmd/main.go
|
||||
chmod 755 bin/jetkvm_app
|
||||
|
||||
- name: Create checksum
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
SUM=$(shasum -a 256 bin/jetkvm_app | cut -d ' ' -f 1)
|
||||
echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM bin/jetkvm_app\n\`\`\`\n" >> ./RELEASE_CHANGELOG
|
||||
echo -e "$SUM bin/jetkvm_app\n" > checksums.txt
|
||||
|
||||
- name: Create Release Branch
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
BRANCH=release/${REF:10}
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git checkout -b ${BRANCH}
|
||||
git push -u origin ${BRANCH}
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
||||
body_path: ./RELEASE_CHANGELOG
|
||||
|
||||
- name: Upload JetKVM binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: bin/jetkvm_app
|
||||
asset_name: jetkvm_app
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Upload checksum
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./checksums.txt
|
||||
asset_name: checksums.txt
|
||||
asset_content_type: text/plain
|
||||
|
|
@ -99,19 +99,36 @@ tail -f /var/log/jetkvm.log
|
|||
/kvm/
|
||||
├── main.go # App entry point
|
||||
├── config.go # Settings & configuration
|
||||
├── display.go # Device UI control
|
||||
├── web.go # API endpoints
|
||||
├── ui/ # React frontend
|
||||
│ ├── src/routes/ # Pages (login, settings, etc.)
|
||||
│ └── src/components/ # UI components
|
||||
├── cmd/ # Command line main
|
||||
├── internal/ # Internal Go packages
|
||||
│ ├── native/ # CGO / Native code glue layer
|
||||
│ ├── native/cgo/ # C files for the native library (HDMI, Touchscreen, etc.)
|
||||
│ ├── native/eez/ # EEZ Studio Project files (for Touchscreen)
|
||||
│ ├── confparser/ # Configuration file implementation
|
||||
│ ├── hidrpc/ # HIDRPC implementation for HID devices (keyboard, mouse, etc.)
|
||||
│ ├── logging/ # Logging implementation
|
||||
│ ├── mdns/ # mDNS implementation
|
||||
│ ├── native/ # CGO / Native code glue layer (on-device hardware)
|
||||
│ │ ├── cgo/ # C files for the native library (HDMI, Touchscreen, etc.)
|
||||
│ │ └── eez/ # EEZ Studio Project files (for Touchscreen)
|
||||
│ ├── network/ # Network implementation
|
||||
│ ├── timesync/ # Time sync/NTP implementation
|
||||
│ ├── tzdata/ # Timezone data and generation
|
||||
│ ├── udhcpc/ # DHCP implementation
|
||||
│ ├── usbgadget/ # USB gadget
|
||||
│ └── websecurity/ # TLS certificate management
|
||||
└── resource # netboot iso and other resources
|
||||
│ ├── utils/ # SSH handling
|
||||
│ └── websecure/ # TLS certificate management
|
||||
├── resource/ # netboot iso and other resources
|
||||
├── scripts/ # Bash shell scripts for building and deploying
|
||||
└── static/ # (react client build output)
|
||||
└── ui/ # React frontend
|
||||
├── public/ # UI website static images and fonts
|
||||
└── src/ # Client React UI
|
||||
├── assets/ # UI in-page images
|
||||
├── components/ # UI components
|
||||
├── hooks/ # Hooks (stores, RPC handling, virtual devices)
|
||||
├── keyboardLayouts/ # Keyboard layout definitions
|
||||
├── providers/ # Feature flags
|
||||
└── routes/ # Pages (login, settings, etc.)
|
||||
```
|
||||
|
||||
**Key files for beginners:**
|
||||
|
|
@ -252,6 +269,47 @@ rm -rf node_modules
|
|||
npm install
|
||||
```
|
||||
|
||||
### "Device UI Fails to Build"
|
||||
|
||||
If while trying to build you run into an error message similar to :
|
||||
```plaintext
|
||||
In file included from /workspaces/kvm/internal/native/cgo/ctrl.c:15:
|
||||
/workspaces/kvm/internal/native/cgo/ui_index.h:4:10: fatal error: ui/ui.h: No such file or directory
|
||||
#include "ui/ui.h"
|
||||
^~~~~~~~~
|
||||
compilation terminated.
|
||||
```
|
||||
This means that your system didn't create the directory-link to from _./internal/native/cgo/ui_ to ./internal/native/eez/src/ui when the repository was checked out. You can verify this is the case if _./internal/native/cgo/ui_ appears as a plain text file with only the textual contents:
|
||||
```plaintext
|
||||
../eez/src/ui
|
||||
```
|
||||
|
||||
If this happens to you need to [enable git creation of symbolic links](https://stackoverflow.com/a/59761201/2076) either globally or for the KVM repository:
|
||||
```bash
|
||||
# Globally enable git to create symlinks
|
||||
git config --global core.symlinks true
|
||||
git restore internal/native/cgo/ui
|
||||
```
|
||||
```bash
|
||||
# Enable git to create symlinks only in this project
|
||||
git config core.symlinks true
|
||||
git restore internal/native/cgo/ui
|
||||
```
|
||||
|
||||
Or if you want to manually create the symlink use:
|
||||
```bash
|
||||
# linux
|
||||
cd internal/native/cgo
|
||||
rm ui
|
||||
ln -s ../eez/src/ui ui
|
||||
```
|
||||
```dos
|
||||
rem Windows
|
||||
cd internal/native/cgo
|
||||
del ui
|
||||
mklink /d ui ..\eez\src\ui
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
|
|
|||
Loading…
Reference in New Issue