diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 93dfcbb..bd1522f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -20,7 +20,7 @@ The extension has no activation code. Changes to a snippet catalog take effect t ## Commands -There are no npm scripts, automated tests, or lint configuration. There is consequently no single-test command. +There are no npm scripts, automated tests, or lint configuration. The PR workflow mirrors these local validation commands: ```bash # Install the locked packaging dependency @@ -33,7 +33,11 @@ node -e "for (const f of ['snippets/snippets.json','snippets/jinja-snippets.json npx vsce package ``` -`npx vsce package` creates a `.vsix` file in the repository root; it is ignored by Git. The release workflow runs this same packaging command with Node.js 20. +`npx vsce package` creates a `.vsix` file in the repository root; it is ignored by Git. The PR workflow runs the same commands on Node.js 20, and the release workflow uses `npx vsce package` for tag publishes. + +## Pull request checks + +PRs should keep the snippet catalogs parseable and the package manifest valid. The CI workflow runs `npm ci`, JSON parsing for all three snippet catalogs, and `npx vsce package` on every pull request. ## Releases diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..90f8b20 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: PR CI + +on: + pull_request: + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Validate snippet catalogs + run: node -e "for (const f of ['snippets/snippets.json','snippets/jinja-snippets.json','snippets/django-snippets.json']) JSON.parse(require('fs').readFileSync(f, 'utf8'))" + + - name: Package extension + run: npx vsce package diff --git a/README.md b/README.md index 4b128e2..fa6c98d 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,16 @@ Found a bug? Want a new snippet? Contributions are welcome! 2. **Request Features**: Have an idea? Share it! 3. **Submit PRs**: Fork, code, and submit a pull request +### Continuous Integration + +Every pull request runs a small validation suite on Node.js 20: + +1. `npm ci` +2. Parse all snippet catalogs as JSON +3. `npx vsce package` + +If you want to mirror CI locally before opening a PR, run the same commands from the repository root. + ### Suggesting New Snippets When requesting a new snippet, please include: