Skip to content

Commit 1551422

Browse files
authored
Merge pull request #85 from peacprotocol/hotfix/nightly-cross-runtime-imports
fix(ci): resolve cross-runtime module resolution
2 parents 745500f + 430b38e commit 1551422

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

.github/workflows/nightly.yml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ jobs:
129129
- name: Install dependencies
130130
run: pnpm install --frozen-lockfile
131131

132-
- name: Build packages
133-
run: pnpm -w build
132+
- name: Build @peac/core
133+
run: pnpm --filter @peac/core build
134134

135135
- name: Setup Deno
136136
if: matrix.runtime == 'deno'
@@ -148,30 +148,32 @@ jobs:
148148
run: |
149149
echo "Testing @peac/core crypto functions with ${{ matrix.runtime }}..."
150150
151+
export CORE_PATH="${{ github.workspace }}/packages/core/dist/index.js"
152+
151153
if [ "${{ matrix.runtime }}" == "node" ]; then
152-
node -e "
153-
import('@peac/core').then(async ({ signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat }) => {
154-
console.log('Testing with Node.js...');
155-
const { privateKey, publicKey, kid } = await generateEdDSAKeyPair();
156-
console.log('✅ Key generation works');
157-
158-
if (!validateKidFormat(kid)) throw new Error('Generated kid invalid format');
159-
console.log('✅ Kid validation works');
160-
161-
const payload = 'test payload';
162-
const jws = await signDetached(payload, privateKey, kid);
163-
console.log('✅ Signing works');
164-
165-
const verified = await verifyDetached(payload, jws, publicKey);
166-
if (!verified) throw new Error('Verification failed');
167-
console.log('✅ Verification works');
168-
console.log('✅ Node.js runtime validation complete');
169-
});
154+
node --input-type=module -e "
155+
const m = await import('file://${CORE_PATH}');
156+
const { signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat } = m;
157+
console.log('Testing with Node.js...');
158+
const { privateKey, publicKey, kid } = await generateEdDSAKeyPair();
159+
console.log('✅ Key generation works');
160+
161+
if (!validateKidFormat(kid)) throw new Error('Generated kid invalid format');
162+
console.log('✅ Kid validation works');
163+
164+
const payload = 'test payload';
165+
const jws = await signDetached(payload, privateKey, kid);
166+
console.log('✅ Signing works');
167+
168+
const verified = await verifyDetached(payload, jws, publicKey);
169+
if (!verified) throw new Error('Verification failed');
170+
console.log('✅ Verification works');
171+
console.log('✅ Node.js runtime validation complete');
170172
"
171173
elif [ "${{ matrix.runtime }}" == "deno" ]; then
172-
# Test with Deno's npm: specifier for built packages
173174
deno eval "
174-
import { signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat } from 'npm:@peac/core';
175+
const m = await import('file://${CORE_PATH}');
176+
const { signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat } = m;
175177
console.log('Testing with Deno...');
176178
const { privateKey, publicKey, kid } = await generateEdDSAKeyPair();
177179
console.log('✅ Key generation works');
@@ -187,10 +189,11 @@ jobs:
187189
if (!verified) throw new Error('Verification failed');
188190
console.log('✅ Verification works');
189191
console.log('✅ Deno runtime validation complete');
190-
" || echo "::warning::Deno test failed - may need npm registry setup"
192+
"
191193
elif [ "${{ matrix.runtime }}" == "bun" ]; then
192194
bun -e "
193-
import { signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat } from '@peac/core';
195+
const m = await import('file://${process.env.CORE_PATH}');
196+
const { signDetached, verifyDetached, generateEdDSAKeyPair, validateKidFormat } = m;
194197
console.log('Testing with Bun...');
195198
const { privateKey, publicKey, kid } = await generateEdDSAKeyPair();
196199
console.log('✅ Key generation works');
@@ -206,7 +209,7 @@ jobs:
206209
if (!verified) throw new Error('Verification failed');
207210
console.log('✅ Verification works');
208211
console.log('✅ Bun runtime validation complete');
209-
" || echo "::warning::Bun test failed - may need workspace resolution"
212+
"
210213
fi
211214
212215
nightly-summary:

0 commit comments

Comments
 (0)