diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2814b2f..e17332f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: CARGO_TERM_COLOR: always jobs: - build-and-test: + lib-build-and-test: name: Build & Test runs-on: ${{ matrix.os }} timeout-minutes: 30 @@ -56,10 +56,64 @@ jobs: run: cargo build --verbose - name: Run tests run: cargo test --verbose + + - name: Build release binary for extension tests (macOS ARM64 only) + if: matrix.target == 'aarch64-apple-darwin' + run: cargo build --release --target ${{ matrix.target }} + + - name: Upload release binary for extension tests (macOS ARM64 only) + if: matrix.target == 'aarch64-apple-darwin' + uses: actions/upload-artifact@v4 + with: + name: log2src-test-binary + path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} + if-no-files-found: error + + vscode-extension-test: + name: Test VS Code Extension + needs: [lib-build-and-test] + runs-on: macos-latest + timeout-minutes: 15 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download log2src binary + uses: actions/download-artifact@v4 + with: + name: log2src-test-binary + path: downloaded-binary + + - name: Setup binary for VS Code extension + run: | + mkdir -p editors/code/bin/darwin-arm64 + cp downloaded-binary/log2src editors/code/bin/darwin-arm64/ + chmod +x editors/code/bin/darwin-arm64/log2src + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.8.0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + cache-dependency-path: 'editors/code/pnpm-lock.yaml' + + - name: Install Dependencies + working-directory: editors/code + run: pnpm install + + - name: Run tests + working-directory: editors/code + run: pnpm run test build-release: name: Build Release - needs: [build-and-test] + needs: [lib-build-and-test] if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') runs-on: ${{ matrix.os }} timeout-minutes: 30 diff --git a/editors/code/package.json b/editors/code/package.json index 482efe8..497f6aa 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -3,6 +3,7 @@ "displayName": "log2src", "description": "A debugger driven by logs", "version": "0.0.1", + "publisher": "ttiimm", "author": { "name": "Tim Likarish Ellis" }, diff --git a/editors/code/src/test/suite/extension.test.ts b/editors/code/src/test/suite/extension.test.ts index b13f0a9..f789d58 100644 --- a/editors/code/src/test/suite/extension.test.ts +++ b/editors/code/src/test/suite/extension.test.ts @@ -5,8 +5,23 @@ import * as vscode from 'vscode'; suite('Extension Test Suite', () => { vscode.window.showInformationMessage('Start all tests.'); - test('Sample test', () => { - assert.strictEqual(-1, [1, 2, 3].indexOf(5)); - assert.strictEqual(-1, [1, 2, 3].indexOf(0)); + test('Extension should be present', () => { + assert.ok(vscode.extensions.getExtension('ttiimm.log2src-ext')); + }); + + test('Extension should activate', async () => { + const ext = vscode.extensions.getExtension('ttiimm.log2src-ext'); + assert.ok(ext); + await ext!.activate(); + assert.strictEqual(ext!.isActive, true); + }); + + test('Should register log2src debug type', async () => { + // Ensure extension is activated + const ext = vscode.extensions.getExtension('ttiimm.log2src-ext'); + await ext?.activate(); + + // Verify the extension activated successfully + assert.ok(ext?.isActive, 'Extension should be active'); }); });