Skip to content

perbaikan pada demo view #4

perbaikan pada demo view

perbaikan pada demo view #4

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
release:
types: [ created ]
jobs:
# Job 1: Linting & Code Quality
lint:
runs-on: ubuntu-latest
name: Lint Code
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check code formatting
run: npm run format -- --check
# Job 2: Testing
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
name: Test on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
# Job 3: Build & Bundle
build:
runs-on: ubuntu-latest
needs: [lint, test]
name: Build Package
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build package
run: |
# Create dist directory
mkdir -p dist
# Copy necessary files
cp -r src dist/
cp package.json dist/
cp README.md dist/
cp LICENSE dist/
# Create npm package
cd dist
npm pack
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: package-build
path: dist/*.tgz
# Job 4: Security Audit
security:
runs-on: ubuntu-latest
name: Security Audit
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run npm audit
run: npm audit --production
- name: Run Snyk security test
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
continue-on-error: true
# Job 5: Publish to NPM (only on release)
publish:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [lint, test, build, security]
name: Publish to NPM
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release Assets
run: |
npm pack
mv *.tgz id-auto-formalizer-${{ github.event.release.tag_name }}.tgz
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./id-auto-formalizer-${{ github.event.release.tag_name }}.tgz
asset_name: id-auto-formalizer-${{ github.event.release.tag_name }}.tgz
asset_content_type: application/gzip
# Job 6: Documentation
docs:
runs-on: ubuntu-latest
needs: [test]
name: Generate Documentation
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: |
npm ci
npm install -g jsdoc
- name: Generate API documentation
run: |
jsdoc -c jsdoc.json -d docs/api
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs