Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: PR Checks

on:
push:
branches:
- main
- release/**
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
test_suite:
name: Test suite
runs-on: macos-15
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The package quarantine check compares package-lock.json against HEAD^1.
fetch-depth: 2
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24.x"

- name: Enforce package quarantine
run: npm run check:package-quarantine

- name: Install dependencies
shell: bash
run: |
for attempt in 1 2 3 4; do
npm ci && exit 0
echo "npm ci failed (attempt $attempt)"
sleep $((attempt * 10))
done
exit 1

- name: Compile
run: npm run compile

- name: Run hygiene checks
run: npm run hygiene
Comment thread
alexr00 marked this conversation as resolved.
Resolved

- name: Run lint
run: npm run lint

- name: Verify command registrations
run: npm run check:commands

- name: Run test suite
run: npm run test
env:
TEST_JUNIT_XML_PATH: ${{ runner.temp }}/test-results.xml

- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results
path: ${{ runner.temp }}/*test-results.xml
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://dev.azure.com/vscode/vscode-pull-request-github/_apis/build/status/vscode-pull-request-github%20%28pr%29?branchName=main)](https://dev.azure.com/vscode/vscode-pull-request-github/_build?definitionId=44&branchName=main)
[![PR Checks](https://github.com/microsoft/vscode-pull-request-github/actions/workflows/pr.yml/badge.svg?branch=main)](https://github.com/microsoft/vscode-pull-request-github/actions/workflows/pr.yml?query=branch%3Amain)

> Review and manage your GitHub pull requests and issues directly in VS Code

Expand Down
18 changes: 15 additions & 3 deletions src/test/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { existsSync } from 'fs';
import { existsSync, mkdtempSync, rmSync } from 'fs';
import * as os from 'os';
import * as path from 'path';
import { downloadAndUnzipVSCode, runTests } from '@vscode/test-electron';

Expand All @@ -23,6 +24,13 @@ async function downloadVSCodeInsiders(): Promise<string> {
}

async function go() {
// On macOS, VS Code creates its IPC socket in the user data dir, and Unix socket paths are limited to ~103 chars.
// The default (.vscode-test/user-data in the repo) is too long for deep checkouts, so use a short temp dir.
const userDataDir = process.platform === 'darwin' ? mkdtempSync(path.join(os.tmpdir(), 'vscode-test-')) : undefined;
const launchArgs = ['--disable-extensions'];
if (userDataDir) {
launchArgs.push(`--user-data-dir=${userDataDir}`);
}
try {
const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
const extensionTestsPath = path.resolve(__dirname, './');
Expand All @@ -36,11 +44,15 @@ async function go() {
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ['--disable-extensions'],
launchArgs,
});
} catch (e) {
console.log(e);
process.exit(1);
process.exitCode = 1;
} finally {
if (userDataDir) {
rmSync(userDataDir, { recursive: true, force: true });
}
}
}

Expand Down
Loading