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
58 changes: 56 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"displayName": "log2src",
"description": "A debugger driven by logs",
"version": "0.0.1",
"publisher": "ttiimm",
"author": {
"name": "Tim Likarish Ellis"
},
Expand Down
21 changes: 18 additions & 3 deletions editors/code/src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Loading