Skip to content

Clean cache for CI #483

Clean cache for CI

Clean cache for CI #483

Workflow file for this run

on:
push:
branches:
- main
pull_request:
jobs:
check:
name: Sanity Checks
runs-on: ubuntu-latest
env:
npm_config_cache: ${{ github.workspace }}/.npm-cache
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: npm
- name: Install dependencies
run: |
npm cache clean
npm ci --ignore-scripts
- name: Check and lint formatting
run: npm run check
- name: Lint
run: npm run lint
- name: Type check
run: npm run typecheck
package:
name: Package VSIX (${{ matrix.name }})
needs: [check]
strategy:
fail-fast: false
matrix:
include:
- name: Windows x64
os: windows-latest
vsceTarget: "win32-x64"
- name: Windows ARM64
os: windows-11-arm
vsceTarget: "win32-arm64"
- name: Linux x64
os: ubuntu-latest
vsceTarget: "linux-x64"
- name: Linux ARM64
os: ubuntu-24.04-arm
vsceTarget: "linux-arm64"
- name: macOS x64
os: macos-15-intel
vsceTarget: "darwin-x64"
- name: macOS ARM64
os: macos-latest
vsceTarget: "darwin-arm64"
- name: Alpine Linux x64
os: ubuntu-latest
container: node:lts-alpine
vsceTarget: "alpine-x64"
- name: Alpine Linux ARM64
os: ubuntu-24.04-arm
vsceTarget: "alpine-arm64"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
npm_config_cache: ${{ github.workspace }}/.npm-cache
steps:
- name: Install dependencies (Alpine)
if: matrix.container == 'node:lts-alpine'
run: |
apk add --no-cache python3 make g++ linux-headers git bash
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
# Setup Node.js is not needed in the Alpine container (it's already the node image)
# But we keep it conditional for others
if: matrix.container != 'node:lts-alpine'
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: npm
- name: Install dependencies
if: matrix.name != 'Alpine Linux ARM64'
run: npm ci
- name: Build and Package (Alpine ARM64)
if: matrix.name == 'Alpine Linux ARM64'
run: |
docker run --rm -v ${{ github.workspace }}:/ws -w /ws node:lts-alpine /bin/sh -c "
apk add --no-cache python3 make g++ linux-headers git bash &&
npm ci &&
npm test &&
npx --yes @vscode/vsce package --target alpine-arm64 &&
chown $(id -u):$(id -g) *.vsix
"
- name: Test native addon
if: matrix.name != 'Alpine Linux ARM64'
run: npm test
- name: Package VSIX
if: matrix.name != 'Alpine Linux ARM64'
env:
VSCE_STORE: file
run: npx --yes @vscode/vsce package --target ${{ matrix.vsceTarget }}
- name: Detect VSIX filename
id: vsix-file
shell: bash
run: |
# Find the first .vsix file produced by vsce
vsix=$(ls *.vsix 2>/dev/null | head -n1 || true)
if [ -z "$vsix" ]; then
echo "No .vsix file found"
exit 1
fi
echo "vsix_name=$vsix" >> $GITHUB_OUTPUT
- name: Upload VSIX artifact
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vsix-file.outputs.vsix_name }}
path: ${{ steps.vsix-file.outputs.vsix_name }}
collect-vsix:
name: Collect VSIX Files
needs: [package]
runs-on: ubuntu-latest
steps:
- name: Download all VSIX artifacts
uses: actions/download-artifact@v6
with:
path: vsix-files
- name: Prepare files for zipping
run: |
mkdir vsix_bundle
find vsix-files -type f -name "*.vsix" -exec mv {} vsix_bundle/ \;
- name: Zip VSIX files
working-directory: vsix_bundle
run: zip ../vsix.zip ./*
- name: Upload VSIX zip
uses: actions/upload-artifact@v6
with:
name: vsix-zip
path: vsix.zip