Skip to content

Commit e3ac56c

Browse files
committed
feat(ci): use snapshot versions in verdaccio for integration tests
Integration tests were failing because packages published to Verdaccio with the 'integration' dist-tag had transitive dependencies (e.g. @clerk/shared from @clerk/ui) that were resolved from npm instead of the local Verdaccio registry. Changed approach to use snapshot versions that don't exist on npm: - Create unique snapshot versions with `changeset version --snapshot ci` - Publish to 'latest' tag instead of 'integration' tag - Updated linkPackage to return '*' in CI (gets latest snapshot) - Modified snapshot.mjs to always generate changeset for all packages - Updated verdaccio action to check for snapshot versions instead of integration tag - Removed redundant long-running apps from presets that were causing test duplication This ensures all @clerk packages, including transitive dependencies, are installed from the locally published Verdaccio versions.
1 parent 598a699 commit e3ac56c

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

.github/actions/verdaccio/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ runs:
7575
- name: Print published Clerk package versions
7676
shell: bash
7777
run: |
78-
echo "Published @clerk packages under 'integration' tag:"
78+
echo "Published @clerk packages (snapshot versions):"
7979
echo "=================================================="
8080
packages=(
8181
"@clerk/agent-toolkit"
@@ -102,6 +102,6 @@ runs:
102102
"@clerk/vue"
103103
)
104104
for pkg in "${packages[@]}"; do
105-
version=$(pnpm view "$pkg@integration" version 2>/dev/null || echo "not found")
106-
printf "%-35s %s\n" "$pkg@integration:" "$version"
105+
version=$(pnpm view "$pkg" version 2>/dev/null || echo "not found")
106+
printf "%-35s %s\n" "$pkg:" "$version"
107107
done

.github/workflows/ci.yml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ jobs:
6464
- name: Setup
6565
id: config
6666
uses: ./.github/actions/init-blacksmith
67-
with:
68-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
69-
turbo-team: ${{ vars.TURBO_TEAM }}
70-
turbo-token: ${{ secrets.TURBO_TOKEN }}
67+
# with:
68+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
69+
# turbo-team: ${{ vars.TURBO_TEAM }}
70+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
7171

7272
- name: Verify lockfile is deduped
7373
run: pnpm dedupe --check
@@ -110,11 +110,11 @@ jobs:
110110
- name: Setup
111111
id: config
112112
uses: ./.github/actions/init-blacksmith
113-
with:
114-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
115-
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
116-
turbo-team: ${{ vars.TURBO_TEAM }}
117-
turbo-token: ${{ secrets.TURBO_TOKEN }}
113+
# with:
114+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
115+
# turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
116+
# turbo-team: ${{ vars.TURBO_TEAM }}
117+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
118118

119119
- name: Turbo Build
120120
run: pnpm turbo build $TURBO_ARGS --only
@@ -154,11 +154,11 @@ jobs:
154154
- name: Setup
155155
id: config
156156
uses: ./.github/actions/init-blacksmith
157-
with:
158-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
159-
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
160-
turbo-team: ${{ vars.TURBO_TEAM }}
161-
turbo-token: ${{ secrets.TURBO_TOKEN }}
157+
# with:
158+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
159+
# turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
160+
# turbo-team: ${{ vars.TURBO_TEAM }}
161+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
162162

163163
- name: Check size using bundlewatch
164164
continue-on-error: true
@@ -231,10 +231,10 @@ jobs:
231231
with:
232232
# Ensures that all builds are cached appropriately with a consistent run name `Unit Tests (20)`.
233233
node-version: ${{ matrix.node-version }}
234-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
235-
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
236-
turbo-team: ${{ vars.TURBO_TEAM }}
237-
turbo-token: ${{ secrets.TURBO_TOKEN }}
234+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
235+
# turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
236+
# turbo-team: ${{ vars.TURBO_TEAM }}
237+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
238238

239239
- name: Rebuild @clerk/shared with CLERK_USE_RQ=true
240240
if: ${{ matrix.clerk-use-rq == 'true' }}
@@ -280,7 +280,8 @@ jobs:
280280
retention-days: 5
281281

282282
integration-tests:
283-
needs: [check-permissions, build-packages]
283+
# needs: [check-permissions, build-packages]
284+
needs: [check-permissions]
284285
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
285286
name: Integration Tests (${{ matrix.test-name }}, ${{ matrix.test-project }}${{ matrix.next-version && format(', {0}', matrix.next-version) || '' }}${{ matrix.clerk-use-rq == 'true' && ', RQ' || '' }})
286287
permissions:
@@ -355,9 +356,9 @@ jobs:
355356
id: config
356357
uses: ./.github/actions/init-blacksmith
357358
with:
358-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
359-
turbo-team: ${{ vars.TURBO_TEAM }}
360-
turbo-token: ${{ secrets.TURBO_TOKEN }}
359+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
360+
# turbo-team: ${{ vars.TURBO_TEAM }}
361+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
361362
playwright-enabled: true
362363

363364
- name: Verify jq is installed
@@ -405,12 +406,16 @@ jobs:
405406
env:
406407
CLERK_USE_RQ: true
407408

