-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (103 loc) · 3.85 KB
/
test.yml
File metadata and controls
113 lines (103 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Tests
# ----------------------------------------------------------------------------
# Runs the 2ndBrain-mogging shell test harness on every push/PR to main.
# The harness lives at tests/run_all.sh and orchestrates every test_*.sh
# script, distinguishing PASS / SKIP / FAIL via a SKIP sentinel.
#
# We do NOT run with --strict yet because several skills still legitimately
# skip when their runnable entrypoint is not yet wired. Flip to --strict
# once every test has a real entrypoint.
# ----------------------------------------------------------------------------
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'why-not-*.md'
- 'NOTICE'
- 'LICENSE'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'why-not-*.md'
- 'NOTICE'
- 'LICENSE'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
harness:
name: Shell test harness (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Install jq (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends jq
- name: Install jq (macOS)
if: runner.os == 'macOS'
run: |
brew install jq || brew upgrade jq
- name: Assert bash >= 4 is available
run: |
# macOS ships bash 3.2; install.sh + tests require bash 4+.
if [ "${{ runner.os }}" = "macOS" ]; then
brew install bash || brew upgrade bash
/opt/homebrew/bin/bash --version || /usr/local/bin/bash --version
fi
bash --version
- name: Install fake claude shim on PATH
run: |
# install.sh's preflight (step 1) requires `claude` on PATH and a
# version >= 1.4.0. The runner has no Claude Code install, so we
# drop a stub binary into a directory we know is on PATH on both
# runners (/usr/local/bin works on Linux + Intel macOS; for ARM
# macOS runners we additionally cover /opt/homebrew/bin).
#
# The shim never executes any of the real install side-effects —
# it only answers `--version` and exits 0 for everything else, so
# any `claude mcp add ...` calls become no-ops the install loops
# treat as success. Tests that need to assert specific MCP wiring
# (e.g. tests/test_obsidian_mcp.sh) still install their own
# call-logging mock at the front of PATH, which wins over this one.
#
# We write the shim with printf instead of a heredoc so YAML's
# leading-whitespace handling can't accidentally break the EOF
# marker (heredoc closers must be flush-left).
shim_dir=/usr/local/bin
sudo install -d -m 0755 "$shim_dir"
tmp_shim="$(mktemp)"
printf '%s\n' \
'#!/usr/bin/env bash' \
'if [[ "${1:-}" == "--version" ]]; then' \
' echo "2.1.0 (Claude Code)"' \
' exit 0' \
'fi' \
'exit 0' \
> "$tmp_shim"
sudo install -m 0755 "$tmp_shim" "$shim_dir/claude"
rm -f "$tmp_shim"
if [ "${{ runner.os }}" = "macOS" ] && [ -d /opt/homebrew/bin ]; then
sudo cp "$shim_dir/claude" /opt/homebrew/bin/claude
sudo chmod 0755 /opt/homebrew/bin/claude
fi
command -v claude
claude --version
- name: Run tests/run_all.sh
run: |
chmod +x tests/run_all.sh
bash tests/run_all.sh