From 8af83fef857fe9e9b3c156aff47c50730dae3e80 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:00:44 -0700 Subject: [PATCH 01/14] Fix error that can occur when loading canvas addon --- addons/xterm-addon-canvas/src/CanvasAddon.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/xterm-addon-canvas/src/CanvasAddon.ts b/addons/xterm-addon-canvas/src/CanvasAddon.ts index d6136174..2fbec324 100644 --- a/addons/xterm-addon-canvas/src/CanvasAddon.ts +++ b/addons/xterm-addon-canvas/src/CanvasAddon.ts @@ -6,10 +6,11 @@ import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services'; import { ITerminal } from 'browser/Types'; import { CanvasRenderer } from './CanvasRenderer'; -import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; +import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services'; import { ITerminalAddon, Terminal } from 'xterm'; import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; +import { setTraceLogger } from 'common/services/LogService'; export class CanvasAddon extends Disposable implements ITerminalAddon { private _terminal?: Terminal; @@ -44,8 +45,13 @@ export class CanvasAddon extends Disposable implements ITerminalAddon { const charSizeService: ICharSizeService = unsafeCore._charSizeService; const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService; const decorationService: IDecorationService = unsafeCore._decorationService; + const logService: ILogService = unsafeCore._logService; const themeService: IThemeService = unsafeCore._themeService; + // Set trace logger just in case it hasn't been yet which could happen when the addon is + // bundled separately to the core module + setTraceLogger(logService); + this._renderer = new CanvasRenderer(terminal, screenElement, linkifier, bufferService, charSizeService, optionsService, characterJoinerService, coreService, coreBrowserService, decorationService, themeService); this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas)); this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas)); From ee3376593266c73580d5fd066e110b3e6d92c576 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:04:33 -0700 Subject: [PATCH 02/14] Move addon install to presetup Fixes #4704 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fb383fd..df648d55 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-dev": "cross-env NODE_PATH='./out' mocha", "build": "tsc -b ./tsconfig.all.json", + "presetup": "node ./bin/install-addons.js", "setup": "npm run build", - "postinstall": "node ./bin/install-addons.js", "postsetup": "npm run inwasm", "prepublishOnly": "npm run package", "watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput", From eae79e93f39da8fa942bba31eb1ca6c5209074c9 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:11:54 -0700 Subject: [PATCH 03/14] Install addons in CI --- .github/workflows/ci.yml | 14 ++++++++++---- package.json | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf22d67..e16b3571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,9 @@ jobs: node-version: 18.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Lint code run: yarn lint - name: Lint API @@ -95,7 +97,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Unit tests run: yarn test-unit --forbid-only @@ -103,7 +107,7 @@ jobs: needs: build strategy: matrix: - node-version: [18] + node-version: [18] # just one as integration tests are about testing in browser runs-on: [ubuntu, windows] # macos is flaky browser: [chromium, firefox] runs-on: ${{ matrix.runs-on }}-latest @@ -126,7 +130,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Install playwright run: npx playwright install - name: Integration tests (${{ matrix.browser }}) diff --git a/package.json b/package.json index df648d55..be507b6e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-dev": "cross-env NODE_PATH='./out' mocha", "build": "tsc -b ./tsconfig.all.json", - "presetup": "node ./bin/install-addons.js", + "install-addons": "node ./bin/install-addons.js", + "presetup": "npm run install-addons", "setup": "npm run build", "postsetup": "npm run inwasm", "prepublishOnly": "npm run package", From dac4dec0ad16608daf49ba54e33f0783f9fa10c4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:13:52 -0700 Subject: [PATCH 04/14] Put reasonable GH action timeouts in place Fixes #4711 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf22d67..240e13c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v3 - name: Use Node.js 18.x @@ -55,6 +56,7 @@ jobs: lint: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v3 - name: Use Node.js 18.x @@ -71,6 +73,7 @@ jobs: unit-tests: needs: build + timeout-minutes: 20 strategy: matrix: node-version: [16, 18] @@ -101,6 +104,7 @@ jobs: integration-tests: needs: build + timeout-minutes: 20 strategy: matrix: node-version: [18] From 0e947788e039de72e11843b617110424619e4766 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:39:59 -0700 Subject: [PATCH 05/14] Don't smooth scroll when it's a no-op Fixes #4713 --- src/browser/Viewport.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 7c1ae945..049bf77c 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -279,6 +279,9 @@ export class Viewport extends Disposable implements IViewport { } public scrollLines(disp: number): void { + if (disp === 0) { + return; + } if (!this._optionsService.rawOptions.smoothScrollDuration) { this._onRequestScrollLines.fire({ amount: disp, suppressScrollEvent: false }); } else { From 1744801867e773ab95b8e6c21e81d886493bf064 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:52:57 -0700 Subject: [PATCH 06/14] Try parallelize tests and build --- .github/workflows/ci.yml | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf22d67..1d6c3adf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,6 @@ jobs: run: yarn lint-api unit-tests: - needs: build strategy: matrix: node-version: [16, 18] @@ -78,6 +77,15 @@ jobs: runs-on: ${{ matrix.runs-on }}-latest steps: - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }}.x + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }}.x + cache: 'yarn' + - name: Install dependencies + run: yarn --frozen-lockfile + - name: Wait for build job + uses: NathanFirmo/wait-for-other-job@v1.1.1 - uses: actions/download-artifact@v3 with: name: build-artifacts @@ -89,18 +97,10 @@ jobs: run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} - name: Print directory structure run: ls -R - - name: Use Node.js ${{ matrix.node-version }}.x - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }}.x - cache: 'yarn' - - name: Install dependencies - run: yarn --frozen-lockfile - name: Unit tests run: yarn test-unit --forbid-only integration-tests: - needs: build strategy: matrix: node-version: [18] @@ -109,17 +109,6 @@ jobs: runs-on: ${{ matrix.runs-on }}-latest steps: - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 - with: - name: build-artifacts - - name: Unzip artifacts (Linux, macOS) - if: runner.os != 'Windows' - run: unzip -o compressed-build.zip - - name: Unzip artifacts (Windows) - if: runner.os == 'Windows' - run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} - - name: Print directory structure - run: ls -R - name: Use Node.js ${{ matrix.node-version }}.x uses: actions/setup-node@v3 with: @@ -129,5 +118,18 @@ jobs: run: yarn --frozen-lockfile - name: Install playwright run: npx playwright install + - name: Wait for build job + uses: NathanFirmo/wait-for-other-job@v1.1.1 + - uses: actions/download-artifact@v3 + with: + name: build-artifacts + - name: Unzip artifacts (Linux, macOS) + if: runner.os != 'Windows' + run: unzip -o compressed-build.zip + - name: Unzip artifacts (Windows) + if: runner.os == 'Windows' + run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} + - name: Print directory structure + run: ls -R - name: Integration tests (${{ matrix.browser }}) run: yarn test-api-${{ matrix.browser }} --headless --forbid-only From e9cbb3e547dc8c60a7fd255206ee8a7532bd7577 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:57:20 -0700 Subject: [PATCH 07/14] Add job name --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d6c3adf..a426746d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,9 @@ jobs: run: yarn --frozen-lockfile - name: Wait for build job uses: NathanFirmo/wait-for-other-job@v1.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + job: build - uses: actions/download-artifact@v3 with: name: build-artifacts @@ -120,6 +123,9 @@ jobs: run: npx playwright install - name: Wait for build job uses: NathanFirmo/wait-for-other-job@v1.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + job: build - uses: actions/download-artifact@v3 with: name: build-artifacts From 516756fad8e1d292522ca2280b0fb79e80cbdde4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:01:27 -0700 Subject: [PATCH 08/14] Fix install step --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5454e84..ded90ebb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Wait for build job uses: NathanFirmo/wait-for-other-job@v1.1.1 with: @@ -124,7 +126,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Install playwright run: npx playwright install - name: Wait for build job From 4bd154e7dc91fcab82462f3ad042a02ce4555424 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:04:12 -0700 Subject: [PATCH 09/14] Split fast and slow unit tests to free agents --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ded90ebb..7435ab25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,12 +73,12 @@ jobs: - name: Lint API run: yarn lint-api - unit-tests: + unit-tests-fast: timeout-minutes: 20 strategy: matrix: - node-version: [16, 18] - runs-on: [ubuntu, macos, windows] + node-version: [18] + runs-on: [ubuntu, macos] runs-on: ${{ matrix.runs-on }}-latest steps: - uses: actions/checkout@v3 @@ -110,6 +110,39 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only + unit-tests: + needs: build + timeout-minutes: 20 + strategy: + matrix: + node-version: [16] + runs-on: [ubuntu, macos, windows] + runs-on: ${{ matrix.runs-on }}-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }}.x + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }}.x + cache: 'yarn' + - name: Install dependencies + run: | + yarn --frozen-lockfile + yarn install-addons + - uses: actions/download-artifact@v3 + with: + name: build-artifacts + - name: Unzip artifacts (Linux, macOS) + if: runner.os != 'Windows' + run: unzip -o compressed-build.zip + - name: Unzip artifacts (Windows) + if: runner.os == 'Windows' + run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} + - name: Print directory structure + run: ls -R + - name: Unit tests + run: yarn test-unit --forbid-only + integration-tests: timeout-minutes: 20 strategy: From 06fbe69b09de28682af38c839ec6b27d57948a09 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:05:55 -0700 Subject: [PATCH 10/14] Split out integration tests too --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7435ab25..113e2ecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,12 +73,12 @@ jobs: - name: Lint API run: yarn lint-api - unit-tests-fast: + unit-tests*: timeout-minutes: 20 strategy: matrix: node-version: [18] - runs-on: [ubuntu, macos] + runs-on: [ubuntu, macos, windows] runs-on: ${{ matrix.runs-on }}-latest steps: - uses: actions/checkout@v3 @@ -143,7 +143,7 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only - integration-tests: + integration-tests*: timeout-minutes: 20 strategy: matrix: @@ -182,3 +182,39 @@ jobs: run: ls -R - name: Integration tests (${{ matrix.browser }}) run: yarn test-api-${{ matrix.browser }} --headless --forbid-only + + integration-tests: + needs: build + timeout-minutes: 20 + strategy: + matrix: + node-version: [18] # just one as integration tests are about testing in browser + runs-on: [windows] # macos is flaky + browser: [chromium, firefox] + runs-on: ${{ matrix.runs-on }}-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }}.x + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }}.x + cache: 'yarn' + - name: Install dependencies + run: | + yarn --frozen-lockfile + yarn install-addons + - name: Install playwright + run: npx playwright install + - uses: actions/download-artifact@v3 + with: + name: build-artifacts + - name: Unzip artifacts (Linux, macOS) + if: runner.os != 'Windows' + run: unzip -o compressed-build.zip + - name: Unzip artifacts (Windows) + if: runner.os == 'Windows' + run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} + - name: Print directory structure + run: ls -R + - name: Integration tests (${{ matrix.browser }}) + run: yarn test-api-${{ matrix.browser }} --headless --forbid-only From 2c25dd197053ce388b478a1b0434450306fb4e2d Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:14:11 -0700 Subject: [PATCH 11/14] Fix invalid names --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 113e2ecd..47d4f45c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: - name: Lint API run: yarn lint-api - unit-tests*: + unit-tests-fast: timeout-minutes: 20 strategy: matrix: @@ -143,7 +143,7 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only - integration-tests*: + integration-tests-fast: timeout-minutes: 20 strategy: matrix: From ec4c018f734f68b033b2a5d76211adde9beb451e Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:15:02 -0700 Subject: [PATCH 12/14] Remove windows from fast --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47d4f45c..f51a2736 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,7 +148,7 @@ jobs: strategy: matrix: node-version: [18] # just one as integration tests are about testing in browser - runs-on: [ubuntu, windows] # macos is flaky + runs-on: [ubuntu] # macos is flaky browser: [chromium, firefox] runs-on: ${{ matrix.runs-on }}-latest steps: From 92f1881dfe7dd5a1bd84b44cf92a8542dc559da3 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:21:27 -0700 Subject: [PATCH 13/14] Polish job names This matches the npm script names closer --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f51a2736..531103c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: - name: Lint API run: yarn lint-api - unit-tests-fast: + unit-test-parallel: timeout-minutes: 20 strategy: matrix: @@ -110,7 +110,7 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only - unit-tests: + unit-test: needs: build timeout-minutes: 20 strategy: @@ -143,7 +143,7 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only - integration-tests-fast: + test-api-parallel: timeout-minutes: 20 strategy: matrix: @@ -183,7 +183,7 @@ jobs: - name: Integration tests (${{ matrix.browser }}) run: yarn test-api-${{ matrix.browser }} --headless --forbid-only - integration-tests: + test-api: needs: build timeout-minutes: 20 strategy: From 43a3251beeb5e3534649f2ccffc965fd66124775 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:32:51 -0700 Subject: [PATCH 14/14] Fix typo in ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 531103c5..cd465c01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: - name: Lint API run: yarn lint-api - unit-test-parallel: + test-unit-parallel: timeout-minutes: 20 strategy: matrix: @@ -110,7 +110,7 @@ jobs: - name: Unit tests run: yarn test-unit --forbid-only - unit-test: + test-unit: needs: build timeout-minutes: 20 strategy: