初始化提交
Some checks failed
CI / Check / macos-latest (push) Has been cancelled
CI / Check / ubuntu-latest (push) Has been cancelled
CI / Check / windows-latest (push) Has been cancelled
CI / Test / macos-latest (push) Has been cancelled
CI / Test / ubuntu-latest (push) Has been cancelled
CI / Test / windows-latest (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Secrets Scan (push) Has been cancelled
CI / Install Script Smoke Test (push) Has been cancelled
Some checks failed
CI / Check / macos-latest (push) Has been cancelled
CI / Check / ubuntu-latest (push) Has been cancelled
CI / Check / windows-latest (push) Has been cancelled
CI / Test / macos-latest (push) Has been cancelled
CI / Test / ubuntu-latest (push) Has been cancelled
CI / Test / windows-latest (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Secrets Scan (push) Has been cancelled
CI / Install Script Smoke Test (push) Has been cancelled
This commit is contained in:
55
scripts/docker/install-smoke.Dockerfile
Normal file
55
scripts/docker/install-smoke.Dockerfile
Normal file
@@ -0,0 +1,55 @@
|
||||
# Smoke test for install.sh
|
||||
# Verifies the installer works in a clean environment.
|
||||
#
|
||||
# Usage (CI):
|
||||
# docker build -f scripts/docker/install-smoke.Dockerfile .
|
||||
#
|
||||
# Usage (full E2E — requires a published release):
|
||||
# docker build -f scripts/docker/install-smoke.Dockerfile \
|
||||
# --build-arg OPENFANG_SMOKE_FULL=1 .
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
ca-certificates \
|
||||
bash \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create a non-root user (simulates real user install)
|
||||
RUN useradd -m -s /bin/bash testuser
|
||||
USER testuser
|
||||
WORKDIR /home/testuser
|
||||
|
||||
# Copy the install script from the build context
|
||||
COPY scripts/install.sh /tmp/install.sh
|
||||
|
||||
ARG OPENFANG_SMOKE_FULL=0
|
||||
RUN if [ "$OPENFANG_SMOKE_FULL" = "1" ]; then \
|
||||
bash /tmp/install.sh; \
|
||||
else \
|
||||
# 1. Syntax check
|
||||
bash -n /tmp/install.sh && \
|
||||
echo "PASS: install.sh syntax is valid" && \
|
||||
# 2. Verify detect_platform works by extracting the function
|
||||
bash -c ' \
|
||||
eval "$(sed -n "/^detect_platform/,/^}/p" /tmp/install.sh)" && \
|
||||
detect_platform && \
|
||||
echo "PASS: platform detected as $PLATFORM" \
|
||||
' && \
|
||||
# 3. Verify target matches release naming (must contain -unknown-linux-gnu)
|
||||
bash -c ' \
|
||||
eval "$(sed -n "/^detect_platform/,/^}/p" /tmp/install.sh)" && \
|
||||
detect_platform && \
|
||||
echo "$PLATFORM" | grep -q "linux-gnu" && \
|
||||
echo "PASS: target is gnu (matches release.yml)" \
|
||||
'; \
|
||||
fi
|
||||
|
||||
# If full install succeeded, verify the binary works
|
||||
RUN if [ "$OPENFANG_SMOKE_FULL" = "1" ] && [ -f "$HOME/.openfang/bin/openfang" ]; then \
|
||||
$HOME/.openfang/bin/openfang --version && \
|
||||
echo "PASS: openfang binary works"; \
|
||||
else \
|
||||
echo "SKIP: binary verification (no full install)"; \
|
||||
fi
|
||||
Reference in New Issue
Block a user