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