Skip to content

Merge dev into main

Merge dev into main #2

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run type checking
run: npm run typecheck
- name: Run tests
run: npm run test:coverage
- name: Build package
run: npm run build
- name: Test package installation (CommonJS)
run: |
# Test installation in a temporary directory
cd $(mktemp -d)
npm init -y
# Set up CommonJS environment
echo '{"type": "commonjs"}' > package.json
npm install $GITHUB_WORKSPACE
# Get the repository name dynamically
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
echo "📦 Testing CommonJS import for package: $REPO_NAME"
node -e "
const repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
try {
const pkg = require(repoName);
console.log('✅ CommonJS import successful');
console.log('Package exports:', Object.keys(pkg));
} catch (error) {
console.log('❌ CommonJS import failed:', error.message);
process.exit(1);
}
"
- name: Test package installation (ES Module)
run: |
# Test ES module import in a temporary directory
cd $(mktemp -d)
npm init -y
echo '{"type": "module"}' > package.json
npm install $GITHUB_WORKSPACE
# Get the repository name dynamically
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
echo "📦 Testing ES Module import for package: $REPO_NAME"
node -e "
const repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
import(repoName).then(pkg => {
console.log('✅ ES Module import successful');
console.log('Package exports:', Object.keys(pkg));
}).catch(error => {
console.log('❌ ES Module import failed:', error.message);
process.exit(1);
});
"
- name: Upload coverage to Codecov
if: matrix.node-version == 18
uses: codecov/codecov-action@v5
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false