mirror of
https://github.com/aaddrick/claude-desktop-debian.git
synced 2026-05-17 08:36:35 +03:00
feat: Add --test-flags mode to build script and update CI
This commit is contained in:
132
.github/workflows/test-debian-build.yml
vendored
132
.github/workflows/test-debian-build.yml
vendored
@@ -4,23 +4,18 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- 'build.sh'
|
||||
- 'scripts/**' # Trigger if build scripts change
|
||||
- '.github/workflows/test-debian-build.yml'
|
||||
workflow_dispatch: # Allows manual triggering
|
||||
|
||||
jobs:
|
||||
test-flags:
|
||||
runs-on: ubuntu-latest # Ubuntu is Debian-based
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Install FUSE for AppImageTool
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libfuse2
|
||||
# FUSE install removed - not needed for --test-flags
|
||||
|
||||
- name: Make build script executable
|
||||
run: chmod +x ./build.sh
|
||||
@@ -28,122 +23,107 @@ jobs:
|
||||
# Test Case 1: Defaults (deb, clean=yes)
|
||||
- name: Test Case 1 - Defaults (deb, clean=yes)
|
||||
run: |
|
||||
echo "--- Running Test Case 1: ./build.sh ---"
|
||||
./build.sh
|
||||
echo "--- Running Test Case 1: ./build.sh --test-flags ---"
|
||||
OUTPUT=$(./build.sh --test-flags)
|
||||
echo "$OUTPUT" # Print output for logs
|
||||
echo "--- Verifying Test Case 1 ---"
|
||||
ls -l claude-desktop_*.deb # Check if deb exists in root
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 1 Passed"
|
||||
echo "--- Cleaning up Test Case 1 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 2: --build deb (clean=yes)
|
||||
- name: Test Case 2 - --build deb (clean=yes)
|
||||
run: |
|
||||
echo "--- Running Test Case 2: ./build.sh --build deb ---"
|
||||
./build.sh --build deb
|
||||
echo "--- Running Test Case 2: ./build.sh --build deb --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build deb --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 2 ---"
|
||||
ls -l claude-desktop_*.deb
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 2 Passed"
|
||||
echo "--- Cleaning up Test Case 2 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 3: --build appimage (clean=yes)
|
||||
- name: Test Case 3 - --build appimage (clean=yes)
|
||||
run: |
|
||||
echo "--- Running Test Case 3: ./build.sh --build appimage ---"
|
||||
./build.sh --build appimage
|
||||
echo "--- Running Test Case 3: ./build.sh --build appimage --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build appimage --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 3 ---"
|
||||
ls -l claude-desktop-*.AppImage
|
||||
test -f claude-desktop-*.AppImage || (echo "❌ .AppImage file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: appimage" || (echo "❌ Expected 'Build Format: appimage'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 3 Passed"
|
||||
echo "--- Cleaning up Test Case 3 ---"
|
||||
rm -f claude-desktop-*.AppImage
|
||||
rm -f claude-desktop-appimage.desktop # Also clean the generated desktop file
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 4: --clean yes (build=deb)
|
||||
- name: Test Case 4 - --clean yes (build=deb)
|
||||
run: |
|
||||
echo "--- Running Test Case 4: ./build.sh --clean yes ---"
|
||||
./build.sh --clean yes
|
||||
echo "--- Running Test Case 4: ./build.sh --clean yes --test-flags ---"
|
||||
OUTPUT=$(./build.sh --clean yes --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 4 ---"
|
||||
ls -l claude-desktop_*.deb
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 4 Passed"
|
||||
echo "--- Cleaning up Test Case 4 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 5: --clean no (build=deb)
|
||||
- name: Test Case 5 - --clean no (build=deb)
|
||||
run: |
|
||||
echo "--- Running Test Case 5: ./build.sh --clean no ---"
|
||||
./build.sh --clean no
|
||||
echo "--- Running Test Case 5: ./build.sh --clean no --test-flags ---"
|
||||
OUTPUT=$(./build.sh --clean no --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 5 ---"
|
||||
ls -l claude-desktop_*.deb
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
test -d build || (echo "❌ 'build' directory does NOT exist but should NOT have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: no" || (echo "❌ Expected 'Clean Action: no'" && exit 1)
|
||||
echo "✓ Test Case 5 Passed"
|
||||
echo "--- Cleaning up Test Case 5 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
rm -rf build # Explicitly clean build dir with as it might contain root-owned files
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 6: --build deb --clean yes
|
||||
- name: Test Case 6 - --build deb --clean yes
|
||||
run: |
|
||||
echo "--- Running Test Case 6: ./build.sh --build deb --clean yes ---"
|
||||
./build.sh --build deb --clean yes
|
||||
echo "--- Running Test Case 6: ./build.sh --build deb --clean yes --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build deb --clean yes --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 6 ---"
|
||||
ls -l claude-desktop_*.deb
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 6 Passed"
|
||||
echo "--- Cleaning up Test Case 6 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 7: --build deb --clean no
|
||||
- name: Test Case 7 - --build deb --clean no
|
||||
run: |
|
||||
echo "--- Running Test Case 7: ./build.sh --build deb --clean no ---"
|
||||
./build.sh --build deb --clean no
|
||||
echo "--- Running Test Case 7: ./build.sh --build deb --clean no --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build deb --clean no --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 7 ---"
|
||||
ls -l claude-desktop_*.deb
|
||||
test -f claude-desktop_*.deb || (echo "❌ .deb file not found!" && exit 1)
|
||||
test -d build || (echo "❌ 'build' directory does NOT exist but should NOT have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: deb" || (echo "❌ Expected 'Build Format: deb'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: no" || (echo "❌ Expected 'Clean Action: no'" && exit 1)
|
||||
echo "✓ Test Case 7 Passed"
|
||||
echo "--- Cleaning up Test Case 7 ---"
|
||||
rm -f claude-desktop_*.deb
|
||||
rm -rf build # Explicitly clean build dir with sudo
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 8: --build appimage --clean yes
|
||||
- name: Test Case 8 - --build appimage --clean yes
|
||||
run: |
|
||||
echo "--- Running Test Case 8: ./build.sh --build appimage --clean yes ---"
|
||||
./build.sh --build appimage --clean yes
|
||||
echo "--- Running Test Case 8: ./build.sh --build appimage --clean yes --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build appimage --clean yes --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 8 ---"
|
||||
ls -l claude-desktop-*.AppImage
|
||||
test -f claude-desktop-*.AppImage || (echo "❌ .AppImage file not found!" && exit 1)
|
||||
! test -d build || (echo "❌ 'build' directory exists but should have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: appimage" || (echo "❌ Expected 'Build Format: appimage'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: yes" || (echo "❌ Expected 'Clean Action: yes'" && exit 1)
|
||||
echo "✓ Test Case 8 Passed"
|
||||
echo "--- Cleaning up Test Case 8 ---"
|
||||
rm -f claude-desktop-*.AppImage
|
||||
rm -f claude-desktop-appimage.desktop
|
||||
# No cleanup needed
|
||||
|
||||
# Test Case 9: --build appimage --clean no
|
||||
- name: Test Case 9 - --build appimage --clean no
|
||||
run: |
|
||||
echo "--- Running Test Case 9: ./build.sh --build appimage --clean no ---"
|
||||
./build.sh --build appimage --clean no
|
||||
echo "--- Running Test Case 9: ./build.sh --build appimage --clean no --test-flags ---"
|
||||
OUTPUT=$(./build.sh --build appimage --clean no --test-flags)
|
||||
echo "$OUTPUT"
|
||||
echo "--- Verifying Test Case 9 ---"
|
||||
ls -l claude-desktop-*.AppImage
|
||||
test -f claude-desktop-*.AppImage || (echo "❌ .AppImage file not found!" && exit 1)
|
||||
test -d build || (echo "❌ 'build' directory does NOT exist but should NOT have been cleaned!" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Build Format: appimage" || (echo "❌ Expected 'Build Format: appimage'" && exit 1)
|
||||
echo "$OUTPUT" | grep -q "Clean Action: no" || (echo "❌ Expected 'Clean Action: no'" && exit 1)
|
||||
echo "✓ Test Case 9 Passed"
|
||||
echo "--- Cleaning up Test Case 9 ---"
|
||||
rm -f claude-desktop-*.AppImage
|
||||
rm -f claude-desktop-appimage.desktop
|
||||
rm -rf build # Explicitly clean build dir with sudo
|
||||
# No cleanup needed
|
||||
|
||||
18
build.sh
18
build.sh
@@ -79,7 +79,7 @@ MAINTAINER="Claude Desktop Linux Maintainers"
|
||||
DESCRIPTION="Claude Desktop for Linux"
|
||||
PROJECT_ROOT="$(pwd)" WORK_DIR="$PROJECT_ROOT/build" APP_STAGING_DIR="$WORK_DIR/electron-app" VERSION=""
|
||||
echo -e "\033[1;36m--- Argument Parsing ---\033[0m"
|
||||
BUILD_FORMAT="deb" CLEANUP_ACTION="yes"
|
||||
BUILD_FORMAT="deb" CLEANUP_ACTION="yes" TEST_FLAGS_MODE=false
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
@@ -93,10 +93,15 @@ while [[ $# -gt 0 ]]; do
|
||||
fi
|
||||
CLEANUP_ACTION="$2"
|
||||
shift 2 ;; # Shift past flag and value
|
||||
--test-flags)
|
||||
TEST_FLAGS_MODE=true
|
||||
shift # past argument
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [--build deb|appimage] [--clean yes|no]"
|
||||
echo "Usage: $0 [--build deb|appimage] [--clean yes|no] [--test-flags]"
|
||||
echo " --build: Specify the build format (deb or appimage). Default: deb"
|
||||
echo " --clean: Specify whether to clean intermediate build files (yes or no). Default: yes"
|
||||
echo " --test-flags: Parse flags, print results, and exit without building."
|
||||
exit 0
|
||||
;;
|
||||
*) echo "❌ Unknown option: $1" >&2
|
||||
@@ -125,6 +130,15 @@ if [ "$CLEANUP_ACTION" = "yes" ]; then
|
||||
fi
|
||||
echo -e "\033[1;36m--- End Argument Parsing ---\033[0m"
|
||||
|
||||
# Exit early if --test-flags mode is enabled
|
||||
if [ "$TEST_FLAGS_MODE" = true ]; then
|
||||
echo "--- Test Flags Mode Enabled ---"
|
||||
echo "Build Format: $BUILD_FORMAT"
|
||||
echo "Clean Action: $CLEANUP_ACTION"
|
||||
echo "Exiting without build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
check_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user