-
-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 1.91 KB
/
run-tests.yml
File metadata and controls
71 lines (61 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Test & Build
on:
push:
branches: [main, develop]
paths:
- '**.ts'
- '**.tsx'
- '**.js'
- '**.jsx'
- '.github/workflows/run-tests.yml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'tsup.config.ts'
pull_request:
branches: [main, develop]
workflow_run:
workflows: ['Code Quality']
types:
- completed
branches: [main, develop]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20, 22]
name: Node ${{ matrix.node-version }} - ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type-check, lint, test & build
run: npm run prepublishOnly
- name: Verify build outputs
run: |
node -e "const fs=require('fs'); console.log('dist/ contents:'); fs.readdirSync('dist').forEach(f => console.log(f)); ['dist/index.cjs','dist/index.mjs','dist/index.d.ts'].forEach(f => {if(!fs.existsSync(f)) throw new Error(f+' not found')}); console.log('All required files exist')"
- name: Verify package imports
run: |
node -e "
console.log('Testing ESM import...');
import('./dist/index.mjs').then(esm => {
console.log('ESM exports:', Object.keys(esm));
console.log('Package imports working correctly!');
}).catch(err => {
console.error('ESM import failed:', err);
process.exit(1);
});
"