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
68 changes: 27 additions & 41 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pi_version: ['0.50.1', 'latest', 'main']
pi_version: ['pinned', 'latest']
services:
ollama:
image: ollama/ollama:latest
Expand All @@ -43,35 +43,29 @@ jobs:
with:
node-version: '20'

# Extract PI_VERSION from Makefile (single source of truth)
# For 'pinned' use Makefile default; for 'latest' override
- name: Get pi version
run: |
if [ "${{ matrix.pi_version }}" = "pinned" ]; then
echo "PI_VERSION=$(grep '^PI_VERSION' Makefile | head -1 | sed 's/.*?= *//')" >> $GITHUB_ENV
else
echo "PI_VERSION=${{ matrix.pi_version }}" >> $GITHUB_ENV
fi

- name: Cache npm dependencies
if: matrix.pi_version != 'main'
uses: actions/cache@v4
with:
path: .cache
key: deps-${{ runner.os }}-pi-${{ matrix.pi_version }}

- name: Setup pi-mono (main branch)
if: matrix.pi_version == 'main'
run: |
git clone --depth 1 https://github.com/badlogic/pi-mono.git pi-mono
cd pi-mono && npm install && npm run build
# Create 'pi' symlink like npm does
cd packages/coding-agent/dist && ln -s cli.js pi
key: deps-${{ runner.os }}-pi-${{ env.PI_VERSION }}

- name: Setup Ollama model
run: |
for i in {1..30}; do curl -s http://localhost:11434/api/tags && break; sleep 1; done
curl -s http://localhost:11434/api/pull -d '{"name":"qwen3:1.7b"}' | tail -1

- name: Run tests (npm version)
if: matrix.pi_version != 'main'
run: make test-integration-ci PI_VERSION=${{ matrix.pi_version }}
env:
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test

- name: Run tests (main branch)
if: matrix.pi_version == 'main'
run: make test-integration-ci PI_BIN=${{ github.workspace }}/pi-mono/packages/coding-agent/dist/cli.js
- name: Run tests
run: make test-integration-ci PI_VERSION=${{ env.PI_VERSION }}
env:
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test

Expand All @@ -82,7 +76,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pi_version: ['0.50.1', 'latest', 'main']
pi_version: ['pinned', 'latest']
services:
ollama:
image: ollama/ollama:latest
Expand All @@ -98,36 +92,28 @@ jobs:
with:
node-version: '20'

# Extract PI_VERSION from Makefile (single source of truth)
- name: Get pi version
run: |
if [ "${{ matrix.pi_version }}" = "pinned" ]; then
echo "PI_VERSION=$(grep '^PI_VERSION' Makefile | head -1 | sed 's/.*?= *//')" >> $GITHUB_ENV
else
echo "PI_VERSION=${{ matrix.pi_version }}" >> $GITHUB_ENV
fi

- name: Cache npm dependencies
if: matrix.pi_version != 'main'
uses: actions/cache@v4
with:
path: .cache
key: deps-${{ runner.os }}-pi-${{ matrix.pi_version }}

- name: Setup pi-mono (main branch)
if: matrix.pi_version == 'main'
run: |
git clone --depth 1 https://github.com/badlogic/pi-mono.git pi-mono
cd pi-mono && npm install && npm run build
# Create 'pi' symlink like npm does
cd packages/coding-agent/dist && ln -s cli.js pi
key: deps-${{ runner.os }}-pi-${{ env.PI_VERSION }}

- name: Setup Ollama model
run: |
for i in {1..30}; do curl -s http://localhost:11434/api/tags && break; sleep 1; done
curl -s http://localhost:11434/api/pull -d '{"name":"qwen3:1.7b"}' | tail -1

- name: Run tests (npm version)
if: matrix.pi_version != 'main'
run: make test-gui-ci PI_VERSION=${{ matrix.pi_version }}
env:
PI_HEADLESS: 1
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test

- name: Run tests (main branch)
if: matrix.pi_version == 'main'
run: make test-gui-ci PI_BIN=${{ github.workspace }}/pi-mono/packages/coding-agent/dist/cli.js
- name: Run tests
run: make test-gui-ci PI_VERSION=${{ env.PI_VERSION }}
env:
PI_HEADLESS: 1
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test
9 changes: 5 additions & 4 deletions .github/workflows/test-gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches: [master, main]
pull_request:

env:
PI_VERSION: '0.50.1'

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -28,6 +25,10 @@ jobs:
with:
node-version: '20'

# Extract PI_VERSION from Makefile (single source of truth)
- name: Get pi version
run: echo "PI_VERSION=$(grep '^PI_VERSION' Makefile | head -1 | sed 's/.*?= *//')" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v4
with:
Expand All @@ -53,7 +54,7 @@ jobs:
echo "Model qwen3:1.7b is ready"

- name: Run tests
run: make test-gui-ci PI_VERSION=${{ env.PI_VERSION }}
run: make test-gui-ci
env:
PI_HEADLESS: 1
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test
9 changes: 5 additions & 4 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches: [master, main]
pull_request:

