diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 4123e4c..49d81d4 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -1,206 +1,25 @@ name: Pull Request Automated Checks +# Thin caller for the shared org workflow. Everything lives in +# Nano-Collective/.github — change it there and every repo picks it up. + on: pull_request: types: [opened, synchronize, reopened] branches: [main] -jobs: - test-lint: - name: Linting - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run linting - run: pnpm test:lint - - test-types: - name: Type Checks - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run TypeScript type checking - run: pnpm test:types - - test-knip: - name: Unused Dependencies - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run dependency check (knip) - run: pnpm test:knip - - test-unit: - name: Unit Tests - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' +permissions: + actions: read + contents: read + security-events: write - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run unit tests - run: pnpm test:ava - - verify-build: - name: Verify Build - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build project - run: pnpm build - - - name: Verify build artifacts - run: | - test -f dist/cli.js - echo "✓ CLI build verified" - - package-audit: - name: Package Audit - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '22' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run security audit - run: pnpm test:audit - - semgrep-scan: - name: Semgrep Security Scan - runs-on: ubuntu-latest - container: - image: semgrep/semgrep - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Run Semgrep - run: semgrep scan --config auto --error - - codeql-scan: - name: CodeQL Security Analysis - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - strategy: - fail-fast: false - matrix: - language: ['javascript'] - steps: - - name: Checkout repository - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Initialize CodeQL - uses: github/codeql-action/init@c4dd10e44af883a891fe31ced449bcb4a6728b9b # v3.37.6 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@c4dd10e44af883a891fe31ced449bcb4a6728b9b # v3.37.6 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c4dd10e44af883a891fe31ced449bcb4a6728b9b # v3.37.6 +jobs: + pr-checks: + uses: Nano-Collective/.github/.github/workflows/pr-checks.yml@main + with: + # TEMPORARY. The org standard is 80. nanotune is at 71.46%, so the floor + # is pinned just under current coverage and fail-on-drop (on by default) + # ratchets it — coverage cannot regress, and the gap closes deliberately. + # Delete this input once coverage clears 80. Tracked in #123. + # nanotune stays out of the org quality ruleset until then. + coverage-threshold: 71 diff --git a/package.json b/package.json index 7643c15..a6b5a26 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,13 @@ "build": "tsc", "dev": "tsx src/cli.tsx", "start": "node dist/cli.js", - "test:lint": "biome check .", + "test:lint": "biome lint .", + "test:format": "biome ci --formatter-enabled=true --linter-enabled=false --assist-enabled=false .", "test:types": "tsc --noEmit", "test:ava": "ava", "test:ava:coverage": "c8 ava", "test:knip": "knip", - "test:all": "pnpm test:lint && pnpm test:types && pnpm test:knip && pnpm test:security && pnpm test:audit && pnpm test:ava", + "test:all": "pnpm test:lint && pnpm test:format && pnpm test:types && pnpm test:knip && pnpm test:security && pnpm test:audit && pnpm test:ava", "test:security": "semgrep scan --config auto --error", "test:audit": "pnpm audit --audit-level=high", "format": "biome check --write ."