From 8bc6eff16c12633e5bf9661e68935597e3a8ccba Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 15 Jun 2026 11:19:20 +0200 Subject: [PATCH 1/3] #795 Add CI setup script for dependency management Prompts: - Implement a bash script here that clones the SolidOS/solid-logic repo from github, runs its build scripts, and uses npm to install it as a local depdency to solid-ui - Default to using the same branch name as the one were the CI is running, using the GITHUB_BASE_REF env variable AI work summary: - Introduced a new script `setup-ci.sh` to clone, build, and link the solid-logic repository as a peer dependency for CI. - Updated the CI workflow to run the setup script after installing npm dependencies. Co-Authored-By: Cursor --- .github/workflows/ci.yml | 1 + scripts/setup-ci.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 scripts/setup-ci.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a562f3757..25aea8c8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm ci + - run: scripts/setup-ci.sh - run: npm test - run: npm run build - run: npm run doc diff --git a/scripts/setup-ci.sh b/scripts/setup-ci.sh new file mode 100755 index 000000000..dc64b444a --- /dev/null +++ b/scripts/setup-ci.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Clone, build, and link solid-logic for CI (peer dependency of solid-ui). +# Run after `npm ci` so the local install is not removed. + +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +SOLID_LOGIC_DIR="${ROOT_DIR}/.ci-deps/solid-logic" +SOLID_LOGIC_REPO="https://github.com/SolidOS/solid-logic.git" +SOLID_LOGIC_REF="${GITHUB_BASE_REF:-${GITHUB_REF_NAME:-main}}" + +echo ">>>>> Setting up solid-logic from ${SOLID_LOGIC_REPO} (${SOLID_LOGIC_REF})" + +rm -rf "$SOLID_LOGIC_DIR" +mkdir -p "$(dirname "$SOLID_LOGIC_DIR")" +git clone --depth 1 --branch "$SOLID_LOGIC_REF" "$SOLID_LOGIC_REPO" "$SOLID_LOGIC_DIR" + +echo ">>>>> Installing solid-logic dependencies" +(cd "$SOLID_LOGIC_DIR" && npm ci) + +echo ">>>>> Building solid-logic" +(cd "$SOLID_LOGIC_DIR" && npm run build) + +echo ">>>>> Installing solid-logic as a local dependency in solid-ui" +cd "$ROOT_DIR" +npm install --no-save "solid-logic@file:${SOLID_LOGIC_DIR}" + +echo ">>>>> solid-logic setup complete" From 843a6469418de5b473fc5a62dbf016fae74315f8 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 15 Jun 2026 11:21:19 +0200 Subject: [PATCH 2/3] #795 Run CI against staging and typecheck tests --- .github/workflows/ci.yml | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25aea8c8e..69ecd76be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,11 @@ on: push: branches: - main + - staging pull_request: branches: - main + - staging workflow_dispatch: jobs: diff --git a/package.json b/package.json index 4e46a4d13..fb3221739 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "lint-fix": "eslint --fix", "typecheck": "tsc --noEmit", "typecheck-test": "tsc --noEmit -p tsconfig.test.json", - "test": "vitest run", + "test": "npm run typecheck-test && vitest run", "test-coverage": "vitest run --coverage", "test-debug": "vitest --inspect-brk --no-file-parallelism", "doc": "typedoc --out ./docs/api/ ./src/ --excludeInternal", From 4a5cd75d910e30577896527c1b6c77308c08f3d9 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 15 Jun 2026 11:49:58 +0200 Subject: [PATCH 3/3] #795 Fix tests --- test/unit/login/login.test.ts | 28 ++++++++++++++-------------- vite.config.ts | 4 ++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/test/unit/login/login.test.ts b/test/unit/login/login.test.ts index 31010ce37..eb02c7a1e 100644 --- a/test/unit/login/login.test.ts +++ b/test/unit/login/login.test.ts @@ -1,5 +1,4 @@ import { afterAll, afterEach, describe, expect, it, vi } from 'vitest' -import { authn, authSession, solidLogicSingleton } from 'solid-logic' import * as testLogin from '../../../src/login/login' describe('ensureLoggedIn', () => { @@ -20,24 +19,25 @@ describe('getUserRoles', () => { }) it('returns [] and does not load preferences when current user is missing', async () => { - vi.spyOn(authSession, 'info', 'get').mockReturnValue({ + vi.resetModules() + + const { authn, authSession, solidLogicSingleton } = await import('solid-logic') + + authSession.info = { isLoggedIn: true, - webId: 'https://alice.example.com/profile/card#me', - sessionId: 'test-session' - }) + webId: 'https://alice.example.com/profile/card#me' + } - const currentUserSpy = vi - .spyOn(authn, 'currentUser') - .mockReturnValue(null) - const loadPreferencesSpy = vi.spyOn( - solidLogicSingleton.profile, - 'loadPreferences' - ) + vi.spyOn(authn, 'checkUser').mockResolvedValue(null) - const roles = await testLogin.getUserRoles() + const currentUserSpy = vi.spyOn(authn, 'currentUser').mockReturnValue(null) + const loadPreferencesSpy = vi.spyOn(solidLogicSingleton.profile, 'loadPreferences') + + const { getUserRoles } = await import('../../../src/login/login') + const roles = await getUserRoles() - expect(currentUserSpy).toHaveBeenCalled() expect(roles).toEqual([]) + expect(currentUserSpy).toHaveBeenCalled() expect(loadPreferencesSpy).not.toHaveBeenCalled() }) }) diff --git a/vite.config.ts b/vite.config.ts index 72f3399e5..81811f405 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -66,6 +66,10 @@ function defaultConfig(): UserConfig { test: { environment: 'jsdom', setupFiles: ['test/helpers/setup.ts'], + include: [ + 'src/**/*.test.ts', + 'test/**/*.test.ts', + ], coverage: { include: ['src/**/*.[jt]s'], },