Skip to content

Create CI/CD Pipeline for VS Code Extension Project #2

Create CI/CD Pipeline for VS Code Extension Project

Create CI/CD Pipeline for VS Code Extension Project #2

Workflow file for this run

name: CI
on:
push:
branches: ['**']
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Compile
run: npm run compile
- name: Upload dist to artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
- name: Cache node_modules and dist
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Restore cache
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb
- name: Run tests
run: xvfb-run -a npm run test
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: out/
retention-days: 1
cleanup:
needs: [build, test]
if: always()
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
npm cache clean --force