diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 00000000..62c4c4d8 --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,39 @@ +name: Validate + +on: + pull_request: + types: [opened, synchronize, reopened] + +# Concurrency configuration to cancel previous runs on new commits +concurrency: + group: validate-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + validate: + name: ${{ matrix.check }} + runs-on: ubuntu-latest + strategy: + matrix: + check: + - TypeScript Check + - Lint Check + - Format Check + include: + - check: TypeScript Check + command: typecheck + - check: Lint Check + command: lint + - check: Format Check + command: format:check + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: 'package-lock.json' + - name: Install dependencies + run: npm ci + - name: Run ${{ matrix.check }} + run: npm run ${{ matrix.command }} diff --git a/package.json b/package.json index d44ece53..b0ab248d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,10 @@ "clear": "npm run prebuild -- clean && docusaurus clear", "serve": "docusaurus serve", "typecheck": "tsc", - "format": "prettier --write ." + "format": "prettier .", + "format:check": "npm run format -- --check", + "format:write": "npm run format -- --write", + "lint": "echo 0;" }, "dependencies": { "@docusaurus/core": "^3.8.1", @@ -50,7 +53,7 @@ ] }, "engines": { - "node": ">=22.0" + "node": ">=22" }, "prettier": "@harperdb/code-guidelines/prettier" }