env:
PI_VERSION: '0.50.4'

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -26,6 +23,10 @@ jobs:
with:
node-version: '20'

# Extract PI_VERSION from Makefile (single source of truth)
- name: Get pi version
run: echo "PI_VERSION=$(grep '^PI_VERSION' Makefile | head -1 | sed 's/.*?= *//')" >> $GITHUB_ENV

- name: Cache dependencies
uses: actions/cache@v4
with:
Expand All @@ -51,6 +52,6 @@ jobs:
echo "Model qwen3:1.7b is ready"

- name: Run tests
run: make test-integration-ci PI_VERSION=${{ env.PI_VERSION }}
run: make test-integration-ci
env:
PI_CODING_AGENT_DIR: ${{ runner.temp }}/pi-test
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
EMACS ?= emacs
BATCH = $(EMACS) --batch -Q -L .

# Pi CLI version - update in workflows too when changing
# Pi CLI version — single source of truth (workflows extract this automatically)
PI_VERSION ?= 0.51.3
PI_BIN ?= .cache/pi/node_modules/.bin/pi
PI_BIN_DIR = $(abspath $(dir $(PI_BIN)))
Expand Down Expand Up @@ -64,6 +64,7 @@ SHELL = /bin/bash
test: .deps-stamp
@echo "=== Unit Tests ==="
@set -o pipefail; $(BATCH) -L test \
--eval "(setq load-prefer-newer t)" \
--eval "(require 'package)" \
--eval "(package-initialize)" \
-l pi-coding-agent -l pi-coding-agent-core-test -l pi-coding-agent-test \
Expand Down
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ GitHub Actions runs on every push:
- =test-integration.yml= - Integration tests with Docker Ollama
- =test-gui.yml= - GUI tests with xvfb virtual framebuffer

Nightly builds test against multiple pi versions (0.48.0, latest, and main branch).
Nightly builds test against the pinned pi version (from Makefile) and latest.

* Links

Expand Down
2 changes: 1 addition & 1 deletion pi-coding-agent-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; Maintainer: Daniel Nouri <daniel.nouri@gmail.com>
;; URL: https://github.com/dnouri/pi-coding-agent
;; Keywords: ai llm ai-pair-programming tools
;; Version: 0.1.0
;; Version: 1.2.6

;; SPDX-License-Identifier: GPL-3.0-or-later

Expand Down
26 changes: 13 additions & 13 deletions test/pi-coding-agent-integration-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,11 @@ Sets up event dispatching through pi-coding-agent--event-handlers list."
(data (plist-get response :data)))
(should (plist-get data :thinkingLevel)))))

;; NOTE: get_commands RPC requires pi > 0.50.1
;; These tests skip gracefully if the RPC is not available.

(ert-deftest pi-coding-agent-integration-get-commands-succeeds ()
"get_commands returns successful response."
(pi-coding-agent-integration-with-process
(sleep-for 1)
(let ((response (pi-coding-agent--rpc-sync proc '(:type "get_commands"))))
;; Skip if RPC not available (pi <= 0.50.1)
(unless response
(ert-skip "get_commands RPC not available (requires pi > 0.50.1)"))
(should response)
(should (eq (plist-get response :success) t))
(should (plist-get response :data)))))
Expand All @@ -108,9 +102,7 @@ Sets up event dispatching through pi-coding-agent--event-handlers list."
(pi-coding-agent-integration-with-process
(sleep-for 1)
(let ((response (pi-coding-agent--rpc-sync proc '(:type "get_commands"))))
;; Skip if RPC not available (pi <= 0.50.1)
(unless response
(ert-skip "get_commands RPC not available (requires pi > 0.50.1)"))
(should response)
(let* ((data (plist-get response :data))
(commands (plist-get data :commands)))
;; Commands should be a vector (JSON array)
Expand Down Expand Up @@ -392,10 +384,18 @@ Verifies the full flow:
(pi-coding-agent-chat-mode)
(setq pi-coding-agent--state (list :session-file session-file))
(setq pi-coding-agent--process proc) ; Associate process with buffer
;; Set the session name via RPC
(pi-coding-agent-set-session-name "Integration Test Session")
;; Wait for async RPC to complete
(accept-process-output proc 1.0))
;; Set the session name via RPC and wait for completion
(let ((name-set nil))
(pi-coding-agent--rpc-async proc
(list :type "set_session_name" :name "Integration Test Session")
(lambda (response)
(when (plist-get response :success)
(setq pi-coding-agent--session-name "Integration Test Session")
(setq name-set t))))
(with-timeout (pi-coding-agent-test-rpc-timeout
(ert-fail "Timeout waiting for set_session_name"))
(while (not name-set)
(accept-process-output proc 0.1)))))
;; Verify file contains session_info with our name
(with-temp-buffer
(insert-file-contents session-file)
Expand Down