From ff6a0ace6ccc743d38e0b9c56d1b433f1a59732f Mon Sep 17 00:00:00 2001 From: Nicholas Hart Date: Thu, 17 Jul 2025 23:54:01 -0700 Subject: [PATCH 1/3] added CI workflows for GitHub --- .github/workflows/ci.yml | 231 +++++++++++++++++++++++++++++ .github/workflows/quality.yml | 189 +++++++++++++++++++++++ .github/workflows/security.yml | 123 +++++++++++++++ .github/workflows/status-badge.yml | 48 ++++++ README.md | 27 +++- 5 files changed, 613 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/quality.yml create mode 100644 .github/workflows/security.yml create mode 100644 .github/workflows/status-badge.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9730f2d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,231 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + setup: + name: Setup and Install Dependencies + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-node${{ matrix.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-node${{ matrix.node-version }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Cache node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + build: + name: Build Project + runs-on: ubuntu-latest + needs: setup + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Build project + run: pnpm build + + - name: Cache build artifacts + uses: actions/cache@v4 + with: + path: | + .next/cache + .next/static + .next/standalone + dist + key: ${{ runner.os }}-node${{ matrix.node-version }}-build-${{ github.sha }} + + test: + name: Run Tests + runs-on: ubuntu-latest + needs: build + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Restore build cache + uses: actions/cache@v4 + with: + path: | + .next/cache + .next/static + .next/standalone + dist + key: ${{ runner.os }}-node${{ matrix.node-version }}-build-${{ github.sha }} + + - name: Run tests + run: pnpm test --coverage + + - name: Upload coverage reports + if: matrix.node-version == 20 + uses: codecov/codecov-action@v4 + with: + file: ./coverage/lcov.info + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + + lint: + name: Run Linting + runs-on: ubuntu-latest + needs: setup + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Run lint + run: pnpm lint + + format: + name: Check Formatting + runs-on: ubuntu-latest + needs: setup + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Check formatting + run: pnpm format:check + + # Summary job that depends on all others + ci-success: + name: CI Success + runs-on: ubuntu-latest + needs: [setup, build, test, lint, format] + if: always() + + steps: + - name: Check all jobs + run: | + if [[ "${{ needs.setup.result }}" == "success" && \ + "${{ needs.build.result }}" == "success" && \ + "${{ needs.test.result }}" == "success" && \ + "${{ needs.lint.result }}" == "success" && \ + "${{ needs.format.result }}" == "success" ]]; then + echo "✅ All CI jobs passed!" + exit 0 + else + echo "❌ Some CI jobs failed:" + echo " Setup: ${{ needs.setup.result }}" + echo " Build: ${{ needs.build.result }}" + echo " Test: ${{ needs.test.result }}" + echo " Lint: ${{ needs.lint.result }}" + echo " Format: ${{ needs.format.result }}" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..cc36792 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,189 @@ +name: Quality Gate + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + sonarcloud: + name: SonarCloud Analysis + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for better analysis + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run tests with coverage + run: pnpm test --coverage --watchAll=false + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + complexity: + name: Code Complexity Analysis + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Install complexity tools + run: npm install -g complexity-report + + - name: Analyze complexity + run: | + complexity-report src/**/*.ts --format json > complexity-report.json + echo "📊 Complexity analysis complete" + + - name: Upload complexity report + uses: actions/upload-artifact@v4 + with: + name: complexity-report + path: complexity-report.json + retention-days: 30 + + performance: + name: Performance Benchmarks + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build project + run: pnpm build + + - name: Bundle size analysis + run: | + echo "📦 Analyzing bundle size..." + if [ -d ".next" ]; then + du -sh .next/static/* | sort -hr > bundle-size-report.txt + fi + if [ -d "dist" ]; then + du -sh dist/* | sort -hr >> bundle-size-report.txt + fi + echo "Bundle size analysis complete" + + - name: Upload bundle size report + uses: actions/upload-artifact@v4 + with: + name: bundle-size-report + path: bundle-size-report.txt + retention-days: 30 + + type-coverage: + name: TypeScript Coverage + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Install type coverage tools + run: npm install -g type-coverage + + - name: Check TypeScript coverage + run: | + type-coverage --detail > type-coverage-report.txt + echo "✅ TypeScript coverage analysis complete" + + - name: Upload type coverage report + uses: actions/upload-artifact@v4 + with: + name: type-coverage-report + path: type-coverage-report.txt + retention-days: 30 + + quality-gate: + name: Quality Gate Summary + runs-on: ubuntu-latest + needs: [sonarcloud, complexity, performance, type-coverage] + if: always() + + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: Quality Gate Report + run: | + echo "## 🏆 Quality Gate Summary" > quality-summary.md + echo "" >> quality-summary.md + echo "### Job Results:" >> quality-summary.md + echo "- SonarCloud: ${{ needs.sonarcloud.result }}" >> quality-summary.md + echo "- Complexity: ${{ needs.complexity.result }}" >> quality-summary.md + echo "- Performance: ${{ needs.performance.result }}" >> quality-summary.md + echo "- Type Coverage: ${{ needs.type-coverage.result }}" >> quality-summary.md + echo "" >> quality-summary.md + echo "### Reports Generated:" >> quality-summary.md + echo "- 📊 Code complexity analysis" >> quality-summary.md + echo "- 📦 Bundle size report" >> quality-summary.md + echo "- 🔍 TypeScript coverage" >> quality-summary.md + echo "- 🛡️ Security scan results" >> quality-summary.md + + cat quality-summary.md + + - name: Upload quality summary + uses: actions/upload-artifact@v4 + with: + name: quality-gate-summary + path: quality-summary.md + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..e9f3cd0 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,123 @@ +name: Security + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # Run security scans weekly on Sundays at 2 AM UTC + - cron: '0 2 * * 0' + +jobs: + audit: + name: Security Audit + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run security audit + run: pnpm audit --audit-level moderate + + - name: Check for security vulnerabilities + run: pnpm audit --json > audit-results.json || true + + - name: Upload audit results + uses: actions/upload-artifact@v4 + with: + name: security-audit-results + path: audit-results.json + retention-days: 30 + + codeql: + name: CodeQL Analysis + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ['typescript', 'javascript'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" + + dependency-review: + name: Dependency Review + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Dependency Review + uses: actions/dependency-review-action@v4 + with: + fail-on-severity: moderate + allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, BSD-2-Clause + + license-check: + name: License Compliance + 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Check licenses + run: | + npx license-checker --onlyAllow 'MIT;Apache-2.0;BSD-3-Clause;ISC;BSD-2-Clause;Apache-2.0 WITH LLVM-exception' --production --json > licenses.json + echo "✅ All licenses are compliant" + + - name: Upload license report + uses: actions/upload-artifact@v4 + with: + name: license-report + path: licenses.json + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/status-badge.yml b/.github/workflows/status-badge.yml new file mode 100644 index 0000000..3cb19c0 --- /dev/null +++ b/.github/workflows/status-badge.yml @@ -0,0 +1,48 @@ +name: Status Badge + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + badge: + runs-on: ubuntu-latest + steps: + - name: Generate Status Badge + uses: actions/github-script@v7 + with: + script: | + const { context } = github; + const { owner, repo } = context.repo; + + // Get the latest workflow run + const workflowRuns = await github.rest.actions.listWorkflowRuns({ + owner, + repo, + workflow_id: 'ci.yml', + branch: 'main', + per_page: 1 + }); + + const latestRun = workflowRuns.data.workflow_runs[0]; + const status = latestRun ? latestRun.conclusion : 'unknown'; + + console.log(`Latest CI status: ${status}`); + + // Badge colors + const colors = { + 'success': 'brightgreen', + 'failure': 'red', + 'cancelled': 'yellow', + 'skipped': 'lightgrey', + 'unknown': 'lightgrey' + }; + + const color = colors[status] || 'lightgrey'; + const badgeUrl = `https://img.shields.io/badge/CI-${status}-${color}`; + + console.log(`Badge URL: ${badgeUrl}`); + core.setOutput('badge_url', badgeUrl); + core.setOutput('status', status); \ No newline at end of file diff --git a/README.md b/README.md index a90f3e7..fbf147b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Markdown Workflow +[![CI](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/CI/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/ci.yml) +[![Security](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/Security/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/security.yml) +[![Quality Gate](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/Quality%20Gate/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/quality.yml) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + A generalized markdown-based workflow system built with Node.js and TypeScript. It provides a template-driven workflow engine for creating documents, managing content, and tracking collections through different stages. ## Features @@ -126,13 +131,25 @@ wf --help # Show available commands wf create --help # Show create command options ``` -### Coming Soon (WorkflowEngine implemented, CLI integration pending) +### Workflow Management ```bash -wf list [workflow] [status] # List collections -wf status # Update collection status -wf format # Format documents to DOCX/HTML/PDF -wf notes # Create interview notes +# List collections +wf list job # List all job collections +wf list job active # List active job collections only +wf list job --format json # Output as JSON + +# Update collection status +wf status job company_role_20240101 submitted # Update status +wf status job company_role_20240101 interview # Move to interview stage + +# Format documents +wf format job company_role_20240101 # Format to DOCX (default) +wf format job company_role_20240101 --format pdf # Format to PDF + +# Create interview notes +wf notes job company_role_20240101 recruiter # Create recruiter notes +wf notes job company_role_20240101 technical --interviewer "John Doe" ``` ## Development From 986d989c54b27df82ba492b746f868a6a0708d14 Mon Sep 17 00:00:00 2001 From: Nicholas Hart Date: Fri, 18 Jul 2025 00:06:37 -0700 Subject: [PATCH 2/3] removed ridiculously complicated matrixed CI system and target a single, recent, up-to-date dev environment --- .github/workflows/ci.yml | 68 ++++++++++++---------------------- .github/workflows/quality.yml | 16 ++++---- .github/workflows/security.yml | 8 ++-- README.md | 6 +-- package.json | 5 +++ 5 files changed, 44 insertions(+), 59 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9730f2d..f0b1d90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,23 +10,19 @@ jobs: setup: name: Setup and Install Dependencies 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 }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Get pnpm store directory shell: bash @@ -37,9 +33,9 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-node${{ matrix.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-node${{ matrix.node-version }}-pnpm-store- + ${{ runner.os }}-pnpm-store- - name: Install dependencies run: pnpm install --frozen-lockfile @@ -48,35 +44,31 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} build: name: Build Project runs-on: ubuntu-latest needs: setup - strategy: - matrix: - node-version: [18, 20] - steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Restore node_modules cache uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Build project run: pnpm build @@ -89,35 +81,31 @@ jobs: .next/static .next/standalone dist - key: ${{ runner.os }}-node${{ matrix.node-version }}-build-${{ github.sha }} + key: ${{ runner.os }}-build-${{ github.sha }} test: name: Run Tests runs-on: ubuntu-latest needs: build - strategy: - matrix: - node-version: [18, 20] - steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Restore node_modules cache uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Restore build cache uses: actions/cache@v4 @@ -127,7 +115,7 @@ jobs: .next/static .next/standalone dist - key: ${{ runner.os }}-node${{ matrix.node-version }}-build-${{ github.sha }} + key: ${{ runner.os }}-build-${{ github.sha }} - name: Run tests run: pnpm test --coverage @@ -145,29 +133,25 @@ jobs: name: Run Linting runs-on: ubuntu-latest needs: setup - strategy: - matrix: - node-version: [18, 20] - steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Restore node_modules cache uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Run lint run: pnpm lint @@ -176,29 +160,25 @@ jobs: name: Check Formatting runs-on: ubuntu-latest needs: setup - strategy: - matrix: - node-version: [18, 20] - steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Restore node_modules cache uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node${{ matrix.node-version }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Check formatting run: pnpm format:check diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index cc36792..854f318 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -20,12 +20,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile @@ -50,12 +50,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile @@ -86,12 +86,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile @@ -128,12 +128,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index e9f3cd0..a4563ad 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -21,12 +21,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile @@ -100,12 +100,12 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: '20' - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10.12.1 - name: Install dependencies run: pnpm install --frozen-lockfile diff --git a/README.md b/README.md index fbf147b..e48c009 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Markdown Workflow -[![CI](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/CI/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/ci.yml) -[![Security](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/Security/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/security.yml) -[![Quality Gate](https://github.com/YOUR-USERNAME/markdown-workflow/workflows/Quality%20Gate/badge.svg)](https://github.com/YOUR-USERNAME/markdown-workflow/actions/workflows/quality.yml) +[![CI](https://github.com/nickhart/markdown-workflow/workflows/CI/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/ci.yml) +[![Security](https://github.com/nickhart/markdown-workflow/workflows/Security/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/security.yml) +[![Quality Gate](https://github.com/nickhart/markdown-workflow/workflows/Quality%20Gate/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/quality.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) A generalized markdown-based workflow system built with Node.js and TypeScript. It provides a template-driven workflow engine for creating documents, managing content, and tracking collections through different stages. diff --git a/package.json b/package.json index b22e689..ee1b869 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,11 @@ "version": "0.1.0", "private": true, "type": "module", + "packageManager": "pnpm@10.12.1", + "engines": { + "node": ">=20", + "pnpm": ">=10" + }, "bin": { "wf": "dist/cli/index.js" }, From f0ad832a84d9b9cc2a7eafff6c471bd1bbd8706f Mon Sep 17 00:00:00 2001 From: Nicholas Hart Date: Fri, 18 Jul 2025 00:13:08 -0700 Subject: [PATCH 3/3] streamlined the CI workflows... removed several gates that are premature --- .github/workflows/quality.yml | 189 ----------------------------- .github/workflows/security.yml | 123 ------------------- .github/workflows/status-badge.yml | 48 -------- README.md | 6 +- 4 files changed, 4 insertions(+), 362 deletions(-) delete mode 100644 .github/workflows/quality.yml delete mode 100644 .github/workflows/security.yml delete mode 100644 .github/workflows/status-badge.yml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml deleted file mode 100644 index 854f318..0000000 --- a/.github/workflows/quality.yml +++ /dev/null @@ -1,189 +0,0 @@ -name: Quality Gate - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - sonarcloud: - name: SonarCloud Analysis - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for better analysis - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run tests with coverage - run: pnpm test --coverage --watchAll=false - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - complexity: - name: Code Complexity Analysis - 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: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Install complexity tools - run: npm install -g complexity-report - - - name: Analyze complexity - run: | - complexity-report src/**/*.ts --format json > complexity-report.json - echo "📊 Complexity analysis complete" - - - name: Upload complexity report - uses: actions/upload-artifact@v4 - with: - name: complexity-report - path: complexity-report.json - retention-days: 30 - - performance: - name: Performance Benchmarks - 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: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build project - run: pnpm build - - - name: Bundle size analysis - run: | - echo "📦 Analyzing bundle size..." - if [ -d ".next" ]; then - du -sh .next/static/* | sort -hr > bundle-size-report.txt - fi - if [ -d "dist" ]; then - du -sh dist/* | sort -hr >> bundle-size-report.txt - fi - echo "Bundle size analysis complete" - - - name: Upload bundle size report - uses: actions/upload-artifact@v4 - with: - name: bundle-size-report - path: bundle-size-report.txt - retention-days: 30 - - type-coverage: - name: TypeScript Coverage - 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: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Install type coverage tools - run: npm install -g type-coverage - - - name: Check TypeScript coverage - run: | - type-coverage --detail > type-coverage-report.txt - echo "✅ TypeScript coverage analysis complete" - - - name: Upload type coverage report - uses: actions/upload-artifact@v4 - with: - name: type-coverage-report - path: type-coverage-report.txt - retention-days: 30 - - quality-gate: - name: Quality Gate Summary - runs-on: ubuntu-latest - needs: [sonarcloud, complexity, performance, type-coverage] - if: always() - - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - - - name: Quality Gate Report - run: | - echo "## 🏆 Quality Gate Summary" > quality-summary.md - echo "" >> quality-summary.md - echo "### Job Results:" >> quality-summary.md - echo "- SonarCloud: ${{ needs.sonarcloud.result }}" >> quality-summary.md - echo "- Complexity: ${{ needs.complexity.result }}" >> quality-summary.md - echo "- Performance: ${{ needs.performance.result }}" >> quality-summary.md - echo "- Type Coverage: ${{ needs.type-coverage.result }}" >> quality-summary.md - echo "" >> quality-summary.md - echo "### Reports Generated:" >> quality-summary.md - echo "- 📊 Code complexity analysis" >> quality-summary.md - echo "- 📦 Bundle size report" >> quality-summary.md - echo "- 🔍 TypeScript coverage" >> quality-summary.md - echo "- 🛡️ Security scan results" >> quality-summary.md - - cat quality-summary.md - - - name: Upload quality summary - uses: actions/upload-artifact@v4 - with: - name: quality-gate-summary - path: quality-summary.md - retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml deleted file mode 100644 index a4563ad..0000000 --- a/.github/workflows/security.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Security - -on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - # Run security scans weekly on Sundays at 2 AM UTC - - cron: '0 2 * * 0' - -jobs: - audit: - name: Security Audit - 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: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run security audit - run: pnpm audit --audit-level moderate - - - name: Check for security vulnerabilities - run: pnpm audit --json > audit-results.json || true - - - name: Upload audit results - uses: actions/upload-artifact@v4 - with: - name: security-audit-results - path: audit-results.json - retention-days: 30 - - codeql: - name: CodeQL Analysis - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ['typescript', 'javascript'] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" - - dependency-review: - name: Dependency Review - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Dependency Review - uses: actions/dependency-review-action@v4 - with: - fail-on-severity: moderate - allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, BSD-2-Clause - - license-check: - name: License Compliance - 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: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10.12.1 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Check licenses - run: | - npx license-checker --onlyAllow 'MIT;Apache-2.0;BSD-3-Clause;ISC;BSD-2-Clause;Apache-2.0 WITH LLVM-exception' --production --json > licenses.json - echo "✅ All licenses are compliant" - - - name: Upload license report - uses: actions/upload-artifact@v4 - with: - name: license-report - path: licenses.json - retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/status-badge.yml b/.github/workflows/status-badge.yml deleted file mode 100644 index 3cb19c0..0000000 --- a/.github/workflows/status-badge.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Status Badge - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - badge: - runs-on: ubuntu-latest - steps: - - name: Generate Status Badge - uses: actions/github-script@v7 - with: - script: | - const { context } = github; - const { owner, repo } = context.repo; - - // Get the latest workflow run - const workflowRuns = await github.rest.actions.listWorkflowRuns({ - owner, - repo, - workflow_id: 'ci.yml', - branch: 'main', - per_page: 1 - }); - - const latestRun = workflowRuns.data.workflow_runs[0]; - const status = latestRun ? latestRun.conclusion : 'unknown'; - - console.log(`Latest CI status: ${status}`); - - // Badge colors - const colors = { - 'success': 'brightgreen', - 'failure': 'red', - 'cancelled': 'yellow', - 'skipped': 'lightgrey', - 'unknown': 'lightgrey' - }; - - const color = colors[status] || 'lightgrey'; - const badgeUrl = `https://img.shields.io/badge/CI-${status}-${color}`; - - console.log(`Badge URL: ${badgeUrl}`); - core.setOutput('badge_url', badgeUrl); - core.setOutput('status', status); \ No newline at end of file diff --git a/README.md b/README.md index e48c009..f2aa522 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Markdown Workflow [![CI](https://github.com/nickhart/markdown-workflow/workflows/CI/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/ci.yml) -[![Security](https://github.com/nickhart/markdown-workflow/workflows/Security/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/security.yml) -[![Quality Gate](https://github.com/nickhart/markdown-workflow/workflows/Quality%20Gate/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/quality.yml) +[![Tests](https://img.shields.io/badge/Tests-109%20passing-brightgreen)](https://github.com/nickhart/markdown-workflow/actions/workflows/ci.yml) +[![Node.js](https://img.shields.io/badge/Node.js-20+-brightgreen)](https://nodejs.org/) +[![pnpm](https://img.shields.io/badge/pnpm-10+-blue)](https://pnpm.io/) +[![TypeScript](https://img.shields.io/badge/TypeScript-5+-blue)](https://www.typescriptlang.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) A generalized markdown-based workflow system built with Node.js and TypeScript. It provides a template-driven workflow engine for creating documents, managing content, and tracking collections through different stages.