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
11 changes: 6 additions & 5 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ jobs:

- name: Build PHAR
run: ./compile.sh


- name: Verify PHAR works
run: |
php clitools.phar --version
echo "✅ PHAR file built successfully and is functional"

- name: Upload PHAR as release asset
uses: actions/upload-release-asset@v1
env:
Expand All @@ -52,7 +57,3 @@ jobs:
asset_name: clitools.phar
asset_content_type: application/octet-stream

- name: Verify PHAR works
run: |
php clitools.phar --version
echo "✅ PHAR file built successfully and is functional"
25 changes: 25 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,31 @@ jobs:
php clitools.phar --version
echo "✅ PHAR file is functional and returns version correctly"

- name: Test PHAR in isolated environment
run: |
echo "Testing PHAR in isolated environment (moved to temp directory)..."
# Create temp directory and copy PHAR there
TEMP_DIR=$(mktemp -d)
echo "Created temp directory: $TEMP_DIR"
cp clitools.phar "$TEMP_DIR/"

# Test from temp directory (without VERSION file or source code)
cd "$TEMP_DIR"
echo "Current directory: $(pwd)"
echo "Contents: $(ls -la)"

# Test version command
php clitools.phar --version
echo "✅ PHAR works correctly from isolated environment"

# Test help command
php clitools.phar --help > /dev/null
echo "✅ PHAR help command works from isolated environment"

# Cleanup
rm -rf "$TEMP_DIR"
echo "✅ Cleanup completed"

- name: Upload PHAR as artifact (for testing)
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ src/vendor/*
vendor/*
.cache
*.backup
*~
2 changes: 1 addition & 1 deletion src/command.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Get version from VERSION file using closure
$getVersion = function() {
$versionFile = \Phar::running() !== ''
? dirname(Phar::running(false)) . '/VERSION'
? 'phar://' . Phar::running(false) . '/VERSION'
: dirname(__DIR__) . '/VERSION';
return trim(file_get_contents($versionFile));
};
Expand Down