409+
- name: Version packages for snapshot
410+
if: ${{ steps.task-status.outputs.affected == '1' }}
411+
run: npm run version-packages:snapshot ci
412+
408413
- name: Verdaccio
409414
if: ${{ steps.task-status.outputs.affected == '1' }}
410415
uses: ./.github/actions/verdaccio
411416
with:
412417
publish-cmd: |
413-
if [ "$(pnpm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else CLERK_USE_RQ=${{ matrix.clerk-use-rq }} pnpm turbo build $TURBO_ARGS --only && pnpm changeset publish --no-git-tag --tag integration; fi
418+
if [ "$(pnpm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else ${{ matrix.clerk-use-rq == 'true' && 'CLERK_USE_RQ=true' || '' }} pnpm turbo build $TURBO_ARGS --only && pnpm changeset publish --no-git-tag --tag latest; fi
414419
415420
- name: Edit .npmrc [link-workspace-packages=false]
416421
run: sed -i -E 's/link-workspace-packages=(deep|true)/link-workspace-packages=false/' .npmrc
@@ -423,6 +428,8 @@ jobs:
423428
pnpm config set minimum-release-age-exclude @clerk/*
424429
pnpm add @clerk/backend
425430
431+
# Install published packages from Verdaccio to test against real npm install scenarios
432+
# rather than local monorepo builds. Validates package structure, dependencies, and entry points.
426433
- name: Install @clerk/clerk-js in os temp
427434
if: ${{ steps.task-status.outputs.affected == '1' }}
428435
working-directory: ${{runner.temp}}
@@ -483,7 +490,6 @@ jobs:
483490
E2E_CLERK_ENCRYPTION_KEY: ${{ matrix.clerk-encryption-key }}
484491
CLERK_USE_RQ: ${{ matrix.clerk-use-rq }}
485492
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
486-
MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }}
487493
NODE_EXTRA_CA_CERTS: ${{ github.workspace }}/integration/certs/rootCA.pem
488494

489495
- name: Upload test-results
@@ -518,10 +524,10 @@ jobs:
518524
with:
519525
turbo-enabled: true
520526
node-version: 22
521-
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
522-
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
523-
turbo-team: ${{ vars.TURBO_TEAM }}
524-
turbo-token: ${{ secrets.TURBO_TOKEN }}
527+
# turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
528+
# turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
529+
# turbo-team: ${{ vars.TURBO_TEAM }}
530+
# turbo-token: ${{ secrets.TURBO_TOKEN }}
525531

526532
- name: Publish with pkg-pr-new
527533
run: pnpm run build && pnpx pkg-pr-new@${{ vars.PKG_PR_NEW_VERSION || '0.0.49' }} publish --compact --pnpm './packages/*'

integration/presets/longRunningApps.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,7 @@ export const createLongRunningApps = () => {
4242
* Billing apps
4343
*/
4444
{ id: 'withBillingJwtV2.next.appRouter', config: next.appRouter, env: envs.withBillingJwtV2 },
45-
{ id: 'withBilling.next.appRouter', config: next.appRouter, env: envs.withBilling },
4645
{ id: 'withBillingJwtV2.vue.vite', config: vue.vite, env: envs.withBillingJwtV2 },
47-
{ id: 'withBilling.vue.vite', config: vue.vite, env: envs.withBilling },
48-
49-
/**
50-
* Machine auth apps
51-
*/
52-
{ id: 'withMachine.express.vite', config: express.vite, env: envs.withAPIKeys },
53-
{ id: 'withMachine.next.appRouter', config: next.appRouter, env: envs.withAPIKeys },
5446

5547
/**
5648
* Vite apps - basic flows
@@ -68,7 +60,6 @@ export const createLongRunningApps = () => {
6860
/**
6961
* Various apps - basic flows
7062
*/
71-
{ id: 'withBilling.astro.node', config: astro.node, env: envs.withBilling },
7263
{ id: 'astro.node.withCustomRoles', config: astro.node, env: envs.withCustomRoles },
7364
{ id: 'astro.static.withCustomRoles', config: astro.static, env: envs.withCustomRoles },
7465
{ id: 'expo.expo-web', config: expo.expoWeb, env: envs.withEmailCodes },

integration/presets/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import path from 'node:path';
33
export function linkPackage(pkg: string, tag?: string) {
44
// eslint-disable-next-line turbo/no-undeclared-env-vars
55
if (process.env.CI === 'true') {
6-
return tag || '*';
6+
// In CI, use '*' to get the latest version from Verdaccio
7+
// which will be the snapshot version we just published
8+
return '*';
79
}
810

911
return `link:${path.resolve(process.cwd(), `packages/${pkg}`)}`;

scripts/snapshot.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ try {
2525
// this will remove the prerelease versions
2626
// but will also clear the changeset .md files
2727
await $`pnpm changeset version`;
28-
// generate a temp .md file that indicates that all packages have changes
29-
// in order to force a snapshot release
30-
await $`touch .changeset/snap.md && echo ${snapshot} > .changeset/snap.md`;
3128
} catch {
32-
// otherwise, do nothing
29+
// not in pre-release mode, continue
3330
}
3431

32+
// Always generate a temp .md file that indicates that all packages have changes
33+
// in order to force a snapshot release of all packages
34+
await $`touch .changeset/snap.md && echo ${snapshot} > .changeset/snap.md`;
35+
3536
const res = await $`pnpm changeset version --snapshot ${prefix}`;
3637
const success = !res.stderr.includes('No unreleased changesets found');
3738

0 commit comments

Comments
 (0)