From fdc73d45970297a3a88765ecacf15533c9e1cab4 Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Fri, 22 Sep 2023 18:28:19 +0200 Subject: [PATCH] chore: Improve Integration Test Matrix (#2824) --- .github/workflows/integration-test.yml | 31 +++++++++++++++++---- packages/_integrationTests/src/runTests.mts | 14 ++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a326d2b039..9cc547bc75 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,21 +15,42 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node-version: [16.x] + node-version: + - ${{ vars.DEFAULT_NODE_VERSION }} + vscode-version: [stable] + include: + - os: ubuntu-latest + node-version: ${{ vars.DEFAULT_NODE_VERSION }} + vscode-version: package.json + - os: ubuntu-latest + node-version: ${{ vars.DEFAULT_NODE_VERSION }} + vscode-version: insiders runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Install Node.js uses: actions/setup-node@v3.8.1 with: node-version: ${{ matrix.node-version }} cache: npm - - run: npm i - - run: npm run build - - run: xvfb-run -a npm run test-client-integration + + - name: Install and Build + run: | + npm i + npm run build + + - name: Run Linux if: runner.os == 'Linux' - - run: npm run test-client-integration + env: + VSCODE_VERSION: ${{ matrix.vscode-version }} + run: xvfb-run -a npm run test-client-integration + + - name: Run Windows and MacOS if: runner.os != 'Linux' + env: + VSCODE_VERSION: ${{ matrix.vscode-version }} + run: npm run test-client-integration # cspell:ignore xvfb diff --git a/packages/_integrationTests/src/runTests.mts b/packages/_integrationTests/src/runTests.mts index 27938d369e..d4804bafb6 100644 --- a/packages/_integrationTests/src/runTests.mts +++ b/packages/_integrationTests/src/runTests.mts @@ -28,11 +28,19 @@ async function run(version: undefined | 'stable' | 'insiders' | string) { await runTests(options); } +async function getVSCodeVersionFromPackage(): Promise { + const extPkg = JSON.parse(await fs.readFile(path.join(extensionDevelopmentPath, 'package.json'), 'utf8')); + return extPkg.engines['vscode'].replace('^', ''); +} + async function main() { try { - const extPkg = JSON.parse(await fs.readFile(path.join(extensionDevelopmentPath, 'package.json'), 'utf8')); - await run('stable'); - await run(extPkg.engines['vscode'].replace('^', '')); + const versions = process.env['VSCODE_VERSION'] ? [process.env['VSCODE_VERSION']] : ['stable', 'package.json']; + for (const version of versions) { + const vscVersion = version === 'package.json' ? await getVSCodeVersionFromPackage() : version; + console.log('Versions: %o', { version, vscVersion }); + await run(vscVersion); + } } catch (err) { console.error(err); console.error('Failed to run tests');