updated X-Proxy README.md #31
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, develop] | |
pull_request: | |
branches: [main, develop] | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint Code | |
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' | |
- name: Install dependencies | |
run: npm install | |
- name: Run TypeScript checks | |
run: npm run type-check | |
- name: Run ESLint | |
run: npm run lint | |
continue-on-error: true | |
test: | |
name: Run Tests | |
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 }} | |
- name: Install dependencies | |
run: npm install | |
- name: Run unit tests | |
run: npm run test:unit | |
- name: Run integration tests | |
run: npm run test:integration | |
- name: Generate coverage report | |
run: npm run test:coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage/lcov.info | |
flags: unittests | |
name: codecov-${{ matrix.node-version }} | |
build: | |
name: Build Extension | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Build extension | |
run: npm run build | |
- name: Verify manifest | |
run: | | |
if [ ! -f "dist/manifest.json" ]; then | |
echo "manifest.json not found in dist/" | |
exit 1 | |
fi | |
- name: Check build size | |
run: | | |
SIZE=$(du -sb dist | cut -f1) | |
echo "Build size: $SIZE bytes" | |
if [ $SIZE -gt 10485760 ]; then | |
echo "Warning: Build size exceeds 10MB" | |
fi | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: extension-build | |
path: dist/ | |
retention-days: 30 | |
security: | |
name: Security Scan | |
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' | |
- name: Install dependencies | |
run: npm install | |
- name: Run security audit | |
run: npm audit --audit-level=moderate | |
- name: Run Snyk security scan | |
uses: snyk/actions/node@master | |
continue-on-error: true | |
with: | |
args: --severity-threshold=high | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
compatibility: | |
name: Browser Compatibility | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
browser: [chrome, edge] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: extension-build | |
path: dist/ | |
- name: Validate manifest for ${{ matrix.browser }} | |
run: | | |
echo "Validating manifest.json for ${{ matrix.browser }} compatibility" | |
node -e " | |
const manifest = require('./dist/manifest.json'); | |
if (manifest.manifest_version !== 3) { | |
console.error('Manifest version must be 3'); | |
process.exit(1); | |
} | |
console.log('Manifest validation passed'); | |
" | |
performance: | |
name: Performance Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: extension-build | |
path: dist/ | |
- name: Check bundle size | |
run: | | |
echo "Checking JavaScript bundle sizes..." | |
for file in dist/*.js; do | |
if [ -f "$file" ]; then | |
SIZE=$(stat -c%s "$file") | |
echo "$(basename $file): $SIZE bytes" | |
fi | |
done | |
- name: Lighthouse CI | |
uses: treosh/lighthouse-ci-action@v10 | |
continue-on-error: true | |
with: | |
configPath: './lighthouserc.json' | |
uploadArtifacts: true | |
release-dry-run: | |
name: Release Dry Run | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: [build, security, compatibility] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: extension-build | |
path: dist/ | |
- name: Create release package | |
run: | | |
zip -r x-proxy-extension.zip dist/ | |
echo "Release package created: x-proxy-extension.zip" | |
ls -lh x-proxy-extension.zip | |
- name: Generate release notes | |
run: | | |
echo "## Release Notes" > RELEASE_NOTES.md | |
echo "" >> RELEASE_NOTES.md | |
echo "### What's New" >> RELEASE_NOTES.md | |
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0)..HEAD >> RELEASE_NOTES.md | |
cat RELEASE_NOTES.md |