Skip to content

fix: resolve workflow issue with missing repository checkout #91

fix: resolve workflow issue with missing repository checkout

fix: resolve workflow issue with missing repository checkout #91

Workflow file for this run

name: PHP Installation & Usage Tests
on:
push:
branches: [main, development]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
# Test PHP installation and usage on Linux
linux-php-test:
name: Linux PHP Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Homebrew
run: |
sudo apt update
sudo apt install -y build-essential curl file git
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- name: Test PHPVM Installation Flow
run: |
chmod +x phpvm.sh
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "=== Testing PHP Installation ==="
./phpvm.sh install 8.3 || echo "PHP 8.3 installation attempted"
- name: Test PHP Version Switching
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "=== Testing Version Switching ==="
./phpvm.sh use 8.3 || echo "Switch to 8.3 attempted"
./phpvm.sh list
echo "=== Testing System Switch ==="
./phpvm.sh system || echo "System switch attempted"
- name: Test Project-based Auto-Switch
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "=== Testing Project Auto-Switch ==="
mkdir -p test_project
echo "8.3" > test_project/.phpvmrc
cd test_project
../phpvm.sh auto || echo "Auto-switch attempted"
cd ..
- name: Verify PHP Functionality
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "=== Verifying PHP Functionality ==="
php -v 2>/dev/null || echo "PHP not currently active (expected in test environment)"
echo "=== Final Status ==="
./phpvm.sh list
# Test installation methods
installation-methods:
name: Installation Methods Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Test cURL Installation
run: |
echo "=== Testing cURL Installation Method ==="
# Create temporary directory for testing
TEST_HOME=$(mktemp -d)
export HOME="$TEST_HOME"
export PHPVM_DIR="$TEST_HOME/.phpvm"
# Test installation
curl -o- https://raw.githubusercontent.com/Thavarshan/phpvm/main/install.sh | bash
# Verify installation
if [ -f "$PHPVM_DIR/phpvm.sh" ]; then
echo "βœ… cURL installation successful"
"$PHPVM_DIR/phpvm.sh" version
else
echo "❌ cURL installation failed"
exit 1
fi
- name: Test wget Installation (Linux only)
if: runner.os == 'Linux'
run: |
echo "=== Testing wget Installation Method ==="
# Create temporary directory for testing
TEST_HOME=$(mktemp -d)
export HOME="$TEST_HOME"
export PHPVM_DIR="$TEST_HOME/.phpvm"
# Test installation
wget -qO- https://raw.githubusercontent.com/Thavarshan/phpvm/main/install.sh | bash
# Verify installation
if [ -f "$PHPVM_DIR/phpvm.sh" ]; then
echo "βœ… wget installation successful"
"$PHPVM_DIR/phpvm.sh" version
else
echo "❌ wget installation failed"
exit 1
fi
# Test PHP usage scenarios
php-usage-test:
name: PHP Usage Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Homebrew (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y build-essential curl file git
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- name: Test PHP Installation Flow
run: |
chmod +x phpvm.sh
if [[ "${{ runner.os }}" == "Linux" ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo "=== Testing PHP Installation ==="
./phpvm.sh install 8.3 || echo "PHP 8.3 installation attempted"
- name: Test PHP Version Operations
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo "=== Testing Version Operations ==="
./phpvm.sh use 8.3 || echo "Switch to 8.3 attempted"
./phpvm.sh list
./phpvm.sh system || echo "System switch attempted"
- name: Test Project Auto-Switch
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo "=== Testing Project Auto-Switch ==="
mkdir -p test_project
echo "8.3" > test_project/.phpvmrc
cd test_project
../phpvm.sh auto || echo "Auto-switch attempted"
cd ..
- name: Verify Final State
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo "=== Final Verification ==="
php -v 2>/dev/null || echo "PHP not currently active (expected in test environment)"
./phpvm.sh list