fix: replace __dirname with import.meta.url for ES module compatibility #95
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| steps: | |
| - name: Checkout code | |
| 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 | |
| npm install -D lightningcss-linux-x64-gnu @tailwindcss/oxide-linux-x64-gnu | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Run type checking | |
| run: npm run typecheck | |
| - name: Build project | |
| run: npm run build | |
| - name: Run tests with coverage | |
| run: npm run test:coverage | |
| - name: Upload coverage to Codecov | |
| if: matrix.node-version == '20.x' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage/lcov.info | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| # Separate job for checking coverage thresholds | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| # Ensure platform-specific binaries are installed for Linux | |
| npm install -D lightningcss-linux-x64-gnu @tailwindcss/oxide-linux-x64-gnu | |
| - name: Build project | |
| run: npm run build | |
| - name: Check coverage thresholds | |
| run: npm run test:coverage -- --coverage --coverageThreshold='{"global":{"lines":75,"functions":80,"branches":60,"statements":75}}' |