Skip to content

Commit 21f6381

Browse files
committed
ci: add git install smoke
1 parent 2b3e32b commit 21f6381

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Install Git Smoke
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 6 * * *" # daily
7+
8+
jobs:
9+
install-git-smoke:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout installer
13+
uses: actions/checkout@v4
14+
15+
- name: Build git smoke image
16+
run: docker build -t clawdbot-install-git-smoke:ci -f scripts/docker/install-sh-git-smoke/Dockerfile .
17+
18+
- name: Run git smoke
19+
env:
20+
CLAWDBOT_NO_ONBOARD: "1"
21+
CLAWDBOT_NO_PROMPT: "1"
22+
run: docker run --rm -t -e CLAWDBOT_NO_ONBOARD -e CLAWDBOT_NO_PROMPT clawdbot-install-git-smoke:ci
23+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:22-bookworm-slim
2+
3+
RUN apt-get update \
4+
&& apt-get install -y --no-install-recommends \
5+
bash \
6+
ca-certificates \
7+
curl \
8+
git \
9+
python3 \
10+
make \
11+
g++ \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
COPY scripts/docker/install-sh-git-smoke/run.sh /usr/local/bin/clawdbot-install-git-smoke
15+
COPY public/install.sh /opt/clawdbot-install.sh
16+
RUN chmod +x /usr/local/bin/clawdbot-install-git-smoke \
17+
&& chmod a+r /opt/clawdbot-install.sh
18+
19+
ENTRYPOINT ["/usr/local/bin/clawdbot-install-git-smoke"]
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
LOCAL_INSTALL_PATH="/opt/clawdbot-install.sh"
5+
if [[ -n "${CLAWDBOT_INSTALL_URL:-}" ]]; then
6+
INSTALL_URL="$CLAWDBOT_INSTALL_URL"
7+
elif [[ -f "$LOCAL_INSTALL_PATH" ]]; then
8+
INSTALL_URL="file://${LOCAL_INSTALL_PATH}"
9+
else
10+
INSTALL_URL="https://clawd.bot/install.sh"
11+
fi
12+
13+
echo "==> Clone Clawdbot repo"
14+
REPO_DIR="/tmp/clawdbot-src"
15+
rm -rf "$REPO_DIR"
16+
git clone --depth 1 https://github.com/clawdbot/clawdbot.git "$REPO_DIR"
17+
18+
echo "==> Verify autodetect fails without explicit method (no TTY)"
19+
(
20+
cd "$REPO_DIR"
21+
set +e
22+
curl -fsSL "$INSTALL_URL" | bash -s -- --dry-run --no-onboard --no-prompt >/tmp/git-detect.out 2>&1
23+
code=$?
24+
set -e
25+
if [[ "$code" -eq 0 ]]; then
26+
echo "ERROR: expected installer to fail when repo is detected but no method selected" >&2
27+
cat /tmp/git-detect.out >&2
28+
exit 1
29+
fi
30+
)
31+
32+
echo "==> Install from Git (using detected checkout)"
33+
(
34+
cd "$REPO_DIR"
35+
curl -fsSL "$INSTALL_URL" | bash -s -- --install-method git --no-onboard --no-prompt --no-git-update
36+
)
37+
38+
echo "==> Verify wrapper exists"
39+
test -x "$HOME/.local/bin/clawdbot"
40+
41+
echo "==> Verify clawdbot runs"
42+
export PATH="$HOME/.local/bin:$PATH"
43+
clawdbot --help >/dev/null
44+
45+
echo "==> Verify version matches checkout"
46+
EXPECTED_VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('${REPO_DIR}/package.json','utf8')).version)")"
47+
INSTALLED_VERSION="$(clawdbot --version 2>/dev/null | head -n 1 | tr -d '\r')"
48+
echo "installed=$INSTALLED_VERSION expected=$EXPECTED_VERSION"
49+
if [[ "$INSTALLED_VERSION" != "$EXPECTED_VERSION" ]]; then
50+
echo "ERROR: expected clawdbot@$EXPECTED_VERSION, got $INSTALLED_VERSION" >&2
51+
exit 1
52+
fi
53+
54+
echo "OK"
55+

0 commit comments

Comments
 (0)