Skip to content

Sort tags alphabetically instead of by frequency #141

Sort tags alphabetically instead of by frequency

Sort tags alphabetically instead of by frequency #141

Workflow file for this run

name: Test Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CI: true
NODE_ENV: test
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test -- --run
- name: Run tests with coverage
run: npm run test -- --run --coverage
- name: Check coverage thresholds
run: |
echo "Checking coverage thresholds..."
npm run test -- --run --coverage --reporter=json > coverage-report.json 2>/dev/null || true
node -e "
try {
const fs = require('fs');
const coverage = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
const total = coverage.total;
console.log('Coverage Summary:');
console.log('Lines:', total.lines.pct + '%');
console.log('Functions:', total.functions.pct + '%');
console.log('Branches:', total.branches.pct + '%');
console.log('Statements:', total.statements.pct + '%');
// Thresholds matching vitest.config.js
const thresholds = { lines: 45, functions: 60, branches: 75, statements: 45 };
let failed = false;
if (total.lines.pct < thresholds.lines) {
console.log('❌ Lines coverage (' + total.lines.pct + '%) below threshold (' + thresholds.lines + '%)');
failed = true;
}
if (total.functions.pct < thresholds.functions) {
console.log('❌ Functions coverage (' + total.functions.pct + '%) below threshold (' + thresholds.functions + '%)');
failed = true;
}
if (total.branches.pct < thresholds.branches) {
console.log('❌ Branches coverage (' + total.branches.pct + '%) below threshold (' + thresholds.branches + '%)');
failed = true;
}
if (total.statements.pct < thresholds.statements) {
console.log('❌ Statements coverage (' + total.statements.pct + '%) below threshold (' + thresholds.statements + '%)');
failed = true;
}
if (failed) {
process.exit(1);
} else {
console.log('✅ Coverage meets threshold requirements');
}
} catch (err) {
console.log('Coverage check skipped - no coverage data available');
}
"
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30
- name: Comment coverage on PR
uses: romeovs/lcov-reporter-action@v0.3.1
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./coverage/lcov.info
delete-old-comments: true
continue-on-error: true
- name: Coverage summary
run: |
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat coverage/coverage-summary.json 2>/dev/null | jq '.' || echo "Coverage summary not available"
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
lint:
name: Code Quality
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
continue-on-error: true
- name: Check formatting
run: npm run format:check
continue-on-error: true
build:
name: Build Check
runs-on: ubuntu-latest
timeout-minutes: 5
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist/
retention-days: 7