diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e136a3..5f65ab3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: ["main", "dev"] pull_request: branches: ["main", "dev"] + workflow_dispatch: jobs: build-and-test: @@ -25,9 +26,24 @@ jobs: - name: Compile run: npm run compile - - name: Run parser tests + - name: Test — parsers run: npx ts-node --project server/tsconfig.json tests/test-parsers.ts + - name: Test — diagnostic codes + run: TS_NODE_PROJECT=tsconfig.base.json npx ts-node tests/test-diagnostic-codes.ts + + - name: Test — version settings + run: TS_NODE_PROJECT=tsconfig.base.json npx ts-node tests/test-version-settings.ts + + - name: Test — fix-it hints (code actions) + run: TS_NODE_PROJECT=tsconfig.base.json npx ts-node tests/test-fix-it-hints.ts + + - name: Test — line directive utils + run: TS_NODE_PROJECT=tsconfig.base.json npx ts-node tests/test-line-directive.ts + + - name: Test — new providers + run: TS_NODE_PROJECT=tsconfig.base.json npx ts-node tests/test-new-providers.ts + - name: Package VSIX run: npx vsce package --no-dependencies -o extension.vsix diff --git a/.github/workflows/publish-ovsx.yml b/.github/workflows/publish-ovsx.yml deleted file mode 100644 index 34b5588..0000000 --- a/.github/workflows/publish-ovsx.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish to Open VSX - -on: - push: - tags: - - "v*" - -jobs: - publish-ovsx: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Build VSIX - run: npx vsce package - - - name: Publish to Open VSX - if: ${{ secrets.OVSX_PAT != '' }} - env: - OVSX_PAT: ${{ secrets.OVSX_PAT }} - run: npx ovsx publish *.vsix --pat "$OVSX_PAT" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b31fac..8d32c9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,13 +6,23 @@ on: - "v*" jobs: - package: + release: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify tag is on main + run: | + git fetch origin main + if ! git merge-base --is-ancestor HEAD origin/main; then + echo "❌ Release tags must be created from the main branch." + exit 1 + fi - name: Setup Node.js uses: actions/setup-node@v4 @@ -24,12 +34,30 @@ jobs: run: npm ci - name: Build VSIX - run: | - npm run package - npx vsce package + run: npx vsce package - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: files: "*.vsix" - generate_release_notes: true \ No newline at end of file + generate_release_notes: true + + - name: Publish to Open VSX + env: + OVSX_PAT: ${{ secrets.OVSX_PAT }} + run: | + if [ -z "$OVSX_PAT" ]; then + echo "⚠️ OVSX_PAT not set — skipping Open VSX publish" + else + npx ovsx publish *.vsix --pat "$OVSX_PAT" + fi + + - name: Publish to VS Marketplace + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + run: | + if [ -z "$VSCE_PAT" ]; then + echo "⚠️ VSCE_PAT not set — skipping VS Marketplace publish" + else + npx vsce publish --pat "$VSCE_PAT" + fi diff --git a/tests/test-new-providers.ts b/tests/test-new-providers.ts index 01198f0..1e11ead 100644 --- a/tests/test-new-providers.ts +++ b/tests/test-new-providers.ts @@ -213,6 +213,7 @@ const fakeDiag: Diagnostic = { range: Range.create(3, 10, 3, 19), message: `Token 'UNDECLARED' is used but not declared with %token.`, source: 'bison', + code: 'bison/undeclared-token', }; const caParams: CodeActionParams = {