Skip to content

Rename todo-basic.js to todo-basic.js #5

Rename todo-basic.js to todo-basic.js

Rename todo-basic.js to todo-basic.js #5

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
# Setup Node.js FIRST (without cache)
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# No cache here initially
# Generate lock file with scripts disabled
- name: Prepare for caching
run: |
# Temporarily disable the prepare script to avoid husky error
if [ -f "package.json" ]; then
npm pkg delete scripts.prepare || true
fi
# Generate package-lock.json if missing
if [ ! -f "package-lock.json" ] && [ ! -f "npm-shrinkwrap.json" ]; then
echo "Generating package-lock.json..."
npm install --package-lock-only --no-audit --ignore-scripts
fi
# Restore original package.json
git checkout -- package.json 2>/dev/null || true
# Now setup Node.js WITH cache (lock file exists)
- name: Setup Node.js with cache
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'package-lock.json'
# Install dependencies with proper handling
- name: Install dependencies
run: |
# Check if we have a lock file
if [ -f "package-lock.json" ] || [ -f "npm-shrinkwrap.json" ]; then
echo "Using npm ci with existing lock file"
npm ci --ignore-scripts
else
echo "Using npm install (no lock file)"
npm install --ignore-scripts
fi
# Manually run husky install if needed
if [ -f "node_modules/.bin/husky" ]; then
npx husky install || echo "Husky install failed, continuing..."
fi
- name: Lint
run: npm run lint
- name: Type check
run: npx tsc --noEmit
- name: Test
run: npm run test
- name: Build
run: npm run build
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
fail_ci_if_error: true
- name: Security audit
run: npm audit --audit-level=moderate || echo "Security audit skipped or failed"
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build
run: npm run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs