From 5bdb3720457e8ad9fd9be515e5b3c205306bc2f7 Mon Sep 17 00:00:00 2001 From: Hiteshwari Patel Date: Tue, 3 Dec 2024 18:13:50 -0500 Subject: [PATCH] Update ci-repo.yml --- .github/workflows/ci-repo.yml | 131 +++++++++++++++++++++++++++++++--- 1 file changed, 120 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-repo.yml b/.github/workflows/ci-repo.yml index b5e7037..ab231e3 100644 --- a/.github/workflows/ci-repo.yml +++ b/.github/workflows/ci-repo.yml @@ -9,26 +9,135 @@ on: branches: - "*" # Trigger on pull requests targeting the master branch +concurrency: + group: ci-repo-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +# https://typicode.github.io/husky/how-to.html#ci-server-and-docker +env: + HUSKY: 0 + jobs: + build: + name: Build (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + arch: linux + - os: macos-latest + arch: macos + - os: windows-latest + arch: windows + max-parallel: 3 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install workspace dependencies + run: | + npm ci + + - name: Lint sources + run: | + npm run lint + + - name: Build + run: | + npm run build + test: - name: Run Tests - runs-on: ubuntu-latest # Use Ubuntu for the runner + name: Test (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + needs: build + strategy: + matrix: + include: + - os: ubuntu-latest + arch: linux + - os: macos-latest + arch: macos + - os: windows-latest + arch: windows steps: - # Step 1: Checkout the code - name: Checkout code uses: actions/checkout@v4 - # Step 2: Set up Node.js - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "16" # Specify the Node.js version + node-version-file: ".nvmrc" + cache: "npm" - # Step 3: Install dependencies - - name: Install dependencies - run: npm install + - name: Install workspace dependencies + run: | + npm ci - # Step 4: Compile the project - - name: Compile the project - run: npm run compile + # Run tests on Linux + - name: Run tests (Linux) + if: matrix.arch == 'linux' + run: xvfb-run -a npm test + + # Run tests on macOS + - name: Run tests (macOS) + if: matrix.arch == 'macos' + run: npm test + + # Run tests on Windows + - name: Run tests (Windows) + if: matrix.arch == 'windows' + shell: cmd + run: npm test + + package: + name: Package (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + needs: test + strategy: + matrix: + include: + - os: ubuntu-latest + arch: linux + - os: macos-latest + arch: macos + - os: windows-latest + arch: windows + max-parallel: 3 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install workspace dependencies + run: | + npm ci + + - name: Build the project and generate the .vsix + run: | + npm run build + npm run collect-assets + npm run dist + npm run package + + - name: Upload VSIX artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-${{ matrix.arch }} + path: "dist/*.vsix"