Compare commits
3 Commits
v0.1.0-rc8
...
v0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 7306f6be6d | |||
| 15e4156802 | |||
| 349711bcf0 |
@@ -17,25 +17,36 @@ concurrency:
|
|||||||
group: build-${{ github.ref }}
|
group: build-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
# We deliberately avoid actions/cache@v4 and actions/upload-artifact@v4 in this
|
# Node.js is installed at the start of every job so actions/cache@v4
|
||||||
# workflow. They are Node.js-based and the runner image (golang:*) has no Node.
|
# (which uses Node) can run. Installing Node costs ~10s; the resulting
|
||||||
# Installing Node would add ~10s per job for every run; for now we accept
|
# Go module + apt cache restore typically saves 30-60s on warm runs.
|
||||||
# that go module downloads happen on each invocation (~20-30s once warm).
|
|
||||||
# Real release artifacts are produced by release.yml via curl + Forgejo API.
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: go
|
runs-on: go
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Node (required by actions/cache)
|
||||||
|
run: |
|
||||||
|
apt-get update >/dev/null
|
||||||
|
apt-get install -y --no-install-recommends nodejs >/dev/null
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
env:
|
env:
|
||||||
# Gitea Actions doesn't auto-export GITHUB_TOKEN to the shell;
|
|
||||||
# we have to read it from secrets and surface it explicitly.
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
|
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
|
||||||
git -C /tmp/src checkout "$GITHUB_SHA"
|
git -C /tmp/src checkout "$GITHUB_SHA"
|
||||||
cp -a /tmp/src/. .
|
cp -a /tmp/src/. .
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: go-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Vet
|
- name: Vet
|
||||||
run: go vet ./...
|
run: go vet ./...
|
||||||
- name: Test with race
|
- name: Test with race
|
||||||
@@ -50,15 +61,28 @@ jobs:
|
|||||||
runs-on: go
|
runs-on: go
|
||||||
needs: test
|
needs: test
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Node (required by actions/cache)
|
||||||
|
run: |
|
||||||
|
apt-get update >/dev/null
|
||||||
|
apt-get install -y --no-install-recommends nodejs >/dev/null
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
env:
|
env:
|
||||||
# Gitea Actions doesn't auto-export GITHUB_TOKEN to the shell;
|
|
||||||
# we have to read it from secrets and surface it explicitly.
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
|
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
|
||||||
git -C /tmp/src checkout "$GITHUB_SHA"
|
git -C /tmp/src checkout "$GITHUB_SHA"
|
||||||
cp -a /tmp/src/. .
|
cp -a /tmp/src/. .
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: go-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Cross-compile drover.exe (windows/amd64)
|
- name: Cross-compile drover.exe (windows/amd64)
|
||||||
env:
|
env:
|
||||||
GOOS: windows
|
GOOS: windows
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
runs-on: go
|
runs-on: go
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Node (required by actions/cache)
|
||||||
|
run: |
|
||||||
|
apt-get update >/dev/null
|
||||||
|
apt-get install -y --no-install-recommends nodejs >/dev/null
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -24,6 +29,26 @@ jobs:
|
|||||||
git -C /tmp/src checkout "$GITHUB_SHA"
|
git -C /tmp/src checkout "$GITHUB_SHA"
|
||||||
cp -a /tmp/src/. .
|
cp -a /tmp/src/. .
|
||||||
|
|
||||||
|
# Cache Go modules — saves ~10-20s on warm runs.
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: go-${{ runner.os }}-
|
||||||
|
|
||||||
|
# Cache apt downloads — saves ~50s on the wine + innoextract install.
|
||||||
|
# Bump the cache key (-v2, -v3, ...) when the package list changes.
|
||||||
|
- name: Cache apt packages
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/var/cache/apt/archives
|
||||||
|
/var/lib/apt/lists
|
||||||
|
key: apt-trixie-wine-innoextract-v1
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func showTestWindow() {
|
||||||
|
fmt.Printf("Drover-Go v%s — test window unavailable on non-Windows builds\n", Version)
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
|
)
|
||||||
|
|
||||||
|
// showTestWindow displays a native Win32 MessageBox with build info.
|
||||||
|
// The intent is to give end-users a visual smoke-test on first run:
|
||||||
|
// double-click drover.exe (or run `drover gui`) and see that:
|
||||||
|
// 1. the binary actually launches on Windows,
|
||||||
|
// 2. the embedded version metadata is correct,
|
||||||
|
// 3. the process can talk to user32.dll (i.e. the runtime is healthy).
|
||||||
|
//
|
||||||
|
// This is *not* the production GUI — that comes later via Wails. Here we
|
||||||
|
// purposely use only stdlib + golang.org/x/sys/windows so this works
|
||||||
|
// before any Wails/CGO machinery is wired up.
|
||||||
|
func showTestWindow() {
|
||||||
|
user32 := windows.NewLazySystemDLL("user32.dll")
|
||||||
|
messageBox := user32.NewProc("MessageBoxW")
|
||||||
|
|
||||||
|
body := fmt.Sprintf(
|
||||||
|
"Drover-Go v%s\n\n"+
|
||||||
|
"Commit: %s\n"+
|
||||||
|
"Build: %s\n"+
|
||||||
|
"Go: %s\n"+
|
||||||
|
"Arch: %s/%s\n\n"+
|
||||||
|
"OK — the binary launched and the Windows API is reachable.",
|
||||||
|
Version, Commit, BuildDate, runtime.Version(), runtime.GOOS, runtime.GOARCH,
|
||||||
|
)
|
||||||
|
title := fmt.Sprintf("Drover-Go v%s — test window", Version)
|
||||||
|
|
||||||
|
bodyW, _ := windows.UTF16PtrFromString(body)
|
||||||
|
titleW, _ := windows.UTF16PtrFromString(title)
|
||||||
|
|
||||||
|
// MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND
|
||||||
|
const flags = 0x00000000 | 0x00000040 | 0x00010000
|
||||||
|
|
||||||
|
messageBox.Call(
|
||||||
|
0,
|
||||||
|
uintptr(unsafe.Pointer(bodyW)),
|
||||||
|
uintptr(unsafe.Pointer(titleW)),
|
||||||
|
flags,
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -39,6 +39,13 @@ func newRootCmd() *cobra.Command {
|
|||||||
Version: fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate),
|
Version: fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate),
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
SilenceErrors: false,
|
SilenceErrors: false,
|
||||||
|
// No subcommand and no flags = end-user double-clicked the exe;
|
||||||
|
// open the smoke-test window instead of dumping CLI help to a
|
||||||
|
// console they didn't ask for.
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
showTestWindow()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom version template: "drover-go vX.Y.Z (commit abc1234, built 2026-05-01)".
|
// Custom version template: "drover-go vX.Y.Z (commit abc1234, built 2026-05-01)".
|
||||||
@@ -49,10 +56,22 @@ func newRootCmd() *cobra.Command {
|
|||||||
root.AddCommand(newCheckCmd())
|
root.AddCommand(newCheckCmd())
|
||||||
root.AddCommand(newUpdateCmd())
|
root.AddCommand(newUpdateCmd())
|
||||||
root.AddCommand(newServiceCmd())
|
root.AddCommand(newServiceCmd())
|
||||||
|
root.AddCommand(newGUICmd())
|
||||||
|
|
||||||
return root
|
return root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newGUICmd() *cobra.Command {
|
||||||
|
return &cobra.Command{
|
||||||
|
Use: "gui",
|
||||||
|
Short: "Show a test window (smoke check that the binary launches on this machine)",
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
showTestWindow()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newCheckCmd() *cobra.Command {
|
func newCheckCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "check",
|
Use: "check",
|
||||||
|
|||||||
Reference in New Issue
Block a user