diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f0b1d90 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,211 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + setup: + name: Setup and Install Dependencies + 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: 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 }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-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 }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + build: + name: Build Project + runs-on: ubuntu-latest + needs: setup + 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: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-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 }}-build-${{ github.sha }} + + test: + name: Run 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: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.12.1 + + - name: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-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 }}-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 + 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: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-deps-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Run lint + run: pnpm lint + + format: + name: Check Formatting + runs-on: ubuntu-latest + needs: setup + 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: Restore node_modules cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-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/README.md b/README.md index a90f3e7..f2aa522 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # Markdown Workflow +[![CI](https://github.com/nickhart/markdown-workflow/workflows/CI/badge.svg)](https://github.com/nickhart/markdown-workflow/actions/workflows/ci.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. ## Features @@ -126,13 +133,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 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" },