mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-01-30 11:45:27 +00:00
feat: implement complete tree-sitter-shellspec grammar with comprehensive testing
- Add full ShellSpec grammar extending tree-sitter-bash - Support all ShellSpec constructs: Describe, Context, It, hooks, utilities - Include Data block parsing with statements and argument styles - Add 61 comprehensive test cases covering real-world patterns - Implement optimized GitHub workflows with CI/CD automation - Configure complete development tooling (linting, formatting, pre-commit) - Add comprehensive documentation and contribution guidelines - Optimize grammar conflicts to zero warnings - Support editor integration for Neovim, VS Code, Emacs Breaking Changes: - Initial release, no previous API to break BREAKING CHANGE: Initial implementation of tree-sitter-shellspec grammar # Conflicts: # .github/workflows/codeql.yml # .github/workflows/pr-lint.yml # .pre-commit-config.yaml # Conflicts: # .github/workflows/pr-lint.yml # Conflicts: # .github/workflows/pr-lint.yml
This commit is contained in:
13
.github/workflows/codeql.yml
vendored
13
.github/workflows/codeql.yml
vendored
@@ -1,15 +1,14 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: 'CodeQL'
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
branches: ["main"]
|
||||
schedule:
|
||||
- cron: '30 1 * * 0' # Run at 1:30 AM UTC every Sunday
|
||||
merge_group:
|
||||
- cron: "30 1 * * 0" # Run at 1:30 AM UTC every Sunday
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -25,7 +24,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['actions'] # Add languages used in your actions
|
||||
language: ['actions,javascript'] # Add languages used in your actions
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -43,4 +42,4 @@ jobs:
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
|
||||
with:
|
||||
category: '/language:${{matrix.language}}'
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
30
.github/workflows/pr-lint.yml
vendored
30
.github/workflows/pr-lint.yml
vendored
@@ -1,30 +0,0 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: Lint Code Base
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, main]
|
||||
pull_request:
|
||||
branches: [master, main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
Linter:
|
||||
name: PR Lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
statuses: write
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
steps:
|
||||
- name: Run PR Lint
|
||||
# https://github.com/ivuorinen/actions
|
||||
uses: ivuorinen/actions/pr-lint@fb25736f7e7a438979c11764e9fe6a100278b4c5 # v2026.01.01
|
||||
198
.github/workflows/release.yml
vendored
Normal file
198
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version to release (e.g., 1.0.0)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: 🔍 Validate Release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
|
||||
steps:
|
||||
- name: ⤵️ Checkout Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🔢 Extract Version
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
echo "version=v${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
VERSION="${GITHUB_REF#refs/tags/}"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
echo "Releasing version: ${VERSION}"
|
||||
|
||||
- name: ✅ Validate Version Format
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then
|
||||
echo "❌ Invalid version format: $VERSION"
|
||||
echo "Expected format: v1.0.0 or v1.0.0-beta.1"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Version format is valid: $VERSION"
|
||||
|
||||
# Tests and linting are handled by the CI workflow that runs on push
|
||||
# This workflow only needs to run once CI passes on the tag
|
||||
check-ci:
|
||||
name: ✅ Verify CI Status
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
needs: validate
|
||||
|
||||
steps:
|
||||
- name: 📋 Check CI Workflow Status
|
||||
uses: actions/github-script@e1ec48de9e3eaf9b93b1c5f88eaf97ae19d7b7bb # v7.0.5
|
||||
with:
|
||||
script: |
|
||||
const { data: workflows } = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'test.yml',
|
||||
head_sha: context.sha,
|
||||
status: 'completed'
|
||||
});
|
||||
|
||||
const latestRun = workflows.workflow_runs[0];
|
||||
if (!latestRun || latestRun.conclusion !== 'success') {
|
||||
core.setFailed('CI workflow has not passed for this commit');
|
||||
}
|
||||
|
||||
console.log(`CI status: ${latestRun?.conclusion || 'not found'}`)
|
||||
|
||||
security:
|
||||
name: 🔒 Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
needs: validate
|
||||
|
||||
steps:
|
||||
- name: 🏗️ Setup Node.js Environment
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🔍 Run Security Audit
|
||||
run: npm audit --audit-level=high
|
||||
|
||||
release:
|
||||
name: 🚀 Release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
needs: [validate, check-ci, security]
|
||||
if: always() && needs.validate.result == 'success' && needs.check-ci.result == 'success' && needs.security.result == 'success'
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: ⤵️ Checkout Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🏗️ Setup Development Environment
|
||||
uses: ./.github/actions/setup-dev
|
||||
with:
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
skip-checkout: "true"
|
||||
|
||||
- name: 🏗️ Build Parser
|
||||
run: npm run build
|
||||
|
||||
- name: 📋 Update Package Version
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
npm version ${VERSION} --no-git-tag-version
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add package.json package-lock.json
|
||||
git commit -m "chore: bump version to ${VERSION}" || true
|
||||
|
||||
- name: 🏷️ Create Tag
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
VERSION="v${{ github.event.inputs.version }}"
|
||||
git tag ${VERSION}
|
||||
git push origin ${VERSION}
|
||||
|
||||
- name: 📝 Generate Release Notes
|
||||
id: release_notes
|
||||
run: |
|
||||
VERSION="${{ needs.validate.outputs.version }}"
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
|
||||
{
|
||||
echo "## Release ${VERSION}"
|
||||
echo ""
|
||||
} > release_notes.md
|
||||
|
||||
if [ -n "$PREV_TAG" ]; then
|
||||
{
|
||||
echo "### Changes since ${PREV_TAG}"
|
||||
echo ""
|
||||
} >> release_notes.md
|
||||
git log --oneline --pretty=format:"- %s" "${PREV_TAG}..HEAD" >> release_notes.md
|
||||
else
|
||||
{
|
||||
echo "### Initial Release"
|
||||
echo ""
|
||||
echo "- Initial release of tree-sitter-shellspec"
|
||||
echo "- Complete ShellSpec grammar support"
|
||||
echo "- 59 comprehensive test cases"
|
||||
echo "- Real-world compatibility with official ShellSpec examples"
|
||||
} >> release_notes.md
|
||||
fi
|
||||
|
||||
{
|
||||
echo ""
|
||||
echo "### Installation"
|
||||
echo ""
|
||||
echo "\`\`\`bash"
|
||||
echo "npm install @ivuorinen/tree-sitter-shellspec"
|
||||
echo "\`\`\`"
|
||||
} >> release_notes.md
|
||||
|
||||
- name: 🚀 Create GitHub Release
|
||||
uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3
|
||||
with:
|
||||
tag_name: ${{ needs.validate.outputs.version }}
|
||||
name: Release ${{ needs.validate.outputs.version }}
|
||||
body_path: release_notes.md
|
||||
draft: false
|
||||
prerelease: ${{ contains(needs.validate.outputs.version, '-') }}
|
||||
generate_release_notes: false
|
||||
|
||||
- name: 📦 Publish to npm
|
||||
run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: 📊 Release Summary
|
||||
run: |
|
||||
echo "🎉 Successfully released ${{ needs.validate.outputs.version }}"
|
||||
echo "📦 Published to npm: https://www.npmjs.com/package/@ivuorinen/tree-sitter-shellspec"
|
||||
echo "🏷️ GitHub Release: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ needs.validate.outputs.version }}"
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -4,7 +4,7 @@ name: Stale
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * *' # Every day at 08:00
|
||||
- cron: "0 8 * * *" # Every day at 08:00
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
7
.github/workflows/sync-labels.yml
vendored
7
.github/workflows/sync-labels.yml
vendored
@@ -8,13 +8,12 @@ on:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- '.github/labels.yml'
|
||||
- '.github/workflows/sync-labels.yml'
|
||||
- ".github/labels.yml"
|
||||
- ".github/workflows/sync-labels.yml"
|
||||
schedule:
|
||||
- cron: '34 5 * * *' # Run every day at 05:34 AM UTC
|
||||
- cron: "34 5 * * *" # Run every day at 05:34 AM UTC
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
merge_group:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
65
.github/workflows/test.yml
vendored
Normal file
65
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
merge_group:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: 🧪 Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [22, 24]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: 🏗️ Setup Development Environment
|
||||
uses: ./.github/actions/setup-dev
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: 🧪 Test Grammar
|
||||
uses: ./.github/actions/test-grammar
|
||||
|
||||
lint:
|
||||
name: 🧹 Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: 🏗️ Setup Node.js Environment
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🧹 Run Linter
|
||||
uses: ivuorinen/actions/pr-lint@22e6add79fabcca4bf5761452a51e4fa0207e155 # 25.9.8
|
||||
|
||||
coverage:
|
||||
name: 📊 Test Coverage
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: 🏗️ Setup Development Environment
|
||||
uses: ./.github/actions/setup-dev
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: 📊 Test Coverage Analysis
|
||||
uses: ./.github/actions/test-coverage
|
||||
with:
|
||||
minimum-tests: 55
|
||||
Reference in New Issue
Block a user