Skip to content

TEST: Workflow test #57

TEST: Workflow test

TEST: Workflow test #57

Workflow file for this run

name: 'macOS'
on:
push:
branches: [ 'test' ]
pull_request:
branches: [ 'test' ]
jobs:
tests:
continue-on-error: false
strategy:
fail-fast: true
matrix:
os: [ 'macos-13' ]
php-version: [ '8.2', '8.3' ]
runs-on: ${{ matrix.os }}
steps:
- name: 'PHP version check'
uses: 'actions/checkout@v3'
- run: |
notify_message() {
echo -e "\\033[33m$*\\033[0m"
}
success_message() {
echo -e "\\033[32m$*\\033[0m"
}
error_message() {
echo -e "\\033[31m$*\\033[0m"
}
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
notify_message "Checking PHP"
php -v
current_php_version=$(php -v | grep -e '^PHP' | cut -d ' ' -f2 | cut -d '.' -f1,2)
notify_message "Current version is ${current_php_version} (Matrix version is: ${{ matrix.php-version }})"
if [[ "${{ matrix.php-version }}" == "${version}" ]]; then
notify_message "Current PHP version is the same as matrix php version."
else
notify_message "Current PHP version and matrix php version are different"
fi
exit 0
notify_message "Checking Brew"
brew --version
notify_message "Adding shivammathur/php tap"
brew tap shivammathur/php
if [[ "${{ matrix.php-version }}" == "${version}" ]]; then
notify_message "Current PHP version is the same as matrix php version."
else
notify_message "Current PHP version and matrix php version are different"
notify_message "Installing shivammathur/php/php@${{ matrix.php-version }}"
brew install shivammathur/php/php@${{ matrix.php-version }}
./brew-php-switcher.sh ${{ matrix.php-version }}
version=$(php -v | grep -e '^PHP' | cut -d ' ' -f2 | cut -d '.' -f1,2)
if [[ "${{ matrix.php-version }}" != "${version}" ]]; then
error_message "Expected ${{ matrix.php-version }} got ${version}"
exit 1
else
success_message "PHP CLI version was properly switched to ${{ matrix.php-version }}"
fi
fi
exit 0
service="php@${version}"
if [[ "${version}" == "8.3" ]]; then
service="php"
fi
brew services start "${service}"
status=$(brew services list | grep "${service}" | grep "started")
if [[ -z "${status}" ]]; then
echo "PHP-FPM service with version ${version} is not started"
exit 1
else
echo "PHP-FPM service with version ${version} was started properly"
fi