Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

test(desktop): read macOS fixture executable identity and retain signed installers (#776)

tianma-ifda122d83ef43
diff --git a/.github/workflows/desktop-update-verification.yml b/.github/workflows/desktop-update-verification.yml
index aa0d152a..7430baca 100644
--- a/.github/workflows/desktop-update-verification.yml
+++ b/.github/workflows/desktop-update-verification.yml
@@ -3,6 +3,14 @@ name: Verify native desktop updates
on:
workflow_dispatch:
inputs:
+ fixture_run:
+ description: Reuse signed test installers from this verification run (optional)
+ type: string
+ required: false
+ mac_only:
+ description: Rerun only both macOS architectures
+ type: boolean
+ default: false
windows_only:
description: Rerun only the Windows installer verification
type: boolean
@@ -10,6 +18,7 @@ on:
permissions:
contents: read
+ actions: read
jobs:
native-update:
@@ -20,21 +29,22 @@ jobs:
strategy:
fail-fast: false
matrix:
- include: ${{ fromJSON(inputs.windows_only && '[{"platform":"Windows","runner":"windows-latest","arch":"x64"}]' || '[{"platform":"macOS","runner":"macos-15","arch":"arm64"},{"platform":"macOS","runner":"macos-15-intel","arch":"x64"},{"platform":"Windows","runner":"windows-latest","arch":"x64"},{"platform":"Linux","runner":"ubuntu-22.04","arch":"x64"}]') }}
+ include: ${{ fromJSON(inputs.windows_only && '[{"platform":"Windows","runner":"windows-latest","arch":"x64"}]' || inputs.mac_only && '[{"platform":"macOS","runner":"macos-15","arch":"arm64"},{"platform":"macOS","runner":"macos-15-intel","arch":"x64"}]' || '[{"platform":"macOS","runner":"macos-15","arch":"arm64"},{"platform":"macOS","runner":"macos-15-intel","arch":"x64"},{"platform":"Windows","runner":"windows-latest","arch":"x64"},{"platform":"Linux","runner":"ubuntu-22.04","arch":"x64"}]') }}
steps:
- uses: actions/checkout@v5
- uses: oven-sh/setup-bun@v2
- uses: dtolnay/rust-toolchain@stable
+ if: inputs.fixture_run == ''
- name: Cache Windows dependencies
- if: runner.os == 'Windows'
+ if: runner.os == 'Windows' && inputs.fixture_run == ''
uses: actions/cache@v5
with:
path: ~\AppData\Local\bun\install\cache
key: ${{ runner.os }}-${{ matrix.arch }}-bun-${{ hashFiles('bun.lock') }}
- name: Cache Windows Electron downloads
- if: runner.os == 'Windows'
+ if: runner.os == 'Windows' && inputs.fixture_run == ''
uses: actions/cache@v5
with:
path: |
@@ -43,6 +53,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.arch }}-electron-${{ hashFiles('bun.lock', 'apps/desktop/package.json') }}
- name: Cache Rust dependencies
+ if: inputs.fixture_run == ''
uses: actions/cache@v5
with:
path: |
@@ -60,7 +71,7 @@ jobs:
sudo apt-get install --yes libfuse2 xvfb
- name: Import macOS signing identity
- if: runner.os == 'macOS'
+ if: runner.os == 'macOS' && inputs.fixture_run == ''
env:
MAC_CERTIFICATE_DER_BASE64: ${{ secrets.EDGEEVER_MAC_CERTIFICATE_DER_BASE64 }}
MAC_PRIVATE_KEY_BASE64: ${{ secrets.EDGEEVER_MAC_PRIVATE_KEY_BASE64 }}
@@ -86,9 +97,11 @@ jobs:
echo "CSC_IDENTITY_AUTO_DISCOVERY=true" >> "$GITHUB_ENV"
- name: Install dependencies
+ if: inputs.fixture_run == ''
run: bun install --frozen-lockfile
- name: Build renderer and sidecar
+ if: inputs.fixture_run == ''
env:
EDGE_EVER_DESKTOP_BUILD: '1'
run: |
@@ -96,10 +109,37 @@ jobs:
cargo build --manifest-path crates/desktop-sidecar/Cargo.toml --release
- name: Build three isolated instrumented EdgeEver installers
+ if: inputs.fixture_run == ''
env:
EDGE_EVER_DESKTOP_ARCH: ${{ matrix.arch }}
run: node scripts/build-native-update-fixtures.mjs
+ - name: Retain signed test installers for verification reruns
+ if: inputs.fixture_run == ''
+ uses: actions/upload-artifact@v6
+ with:
+ name: native-update-installers-${{ matrix.platform }}-${{ matrix.arch }}
+ path: |
+ ${{ runner.temp }}/edgeever-update-verification/versions.json
+ ${{ runner.temp }}/edgeever-update-verification/public-key.pem
+ ${{ runner.temp }}/edgeever-update-verification/*/EdgeEver-*.zip
+ ${{ runner.temp }}/edgeever-update-verification/*/EdgeEver-*.exe
+ ${{ runner.temp }}/edgeever-update-verification/*/EdgeEver-*.AppImage
+ ${{ runner.temp }}/edgeever-update-verification/*/latest*
+ ${{ runner.temp }}/edgeever-update-verification/*/payload.sha256
+ retention-days: 7
+ compression-level: 0
+ if-no-files-found: error
+
+ - name: Download previously signed test installers
+ if: inputs.fixture_run != ''
+ env:
+ GH_TOKEN: ${{ github.token }}
+ FIXTURE_RUN: ${{ inputs.fixture_run }}
+ ARTIFACT_NAME: native-update-installers-${{ matrix.platform }}-${{ matrix.arch }}
+ shell: bash
+ run: gh run download "$FIXTURE_RUN" --repo "$GITHUB_REPOSITORY" --name "$ARTIFACT_NAME" --dir "$RUNNER_TEMP/edgeever-update-verification"
+
- name: Exercise real native updates
if: runner.os != 'Linux'
run: node scripts/verify-native-desktop-update.mjs "${{ runner.temp }}/edgeever-update-verification"
diff --git a/scripts/build-native-update-fixtures.mjs b/scripts/build-native-update-fixtures.mjs
index 7ed2eec8..a201b630 100644
--- a/scripts/build-native-update-fixtures.mjs
+++ b/scripts/build-native-update-fixtures.mjs
@@ -1,5 +1,5 @@
import { createRequire } from "node:module";
-import { generateKeyPairSync } from "node:crypto";
+import { generateKeyPairSync, createHash } from "node:crypto";
import { readFileSync, writeFileSync, mkdirSync, copyFileSync, rmSync } from "node:fs";
import { join, resolve } from "node:path";
import { spawnSync } from "node:child_process";
@@ -56,6 +56,11 @@ try {
writeFileSync(configPath, JSON.stringify(config));
const target = process.platform === "darwin" ? ["--mac", "zip"] : process.platform === "win32" ? ["--win", "nsis"] : ["--linux", "AppImage"];
run(process.execPath, [builderCli, "--projectDir", desktop, "--config", configPath, "--publish", "never", ...target, `--${process.arch}`], desktop);
+ const payload = process.platform === "darwin"
+ ? join(directory, process.arch === "arm64" ? "mac-arm64" : "mac", "EdgeEver Update Verification.app/Contents/Resources/app.asar")
+ : process.platform === "win32" ? join(directory, "win-unpacked/resources/app.asar")
+ : join(directory, `EdgeEver-${version}-linux-x64.AppImage`);
+ writeFileSync(join(directory, "payload.sha256"), createHash("sha256").update(readFileSync(payload)).digest("hex"));
if (process.platform === "win32") {
await createWindowsUpdateMetadata({ directory, version });
signWindowsUpdateManifest({
diff --git a/scripts/native-update-instrumentation.test.mjs b/scripts/native-update-instrumentation.test.mjs
index 6f0a4d56..d181c0f2 100644
--- a/scripts/native-update-instrumentation.test.mjs
+++ b/scripts/native-update-instrumentation.test.mjs
@@ -34,7 +34,8 @@ test("the installer workflow is official-only, manual, and never publishes asset
expect(workflow).not.toContain("contents: write");
expect(workflow).not.toContain("release_tag");
const matrices = [...workflow.matchAll(/'(\[\{.*?\}\])'/g)].map((match) => JSON.parse(match[1]));
- expect(matrices).toHaveLength(2);
+ expect(matrices).toHaveLength(3);
expect(matrices[0].map((entry) => entry.runner)).toEqual(["windows-latest"]);
- expect(matrices[1].map((entry) => entry.runner)).toEqual(["macos-15", "macos-15-intel", "windows-latest", "ubuntu-22.04"]);
+ expect(matrices[1].map((entry) => entry.runner)).toEqual(["macos-15", "macos-15-intel"]);
+ expect(matrices[2].map((entry) => entry.runner)).toEqual(["macos-15", "macos-15-intel", "windows-latest", "ubuntu-22.04"]);
});
diff --git a/scripts/verify-native-desktop-update.mjs b/scripts/verify-native-desktop-update.mjs
index 883caf6a..dbc12ccc 100644
--- a/scripts/verify-native-desktop-update.mjs
+++ b/scripts/verify-native-desktop-update.mjs
@@ -73,7 +73,10 @@ const installBaseline = async (directory) => {
if (process.platform === "darwin") {
const unpack = spawnSync("ditto", ["-x", "-k", join(root, oldVersion, packageName(oldVersion)), installed], { encoding: "utf8" });
if (unpack.status !== 0) throw new Error(unpack.stderr);
- return join(installed, "EdgeEver Update Verification.app/Contents/MacOS/EdgeEverUpdateVerifier");
+ const bundle = join(installed, "EdgeEver Update Verification.app");
+ const metadata = spawnSync("/usr/libexec/PlistBuddy", ["-c", "Print :CFBundleExecutable", join(bundle, "Contents/Info.plist")], { encoding: "utf8" });
+ if (metadata.status !== 0) throw new Error("Cannot read the signed fixture's CFBundleExecutable");
+ return join(bundle, "Contents/MacOS", metadata.stdout.trim());
}
if (process.platform === "win32") {
stopWindowsUpdateFixtures();
@@ -131,6 +134,7 @@ try {
}));
const executable = await installBaseline(directory);
const launch = () => {
+ if (!existsSync(executable)) throw new Error(`Installed fixture executable missing: ${executable}`);
const child = spawn(executable, [], { env, stdio: ["ignore", "pipe", "pipe"] });
child.on("error", (error) => appendFileSync(join(directory, "process.log"), `${error.stack}\n`));
child.stdout.on("data", (data) => appendFileSync(join(directory, "process.log"), data));
@@ -175,7 +179,8 @@ try {
: join(root, latestVersion, packageName(latestVersion));
const installedPayload = process.platform === "darwin" ? join(dirname(executable), "../Resources/app.asar")
: process.platform === "win32" ? join(dirname(executable), "resources/app.asar") : executable;
- const expectedDigest = digest(expected);
+ const recordedDigest = join(root, latestVersion, "payload.sha256");
+ const expectedDigest = existsSync(recordedDigest) ? readFileSync(recordedDigest, "utf8").trim() : digest(expected);
await until(() => {
try { return digest(installedPayload) === expectedDigest; } catch { return false; }
}, "native installation replaces the actual installed payload", 240_000);