Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release

# Builds the pet's installers with nsgo build (go tool nsgo, the version go.mod pins) and publishes them on the GitHub release of the tag: the macOS disk images on a macOS runner, signed with YLDM's Developer ID and notarized so Gatekeeper opens them without a warning, and the Linux packages and AppImages on Ubuntu, with nsgo build's install scripts. Windows is left out until the pet runs there (see the README).
# Builds the pet's installers with nsgo build (go tool nsgo, the version go.mod pins) and publishes them on the GitHub release of the tag: the macOS disk images on a macOS runner, signed with YLDM's Developer ID and notarized so Gatekeeper opens them without a warning, the Linux packages and AppImages on Ubuntu, with nsgo build's install scripts, and the Windows installers on Ubuntu too, with NSIS, as NSGo's desktop builds need no cgo. The Windows installers carry no signature yet, for which SmartScreen warns; that needs a code signing certificate.
#
# Push a tag v<version>, matching version in nsgo.yaml, to release. The release's notes are CHANGELOG.md's section for the version (tools/release-notes.sh), followed by GitHub's list of the pull requests since the last release; a tag without that section fails before anything builds. A pull request that changes this file, or a run by hand (Actions › Release › Run workflow), builds and signs the same packages without publishing them, keeping them as the run's artifacts.
#
Expand Down Expand Up @@ -34,12 +34,17 @@ jobs:
# installers: what each target must make, after nsgo-pet-<version>-<target>, so that a package nsgo build leaves out fails the row rather than going missing from the release. scripts: install.sh and install.ps1, kept from one row.
- { name: macOS, os: macos-latest, targets: "macos_arm64,macos_x64", installers: ".dmg" }
- { name: Linux, os: ubuntu-latest, targets: "linux_x64,linux_arm64", installers: ".deb .pkg.tar.gz .AppImage", scripts: true }
- { name: Windows, os: ubuntu-latest, targets: "windows_x64", installers: "-setup.exe" }
env:
MACOS_SIGNING_IDENTITY: ${{ vars.MACOS_SIGNING_IDENTITY }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Without NSIS nsgo build leaves the Windows installer out, which Collect the packages then fails on.
- name: Install NSIS, for the Windows installers
if: matrix.name == 'Windows'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends nsis
# A tag that does not match the version in nsgo.yaml would publish packages named for another version, one without notes a release that says nothing, and one without the updates key installers no pet updates to.
- name: Check the version
if: startsWith(github.ref, 'refs/tags/')
Expand Down
3 changes: 2 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nsgo-pet is two things in one repository: the pet engine, a Go module any NSGo a

- The engine is a module of its own so that importing it downloads no pets: `resources/` is about 175 MB and belongs to the app alone. The root `go.mod` replaces the engine with `./pet`, so both change together in one commit.
- The engine ships no assets and no app policy. It opens no tray, checks for no updates, writes no storage, shows no text of its own and never calls `cx.Quit()`; menus, labels and lifecycle are the host's.
- On Windows, whose NSGo player refuses video with alpha ([nsgo#862](https://github.com/nsgo-dev/nsgo/issues/862)), the engine plays the WebM clips in its own decoder over libvpx, which the host ships in `resources/windows`; elsewhere it plays them with `core.Video`.
- Everything that moves a window is behind `Options.Window`. A pet in a host's view plays walking clips in place and dangles where it is, as it has no window to move.
- What the user is doing reaches the clips through `Context` alone: the host's `Options.Context`, or the app in front without one. Clip rules never read the host's state another way.
- The engine's exported API is public: changing or removing any of it breaks hosts, so it needs the user's agreement first.
Expand All @@ -38,7 +39,7 @@ The engine keeps no state beyond the pet it plays. The app stores the ID of the

## Verification

Both test suites run headless on `nsgotest`, which loads no media. The app's tests check every shipped pet's manifest and clip files, the policy's weights and the menus; the engine's cover loading, host state, playing by ID and leaving against fixture packs. Real playback, transparency, floating, walking at a screen's edge and Linux's X11 and Wayland differences need a manual run with `go tool nsgo dev`.
Both test suites run headless on `nsgotest`, which loads no media. The app's tests check every shipped pet's manifest and clip files, the policy's weights and the menus; the engine's cover loading, host state, playing by ID and leaving against fixture packs, and its Windows decoder against the app's clips where libvpx loads. Real playback, transparency, floating, walking at a screen's edge and Linux's X11 and Wayland differences need a manual run with `go tool nsgo dev`.

## Subjects

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Run on Windows x64, decoding the WebM clips with libvpx, which NSGo's Windows player cannot play with their alpha. (#13 by @houko)
- Make the docs' search a command palette driven by the arrow keys, mark the reader's place in the table of contents and drop the code blocks' title bars.

## [0.1.0] - 2026-11-22
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Your app owns the windows, menus and lifecycle. The engine opens no tray, checks
| --- | --- |
| macOS | Runs, playing the HEVC-with-alpha clips. |
| Linux | Plays the WebM clips. The window floats on X11; on Wayland it cannot float or move itself. |
| Windows | Not yet: NSGo's Windows player refuses clips with alpha. |
| Windows | Runs on x64. NSGo's Windows player refuses clips with alpha, so the engine decodes the WebM clips itself with libvpx, which the app ships in `resources/windows` ([NOTICE](resources/windows/NOTICE.md)), and shows the frames in an image. |

Lunar festivals, hit testing by the clip's alpha ([nsgo#599](https://github.com/nsgo-dev/nsgo/issues/599)), speech bubbles and weather are not done yet.

Expand All @@ -134,6 +134,8 @@ go tool nsgo test . # the app's headless tests, which check every pet in
(cd pet && go test ./...) # the engine's tests
```

The tests of the Windows decoder run where libvpx loads: on macOS with Homebrew's (`brew install libvpx`), on Linux with the distribution's; elsewhere they are skipped.

The website is in `website/` and its docs in `docs/public/`; with [Bun](https://bun.sh), `bun install && bun run dev` there serves them and `bun run build` builds them.

To release, move `CHANGELOG.md`'s `Unreleased` bullets under `## [<version>] - <date>`, set `version` in `nsgo.yaml` to the same version and push the tag `v<version>`. [The release workflow](.github/workflows/release.yml) builds, signs and publishes the installers with that section as the notes.
Expand All @@ -142,4 +144,4 @@ Read [ARCHITECTURE.md](ARCHITECTURE.md) before changing code, and [AGENTS.md](AG

## License

The code, the app and the engine, is MIT, Copyright (c) 2026 nsgo-dev: see [LICENSE](LICENSE). Each pet keeps its own license, listed under [Pets](#pets) and in its `NOTICE.md`. NSGo-chan's art is CC BY-NC 4.0 and Big Blue Fish's character CC BY-NC-SA 4.0, so a build that includes either may not be used commercially.
The code, the app and the engine, is MIT, Copyright (c) 2026 nsgo-dev: see [LICENSE](LICENSE). Each pet keeps its own license, listed under [Pets](#pets) and in its `NOTICE.md`. NSGo-chan's art is CC BY-NC 4.0 and Big Blue Fish's character CC BY-NC-SA 4.0, so a build that includes either may not be used commercially. The libvpx and winpthreads libraries in `resources/windows` keep theirs, BSD-3-Clause and MIT, in [its NOTICE](resources/windows/NOTICE.md).
6 changes: 4 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ desktop.OpenWindow(cx, pet.WindowOptions(pack), func(cx *core.Scope) core.Node {
| --- | --- |
| macOS | 可运行,播放带透明通道的 HEVC 动画。 |
| Linux | 播放 WebM 动画。X11 下窗口可浮动;Wayland 下不能浮动,也不能自己移动。 |
| Windows | 暂不支持:NSGo 的 Windows 播放器拒绝带透明通道的视频。 |
| Windows | 可在 x64 上运行。NSGo 的 Windows 播放器拒绝带透明通道的视频,所以引擎用 libvpx 自己解码 WebM 动画并显示在图片里;libvpx 由应用放在 `resources/windows` 中分发([NOTICE](resources/windows/NOTICE.md))。 |

农历节日、按动画透明度判定点击([nsgo#599](https://github.com/nsgo-dev/nsgo/issues/599))、对话气泡和天气还没做。

Expand All @@ -134,6 +134,8 @@ go tool nsgo test . # the app's headless tests, which check every pet in
(cd pet && go test ./...) # the engine's tests
```

Windows 解码器的测试只在能加载 libvpx 的地方运行:macOS 上用 Homebrew 的(`brew install libvpx`),Linux 上用发行版的;其他情况下跳过。

网站在 `website/`,文档在 `docs/public/`;装好 [Bun](https://bun.sh) 后,在那里运行 `bun install && bun run dev` 启动预览,`bun run build` 构建。

发布时,把 `CHANGELOG.md` 里 `Unreleased` 下的条目移到 `## [<版本>] - <日期>` 下,把 `nsgo.yaml` 的 `version` 设为同一版本,然后推送标签 `v<版本>`。[发布工作流](.github/workflows/release.yml) 会构建、签名并发布安装包,以该节作为发布说明。
Expand All @@ -142,4 +144,4 @@ go tool nsgo test . # the app's headless tests, which check every pet in

## 许可证

代码(应用和引擎)采用 MIT 许可,Copyright (c) 2026 nsgo-dev,见 [LICENSE](LICENSE)。每只宠物保留各自的许可,列在 [宠物](#宠物) 和各自的 `NOTICE.md` 中。NSGo 酱的美术采用 CC BY-NC 4.0,大蓝鱼的角色采用 CC BY-NC-SA 4.0,因此包含其中任一只的构建都不得商用。
代码(应用和引擎)采用 MIT 许可,Copyright (c) 2026 nsgo-dev,见 [LICENSE](LICENSE)。每只宠物保留各自的许可,列在 [宠物](#宠物) 和各自的 `NOTICE.md` 中。NSGo 酱的美术采用 CC BY-NC 4.0,大蓝鱼的角色采用 CC BY-NC-SA 4.0,因此包含其中任一只的构建都不得商用。`resources/windows` 中的 libvpx 和 winpthreads 库保留各自的许可(BSD-3-Clause 和 MIT),见[其 NOTICE](resources/windows/NOTICE.md)。
36 changes: 36 additions & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,39 @@ func TestStatsAgentNamesThePlatform(t *testing.T) {
t.Errorf("web agent = %q, want none", a)
}
}

var windows = nsgotest.Environment(core.Environment{OS: core.OSWindows, Idiom: core.IdiomDesktop})

// On Windows a pet chosen in the settings' grid replaces the one playing, as the app's window does, and plays in the engine's own player, an image rather than a video; the engine's tests decode its frames.
func TestWindowsSettingsSwitchPets(t *testing.T) {
ps := packs(t)
find := func(id string) *pet.Pack {
for _, p := range ps {
if p.ID == id {
return p
}
}
t.Fatalf("no %s pet", id)
return nil
}
app := nsgotest.Start(t, func(cx *core.Scope) core.Node {
chosen := core.NewSignal(cx, "nsgo-chan")
return core.View{Style: core.Style{Direction: core.Row}, Children: []core.Node{
core.View{Style: core.Style{Width: core.Pt(620), Height: core.Pt(500)}, Children: []core.Node{Settings(cx, prefs(t, cx, chosen, core.NewSignal(cx, true)))}},
core.Dynamic(func(cx *core.Scope) core.Node {
p := pet.New(cx, find(chosen.Get()), pet.Options{})
cx.Post(p.Start)
return p.View()
}),
}}
}, windows)
player := func(name string) bool {
v := app.FindMounted("id:slot1")
return v.Kind.String() == "image" && v.Props.Label == name
}
if !player(find("nsgo-chan").Name) {
t.Fatalf("NSGo-chan plays in a %s labeled %q, want the engine's image", app.FindMounted("id:slot1").Kind, app.FindMounted("id:slot1").Props.Label)
}
app.Press("id:pet-bigbluefish")
app.WaitUntil(10*time.Second, func() bool { return player(find("bigbluefish").Name) })
}
2 changes: 2 additions & 0 deletions docs/public/en/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func loadPacks() ([]*pet.Pack, error) {
}
```

On Windows, whose NSGo player refuses clips with alpha, the engine decodes the WebM clips itself with libvpx, which your app ships: copy `libvpx-1.dll` and `libwinpthread-1.dll` from nsgo-pet's [`resources/windows/`](https://github.com/nsgo-dev/nsgo-pet/tree/main/resources/windows) into your app's `resources/windows/`, with their licenses.

## Show a pet

As a view in your own layout:
Expand Down
2 changes: 2 additions & 0 deletions docs/public/zh/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func loadPacks() ([]*pet.Pack, error) {
}
```

Windows 上 NSGo 的播放器拒绝带透明通道的动画,引擎会用 libvpx 自己解码 WebM 动画,而 libvpx 由你的应用分发:把 nsgo-pet 的 [`resources/windows/`](https://github.com/nsgo-dev/nsgo-pet/tree/main/resources/windows) 里的 `libvpx-1.dll` 和 `libwinpthread-1.dll` 连同它们的许可复制到你的应用的 `resources/windows/`。

## 展示宠物

作为一个视图放进你自己的布局:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (

require (
github.com/andybalholm/brotli v1.3.0 // indirect
github.com/at-wat/ebml-go v0.19.4 // indirect
github.com/dop251/goja v0.0.0-20261027234916-5f913d1693d9 // indirect
github.com/ebitengine/purego v0.11.3 // indirect
github.com/evanw/esbuild v0.28.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/andybalholm/brotli v1.3.0 h1:IdkhjSe/+34U+fP7FSR2Q6Poj1hnHUa2GoWmzXJd6qY=
github.com/andybalholm/brotli v1.3.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/at-wat/ebml-go v0.19.4 h1:6F767ThzH/JqNUsF79PwRFP0pwUF5ALXWJ6pXuiolI8=
github.com/at-wat/ebml-go v0.19.4/go.mod h1:wu3fQj+DWo6SOOl9c4yDi+gFs9Oa96Z2B5qxo1OxFYY=
github.com/dlclark/regexp2/v2 v2.11.0 h1:z5uRPHav+eTVpoffDSuUP2KPS4f1ONZaPDK73S8HA0w=
github.com/dlclark/regexp2/v2 v2.11.0/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dop251/goja v0.0.0-20261027234916-5f913d1693d9 h1:K1R7adPxJGLfojyUBe6TuuqcvS6YqQAdg2HujQ9Il+Y=
Expand Down
4 changes: 2 additions & 2 deletions nsgo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ build:
output: dist
# true opens the output directory after building.
open: true
# Desktop only, the targets the release publishes; Windows waits until the pet plays there (see the README).
targets: [macos_arm64, macos_x64, linux_x64, linux_arm64]
# Desktop only, the targets the release publishes.
targets: [macos_arm64, macos_x64, linux_x64, linux_arm64, windows_x64]

# The repository whose latest release holds the appcasts installed pets read.
release:
Expand Down
Loading
Loading