Skip to content

Add fast sampling mode #90

Add fast sampling mode

Add fast sampling mode #90

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
pull-requests: write
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check formatting
run: npm run format:check
test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
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
- name: Run tests with coverage
run: npm run test:coverage
- name: Upload coverage to artifacts
if: github.ref == 'refs/heads/main' && matrix.node-version == 20
uses: actions/upload-artifact@v4
with:
name: coverage-summary
path: coverage/coverage-summary.json
- name: Download coverage from main
if: github.event_name == 'pull_request'
uses: dawidd6/action-download-artifact@v3
with:
workflow: ci.yml
name: coverage-summary
path: coverage-base-summary
branch: main
if_no_artifact_found: warn
- name: Check if base coverage exists
id: base_coverage
if: github.event_name == 'pull_request'
run: |
if [ -f "coverage-base-summary/coverage-summary.json" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Report Coverage
if: success() && github.event_name == 'pull_request' && matrix.node-version == 20
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-compare-path: ${{ steps.base_coverage.outputs.exists == 'true' && 'coverage-base-summary/coverage-summary.json' || '' }}
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build production
run: npm run build
- name: Verify build artifacts
run: |
if [ ! -d "dist" ]; then
echo "Error: dist directory not found"
exit 1
fi
echo "Build successful, artifacts found in dist/"