Skip to content

Commit e965d5f

Browse files
committed
Refactor GitHub Actions workflows: streamline test execution and add system PHP switching functionality
1 parent 9cd9ba9 commit e965d5f

File tree

3 files changed

+66
-14
lines changed

3 files changed

+66
-14
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,10 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v3
1818

19-
- name: Install BATS (Ubuntu)
20-
if: matrix.os == 'ubuntu-latest'
21-
run: |
22-
git clone https://github.com/bats-core/bats-core.git
23-
cd bats-core
24-
sudo ./install.sh /usr/local
19+
# Set up permissions for the script
20+
- name: Make script executable
21+
run: chmod +x ./phpvm.sh
2522

26-
- name: Install BATS (macOS)
27-
if: matrix.os == 'macos-latest'
28-
run: |
29-
brew install bats-core
30-
31-
- name: Run BATS tests
32-
run: |
33-
bats phpvm.bats
23+
# Run the integrated self-tests
24+
- name: Run integrated tests
25+
run: ./phpvm.sh test

.github/workflows/use.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,26 @@ jobs:
3838
- name: Verify PHP Version
3939
run: |
4040
php -v
41+
42+
- name: Switch to System PHP
43+
run: |
44+
./phpvm.sh system
45+
46+
- name: Verify System PHP Switch
47+
run: |
48+
php -v
49+
50+
- name: Create Project with .phpvmrc
51+
run: |
52+
mkdir -p test_project
53+
echo "8.3" > test_project/.phpvmrc
54+
cd test_project
55+
56+
- name: Test Auto-Switch
57+
run: |
58+
cd test_project
59+
../phpvm.sh auto
60+
61+
- name: Verify Auto-Switch
62+
run: |
63+
php -v

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
# Release Notes
22

3+
## [v1.3.0](https://github.com/Thavarshan/phpvm/compare/v1.2.0...v1.3.0) - 2025-05-11
4+
5+
## Added
6+
7+
- Added `system` command to easily switch back to system PHP version
8+
- Added timestamps to all log messages for better traceability and debugging
9+
- Added log levels (INFO, ERROR, WARNING, DEBUG) for more structured logging
10+
- Added `run_with_sudo` helper function to centralize sudo usage logic
11+
- Added comprehensive self-tests with `phpvm test` command
12+
- Added test for corrupted `.phpvmrc` file handling
13+
- Added better support for detecting and using latest PHP version from Homebrew
14+
- Added improved error messages with more detailed information
15+
- Added ability to run self-tests with `phpvm test` command
16+
- Added debugging capability via `DEBUG=true` environment variable
17+
18+
## Changed
19+
20+
- Changed logging format to include timestamps and log levels
21+
- Changed sudo handling to use a centralized helper function
22+
- Changed path expansion to use `$HOME` instead of tilde notation for better compatibility
23+
- Changed error handling to provide more descriptive and actionable messages
24+
- Changed test framework to be integrated directly into the script
25+
- Changed help message to include information about the `test` command
26+
- Improved bash/zsh shell compatibility with better sourcing logic
27+
- Improved code organization and reduced duplication with helper functions
28+
29+
## Fixed
30+
31+
- Fixed shell crash issue when sourcing in zsh with p10k theme
32+
- Fixed path expansion issues in Ubuntu bashrc configurations
33+
- Fixed missing system PHP switching functionality on macOS
34+
- Fixed detection of latest PHP version on macOS when installed via Homebrew's generic 'php' formula
35+
- Fixed potential sudo permission issues on Linux by using `run_with_sudo` consistently
36+
- Fixed auto-switching edge case with invalid or corrupted `.phpvmrc` files
37+
- Fixed script execution issues when sourced from shell initialization files
38+
- Fixed various edge cases in version detection and switching
39+
340
## [v1.2.0](https://github.com/Thavarshan/phpvm/compare/v1.1.0...v1.2.0) - 2025-02-15
441

542
### Added

0 commit comments

Comments
 (0)