Skip to content

TEST: Workflow test #79

TEST: Workflow test

TEST: Workflow test #79

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' ]
runs-on: ${{ matrix.os }}
steps:
- name: 'PHP version check'
uses: 'actions/checkout@v3'
- run: |
php_versions=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3")
php_versions=("8.2" "8.3")
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
if [[ $(command -v ashdiuasdhu 2>/dev/null) ]]; then
error_message "ashdiuasdhu exists"
fi
notify_message "Checking PHP"
if [[ $(command -v php 2>/dev/null) ]]; then
php -v
initial_php_version=$(php -v | grep -e '^PHP' | cut -d ' ' -f2 | cut -d '.' -f1,2)
notify_message "Initial PHP version is ${initial_php_version}"
notify_message "Removing PHP and all of it's dependencies"
brew uninstall composer
brew uninstall php
brew autoremove
fi
notify_message "Checking Brew"
brew --version
notify_message "Adding shivammathur/php tap"
brew tap shivammathur/php
for php_version in ${php_versions[*]}; do
notify_message "Installing shivammathur/php/php@${php_version}"
brew install shivammathur/php/php@${php_version}
./brew-php-switcher.sh ${php_version}
current_php_version=$(php -v | grep -e '^PHP' | cut -d ' ' -f2 | cut -d '.' -f1,2)
if [[ "${php_version}" == "${current_php_version}" ]]; then
success_message "Version was successfully changed and it's working"
php -v
else
error_message "Version was not successfully changed and it's not working"
exit 1
fi
service="php@${php_version}"
if [[ "${php_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
done
brew services list