diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca7ec3a..f22ca65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ -# Tests on every pull request and push to main; the Linux and Windows builds -# and a GitHub Release with the AppImage, the Windows .exe and a source archive for every tag +# Tests on every pull request and push to main; the Linux, Windows and macOS builds +# and a GitHub Release with the AppImage, the Windows .exe, the macOS .dmg and a source archive for every tag # v (matching "version" in src-tauri/tauri.conf.json). Running the -# workflow by hand (workflow_dispatch) builds both without releasing: do that +# workflow by hand (workflow_dispatch) builds all three without releasing: do that # before tagging, since merges no longer build. # # Optional repository variables (Settings → Secrets and variables → Actions → @@ -197,15 +197,55 @@ jobs: THIRD-PARTY-NOTICES.md if-no-files-found: error + # Only for releases and manual runs, like the other builds. One universal + # .dmg (Apple Silicon and Intel) from src-tauri/tauri.macos.conf.json, which + # Tauri merges on macOS. Not code-signed or notarised (that needs an Apple + # Developer account): the linker's ad-hoc signature is enough to run, and + # Gatekeeper asks once (System Settings → Privacy & Security → Open Anyway). + # CI=true (set by Actions) skips the Finder window styling in Tauri's + # bundle_dmg.sh, which can leave the disk image busy. LICENSE and + # THIRD-PARTY-NOTICES.md are inside the .app, like the AppImage. + build-macos: + name: Build (macOS) + needs: [test, rust-test] + if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' + runs-on: macos-26 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin,x86_64-apple-darwin + + - uses: Swatinem/rust-cache@v2 + with: + workspaces: src-tauri + + - name: Install Tauri CLI + run: cargo install tauri-cli --version "^2" --locked + + - name: Build the .dmg + env: + KIVI_GITHUB_CLIENT_ID: ${{ vars.KIVI_GITHUB_CLIENT_ID }} + KIVI_GITHUB_APP_SLUG: ${{ vars.KIVI_GITHUB_APP_SLUG }} + run: cargo tauri build --target universal-apple-darwin + + - uses: actions/upload-artifact@v4 + with: + name: kivi-macos + path: src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg + if-no-files-found: error + release: name: Release - needs: [build, build-windows] + needs: [build, build-windows, build-macos] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-24.04 permissions: contents: write steps: - # Every artifact (kivi-linux, kivi-windows), each in its own folder. + # Every artifact (kivi-linux, kivi-windows, kivi-macos), each in its own folder. - uses: actions/download-artifact@v4 with: path: bundles diff --git a/CLAUDE.md b/CLAUDE.md index 64c95e4..8b9f94e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -339,7 +339,8 @@ the branch menu, and the cards' `⋯` menu) is greyed out with `aria-disabled` (the tooltip and a click say why): KiCad not linked, project not on this computer, or no `.kicad_pro`. The user chose an explicit link (no auto-detection), a path box with Browse…, and greying out instead of hiding. -Windows and macOS paths come from KiCad's documentation, untested. +Windows paths come from KiCad's documentation, untested; macOS paths were +checked by hand with KiCad 10.0.1 (see Build and run). ## 3D models @@ -401,6 +402,23 @@ cargo tauri build # release + AppImage: src-tauri/target/release/b manual runs, and has never been run by hand: nothing Windows-specific was tested locally. `src-tauri/icons/icon.ico` (from `tools/make_icons.py`) is required for the Windows build. +- macOS: `src-tauri/tauri.macos.conf.json` (merged by Tauri on macOS) makes a + `.dmg` (macOS 11+). No extra libraries (system WKWebView); `python3` comes + with the Xcode Command Line Tools. Tauri makes `KiVi.icns` from the PNGs, so + there's no `.icns` in `icons/`. CI (`build-macos`, macos-26) runs + `cargo tauri build --target universal-apple-darwin` (Apple Silicon + Intel) + and ships `KiVi__universal.dmg`, not code-signed or notarised (the + linker's ad-hoc signature only). Locally, `bundle_dmg.sh`'s Finder styling + can leave the image busy (`hdiutil: couldn't unmount … Resource busy`): + `CI=true` skips it (Actions sets it). WebView data (localStorage, + IndexedDB) lives in `~/Library/WebKit/app.kivi.desktop` for the `.app`, but + `~/Library/WebKit/kivi-desktop` for `cargo tauri dev` (an unbundled binary): + the two don't share settings. Tested by hand on Apple Silicon (macOS 27, + KiCad 10.0.1): dev and `.dmg` builds, viewer, 3D, Settings → KiCad + (`/Applications/KiCad` → `KiCad.app/Contents/MacOS/kicad`, + `SharedSupport/3dmodels`, `kicad_common.json` in + `~/Library/Preferences/kicad/10.0`), Open in KiCad, GitHub sign-in with a + GitHub App. Not tested on Intel. - The user runs the **AppImage**: rebuild after every change and tell them to restart it. A stale AppImage looks like "the fix didn't work". - `tauri.conf.json` CSP: @@ -454,7 +472,7 @@ tests/smoke.sh # pages load cleanly, viewer opens and verifies each. `tests/gjs-fs.js` `kicadDemos()` finds them and exits with a hint if they're missing. This machine's connection is slow (~0.2 MB/s): a full fetch takes ~6 min here. -- CI is `.github/workflows/ci.yml` (see README): tests and Rust tests (with the notices check) on PRs and main → Linux and Windows builds (artifacts; tags and manual runs only, the user's choice to save Actions minutes on the private repo) +- CI is `.github/workflows/ci.yml` (see README): tests and Rust tests (with the notices check) on PRs and main → Linux, Windows and macOS builds (artifacts; tags and manual runs only, the user's choice to save Actions minutes on the private repo) → GitHub Release on `v*` tags. Keep its commands in sync with this list; it was written without a way to run it locally (no act/actionlint here), so the first run on GitHub is its real test. diff --git a/README.md b/README.md index 598ef35..201206c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ change as easy to review as a code change. - **Nothing to set up on a server.** GitHub stays your source control, diff and review system; KiVi is a desktop app that parses and renders everything locally. -- **Nothing to install.** One `.AppImage` on Linux, one `.exe` on Windows. +- **Nothing to install.** One `.AppImage` on Linux, one `.exe` on Windows, + one `.dmg` on macOS. - **No account needed to play around.** Public repositories work signed out; sign in with GitHub for private repositories and the full review features. - **You are in control of access.** Sign-in uses a GitHub App with @@ -159,7 +160,10 @@ KiVi: [Releases page](https://github.com/XyleMora/KiVi/releases): on Linux the AppImage (`chmod +x KiVi_*.AppImage`, then run it); on Windows `KiVi__x64.exe` (run it; it isn't code-signed yet, so SmartScreen - asks once: *More info* → *Run anyway*). Or [build it](#building) yourself. + asks once: *More info* → *Run anyway*); on macOS `KiVi__universal.dmg` + (drag KiVi to Applications; it isn't notarised yet, so the first time it's + blocked: *System Settings* → *Privacy & Security* → *Open Anyway*). Or + [build it](#building) yourself. 2. **Add a public project.** In **Projects**, click **+** → **Remote project…** and enter `greatscottgadgets/hackrf` (the HackRF One software defined radio), or any public repository with KiCad projects. No sign-in @@ -184,7 +188,9 @@ draws wrong, diffs that miss a change or report noise, anything confusing. version and, if you can, the file. Good to know before you start: - Linux is where it's used day to day. The Windows build is made by CI and - hasn't been tried much by hand; macOS isn't built yet. + hasn't been tried much by hand. The macOS build has been tried by hand on + Apple Silicon (macOS 27, KiCad 10.0.1: viewer, 3D with the linked KiCad's + models, Open in KiCad, GitHub sign-in); not yet on Intel. - See [Known limitations](#known-limitations) for what KiVi doesn't do yet. ## Using KiVi @@ -221,8 +227,7 @@ The [user guide](docs/README.md) covers every feature in detail: - The token and refresh token are kept in the app's local storage; a release should keep them in the OS keychain, at least the long-lived refresh token. -- Auto-update, code signing, notarisation and a macOS build, file - associations. +- Auto-update, code signing, notarisation, file associations. --- @@ -244,13 +249,24 @@ KiVi is a [Tauri 2](https://tauri.app) app. Windows builds the same way, with Rust and Python installed: `cargo tauri build --no-bundle` makes `src-tauri/target/release/kivi-desktop.exe`, which runs as it is, with the pages built in (plain `cargo tauri build` also makes an NSIS installer, set in -`src-tauri/tauri.windows.conf.json`, which Tauri merges on Windows). macOS -would too, but isn't set up or tested. Tauri doesn't cross-compile. The pages +`src-tauri/tauri.windows.conf.json`, which Tauri merges on Windows). + +On macOS, install the Xcode Command Line Tools (`xcode-select --install`, +which bring `python3`) and Rust; no other libraries are needed (Tauri uses +the system's WKWebView). `cargo tauri build` makes +`src-tauri/target/release/bundle/dmg/KiVi__aarch64.dmg` (set in +`src-tauri/tauri.macos.conf.json`, which Tauri merges on macOS); CI builds one +for both architectures with `rustup target add x86_64-apple-darwin` and +`cargo tauri build --target universal-apple-darwin`. If the build stops with +`hdiutil: couldn't unmount … Resource busy`, run it as +`CI=true cargo tauri build`: that skips the Finder window styling of the disk +image, which can keep it busy. Tauri doesn't cross-compile. The pages are plain ES modules with no build step; `tools/build_web.py` (run by Tauri) copies them to `dist/web`. Settings and sign-in are kept per user (`%LOCALAPPDATA%\app.kivi.desktop` on -Windows, `~/.local/share/app.kivi.desktop` on Linux), not next to the program. +Windows, `~/.local/share/app.kivi.desktop` on Linux, +`~/Library/WebKit/app.kivi.desktop` on macOS), not next to the program. The Windows `.exe` needs the WebView2 runtime, which is part of Windows 11 and comes with Edge updates on Windows 10 (otherwise get the *Evergreen* runtime from Microsoft). @@ -401,8 +417,8 @@ ok diff downloaded only when the list changes or the cache expired after 7 unused days), then runs the unit tests, the full demo sweep and `tests/smoke.sh`. 2. **Rust tests**, alongside: `cargo test` on the Rust side, with the Rust - build cached, and a check that `THIRD-PARTY-NOTICES.md` is up to date. Both - builds below wait for both test jobs. + build cached, and a check that `THIRD-PARTY-NOTICES.md` is up to date. All + three builds below wait for both test jobs. 3. **Build (Linux)**, only for tags and manual runs (*Run workflow* on the Actions tab): `cargo tauri build`, with the Rust build and the Tauri CLI cached; lists the AppImage's bundled system libraries in @@ -412,13 +428,17 @@ ok diff runner; the `kivi-windows` artifact holds `KiVi__x64.exe` with `LICENSE` and `THIRD-PARTY-NOTICES.md` next to it (GitHub zips every run artifact for download; release files aren't). +5. **Build (macOS)**, likewise: `cargo tauri build --target + universal-apple-darwin` on a macOS runner; the `kivi-macos` artifact holds + `KiVi__universal.dmg` (Apple Silicon and Intel; `LICENSE` and + `THIRD-PARTY-NOTICES.md` are inside the app). Not code-signed or notarised. Pushing a tag `v` (matching `version` in `src-tauri/tauri.conf.json`, -checked) runs all four and publishes a GitHub Release with the AppImage, the -Windows `.exe`, `LICENSE`, `THIRD-PARTY-NOTICES.md`, `appimage-libraries.md` -and `KiVi__source.tar.gz` (`git archive` of the tag). -Merges don't build, so run the workflow by hand on `main` before tagging and -check both builds pass. +checked) runs all five and publishes a GitHub Release with the AppImage, the +Windows `.exe`, the macOS `.dmg`, `LICENSE`, `THIRD-PARTY-NOTICES.md`, +`appimage-libraries.md` and `KiVi__source.tar.gz` (`git archive` of +the tag). Merges don't build, so run the workflow by hand on `main` before +tagging and check all three builds pass. ## Licence diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json new file mode 100644 index 0000000..8efb6fc --- /dev/null +++ b/src-tauri/tauri.macos.conf.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "bundle": { + "targets": ["dmg"], + "macOS": { + "minimumSystemVersion": "11.0" + } + } +}