Skip to content

chore(deps): bump actions/cache from 4 to 5 #219

chore(deps): bump actions/cache from 4 to 5

chore(deps): bump actions/cache from 4 to 5 #219

Workflow file for this run

name: CI
permissions:
contents: write
pull-requests: write
on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
workflow_dispatch: {}
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Pinned VS Code version (bump workflow updates this line)
env:
VSCODE_VERSION: 1.103.2
jobs:
determine-versions:
name: Determine VS Code versions matrix
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.set.outputs.versions }}
current: ${{ steps.set.outputs.current }}
previous: ${{ steps.set.outputs.previous }}
matrix: ${{ steps.set.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Extract current & previous versions
id: set
run: |
set -e
CURRENT=$(grep -E 'VSCODE_VERSION:' .github/workflows/ci.yml | head -n1 | sed -E 's/.*VSCODE_VERSION:\s*([0-9.]+).*/\1/')
PREV=""
if [ "${{ github.event_name }}" = "pull_request" ] && [[ "${{ github.head_ref }}" == chore/bump-vscode-* ]]; then
BASE_REF='${{ github.base_ref }}'
git fetch origin "$BASE_REF" --depth=1 || true
PREV=$(git show origin/$BASE_REF:.github/workflows/ci.yml 2>/dev/null | grep -E 'VSCODE_VERSION:' | head -n1 | sed -E 's/.*VSCODE_VERSION:\s*([0-9.]+).*/\1/' || true)
if [ "$PREV" = "$CURRENT" ]; then PREV=""; fi
fi
if [ -n "$PREV" ]; then
echo "Bump PR detected: previous=$PREV current=$CURRENT"
VERSIONS_JSON="[\"$PREV\",\"$CURRENT\"]"
else
VERSIONS_JSON="[\"$CURRENT\"]"
fi
echo "versions=$VERSIONS_JSON" >> $GITHUB_OUTPUT
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "previous=$PREV" >> $GITHUB_OUTPUT
echo "Matrix versions: $VERSIONS_JSON"
# Compose full matrix JSON object and expose as output
echo "matrix={\"node\":[\"20.x\"],\"vscode\":$VERSIONS_JSON}" >> $GITHUB_OUTPUT
build-test:
name: Lint & Test (Node ${{ matrix.node }}, VS Code ${{ matrix.vscode }})
runs-on: ubuntu-latest
needs: determine-versions
env:
PINNED_VERSION: ${{ needs.determine-versions.outputs.current }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.determine-versions.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set VS Code version env
run: echo "VSCODE_VERSION=${{ matrix.vscode }}" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Cache ESLint
uses: actions/cache@v5
with:
path: .eslintcache
key: eslint-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('src/**/*.ts') }}
restore-keys: |
eslint-${{ runner.os }}-${{ matrix.node }}-
- name: Lint
run: npm run lint
- name: Compile
run: npm run vscode:prepublish
- name: Cache TS build info
uses: actions/cache@v5
with:
path: .tsbuildinfo
key: tsc-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('tsconfig.json') }}-${{ hashFiles('src/**/*.ts') }}
restore-keys: |
tsc-${{ runner.os }}-${{ matrix.node }}-
- name: Cache VS Code Test Download
uses: actions/cache@v5
with:
path: .vscode-test
key: vscode-test-${{ runner.os }}-${{ matrix.node }}-${{ env.VSCODE_VERSION }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('package.json') }}
restore-keys: |
vscode-test-${{ runner.os }}-${{ matrix.node }}-${{ env.VSCODE_VERSION }}-${{ hashFiles('package-lock.json') }}-
vscode-test-${{ runner.os }}-${{ matrix.node }}-${{ env.VSCODE_VERSION }}-
vscode-test-${{ runner.os }}-${{ matrix.node }}-
vscode-test-${{ runner.os }}-
- name: Activation tests (VS Code integration)
run: xvfb-run -a npm run test:activation
env:
CI: true
- name: Full coverage (unit + integration) & badge
run: xvfb-run -a npm run test:coverage:full
env:
CI: true
- name: Commit coverage badge (only once on pinned matrix)
if: github.ref == 'refs/heads/main' && matrix.vscode == env.PINNED_VERSION
run: |
if git diff --quiet --exit-code coverage/coverage-badge.json 2>/dev/null; then
echo "No coverage badge changes to commit.";
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add coverage/coverage-badge.json
git commit -m "chore: update coverage badge" || echo "Nothing to commit";
git push || echo "Push skipped";
fi
- name: Upload coverage (lcov)
if: always()
uses: actions/upload-artifact@v5
with:
name: coverage-${{ matrix.node }}-${{ matrix.vscode }}
path: coverage/lcov.info
if-no-files-found: warn
- name: Upload test logs if present (best-effort)
if: always()
uses: actions/upload-artifact@v5
with:
name: logs-${{ matrix.node }}-${{ matrix.vscode }}
path: |
*.log
*.txt
if-no-files-found: ignore
- name: Upload build artifact
if: matrix.vscode == env.PINNED_VERSION
uses: actions/upload-artifact@v5
with:
name: build-out
path: |
out/**
.tsbuildinfo
auto-merge-bump:
name: Auto-merge bump PR (if labeled & all matrices pass)
needs: [build-test]
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'chore/bump-vscode-') && contains(toJson(github.event.pull_request.labels), 'auto-merge')
runs-on: ubuntu-latest
steps:
- name: Enable PR auto-merge
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ github.event.pull_request.number }}
merge-method: squash
package:
name: Package VSIX
needs: [build-test, determine-versions]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
env:
VSCODE_VERSION: ${{ needs.determine-versions.outputs.current }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Download build artifact
uses: actions/download-artifact@v6
with:
name: build-out
continue-on-error: true
- name: Build (if artifact missing)
if: ${{ !hashFiles('out/extension.js') }}
run: npm run vscode:prepublish
- name: Cache VS Code Test Download (reuse)
uses: actions/cache@v5
with:
path: .vscode-test
key: vscode-test-${{ runner.os }}-20x-${{ env.VSCODE_VERSION }}-${{ hashFiles('package-lock.json') }}-${{ hashFiles('package.json') }}
restore-keys: |
vscode-test-${{ runner.os }}-20x-${{ env.VSCODE_VERSION }}-${{ hashFiles('package-lock.json') }}-
vscode-test-${{ runner.os }}-20x-${{ env.VSCODE_VERSION }}-
vscode-test-${{ runner.os }}-20x-
vscode-test-${{ runner.os }}-
- name: Package Extension (.vsix)
run: npm run package
- name: Upload Artifact
uses: actions/upload-artifact@v5
with:
name: extension-vsix
path: '*.vsix'
# Optional: automatic publish if VSCE_PAT secret configured
- name: Publish to Marketplace (optional)
if: env.VSCE_PAT != ''
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
echo "Publishing with vsce using provided VSCE_PAT"
npm run release