-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from stevegrunwell/release/v1.2.0
Version 1.2.0
- Loading branch information
Showing
7 changed files
with
160 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
coding-standards: | ||
name: Coding standards | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Shellcheck | ||
uses: ludeeus/action-shellcheck@master | ||
with: | ||
scandir: './bin' | ||
|
||
test-installation-runkit7: | ||
name: Test installation of runkit7 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [7.0, 7.1, 7.2, 7.3, 7.4] | ||
fail-fast: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Configure PHP environment | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: pecl | ||
|
||
- name: Create PEAR cache directory | ||
run: | | ||
sudo mkdir -p /tmp/pear/{cache,download,temp} | ||
sudo chmod -R 777 /tmp/pear | ||
pecl update-channels | ||
- name: Run the installation script | ||
run: sudo sh bin/install-runkit.sh | ||
|
||
- name: Verify that runkit7 has been installed and activated | ||
run: php -m | grep runkit | ||
|
||
test-installation-runkit: | ||
name: Test installation of runkit | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [5.6] | ||
fail-fast: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Configure PHP environment | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: pecl | ||
|
||
- name: Create PEAR cache directory | ||
run: | | ||
sudo mkdir -p /tmp/pear/{cache,download,temp} | ||
sudo chmod -R 777 /tmp/pear | ||
pecl update-channels | ||
- name: Run the installation script | ||
run: sudo sh bin/install-runkit.sh | ||
|
||
- name: Verify that runkit has been installed and activated | ||
run: php -m | grep runkit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
composer.lock | ||
vendor | ||
*.tgz | ||
*.tgz | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,95 @@ | ||
#!/usr/bin/env sh | ||
# | ||
# Automate the installation of Runkit7 in development and testing environments. | ||
# | ||
# USAGE: | ||
# | ||
# install-runkit.sh {version} | ||
# | ||
# If an explicit version is not provided, the latest version compatible with your PHP | ||
# version will be installed. | ||
|
||
# Enable users to set an explicit version. | ||
[ "$1" ] && RUNKIT_VERSION=$1 || RUNKIT_VERSION="1.0.9" | ||
# Helpers for printing messages with color. | ||
error() { | ||
printf "\\033[0;31m%s\\033[0;0m\\n" "$1" | ||
} | ||
|
||
DOWNLOAD_FILENAME="runkit-${RUNKIT_VERSION}.tgz" | ||
notice() { | ||
printf "\\033[0;33m%s\\033[0;0m\\n" "$1" | ||
} | ||
|
||
# Download a Runkit7 tarball using either cURL or Wget (depending on environment). | ||
download() { | ||
echo "Downloading Runkit7 from ${1}" | ||
if [ "$(command -v curl)" ]; then | ||
curl -sL "$1" > "$2"; | ||
curl -sSL "$1" > "$2"; | ||
elif [ "$(command -v wget)" ]; then | ||
wget -nv -O "$2" "$1" | ||
else | ||
echo "\\033[0;31mNo suitable download utility was found, unable to proceed!\\033[0;m" | ||
error 'No suitable download utility was found, unable to proceed!' | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Verify that PECL is installed. | ||
if [ ! "$(command -v pecl)" ]; then | ||
echo "\\033[0;31mPECL (and, by extension, PEAR) is required in order to install Runkit7." | ||
echo "Please see http://pear.php.net/manual/en/installation.getting.php for more information.\\033[0;m" | ||
error 'PECL (and, by extension, PEAR) is required in order to install Runkit7. | ||
Please see http://pear.php.net/manual/en/installation.getting.php for more information.' | ||
exit 1 | ||
fi | ||
|
||
# Download and install Runkit7. | ||
echo "\\033[0;33mInstalling Runkit7...\\033[0;m" | ||
download "https://github.com/runkit7/runkit7/releases/download/${RUNKIT_VERSION}/runkit-${RUNKIT_VERSION}.tgz" "$DOWNLOAD_FILENAME" \ | ||
&& pecl install "$DOWNLOAD_FILENAME" \ | ||
&& rm "$DOWNLOAD_FILENAME" | ||
PHP_MAJOR_VERSION="$(php -r "echo PHP_MAJOR_VERSION;")" | ||
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;") | ||
EXTENSION="runkit7" | ||
|
||
# Enable users to set an explicit version. | ||
if [ -n "$1" ]; then | ||
RUNKIT_VERSION="runkit7-${1}" | ||
elif [ "$PHP_MAJOR_VERSION" -lt 7 ]; then | ||
RUNKIT_VERSION="runkit" | ||
EXTENSION="runkit" | ||
else | ||
case "$PHP_VERSION" in | ||
"7.0") | ||
RUNKIT_VERSION="runkit7-1.0.11" | ||
TARBALL="https://github.com/runkit7/runkit7/releases/download/1.0.11/runkit-1.0.11.tgz" | ||
EXTENSION="runkit" | ||
;; | ||
"7.1") | ||
RUNKIT_VERSION="runkit7-3.1.0a1" | ||
;; | ||
*) | ||
RUNKIT_VERSION="runkit7-alpha" | ||
;; | ||
esac | ||
fi | ||
|
||
# Install runkit(7) via PECL. | ||
notice "Installing ${RUNKIT_VERSION}..." | ||
|
||
# If we're using a tarball, download it and prepare PECL to install from the downloaded version. | ||
if [ -n "$TARBALL" ]; then | ||
download "$TARBALL" "${RUNKIT_VERSION}.tgz" | ||
echo "> $ pecl install ${RUNKIT_VERSION}.tgz" | ||
pecl install "$RUNKIT_VERSION.tgz" || exit 1 | ||
rm "${RUNKIT_VERSION}.tgz" | ||
else | ||
echo "> $ pecl install ${RUNKIT_VERSION}" | ||
pecl install "$RUNKIT_VERSION" || exit 1 | ||
fi | ||
|
||
# Create runkit.ini files for each version of PHP. | ||
MODS=$(find /etc/php/ -name "mods-available" -type d) | ||
# Create .ini files for each version of PHP. | ||
MODS=$(find /etc/php/ -name "mods-available" -type d 2> /dev/null || echo '') | ||
for DIR in $MODS; do | ||
if [ ! -f "$DIR/runkit.ini" ]; then | ||
echo "extension=runkit.so" | sudo tee "$DIR/runkit.ini" > /dev/null \ | ||
&& echo "Created ${DIR}/runkit.ini" | ||
if [ ! -f "${DIR}/${EXTENSION}.ini" ]; then | ||
echo "extension=${EXTENSION}.so" | sudo tee "${DIR}/${EXTENSION}.ini" > /dev/null \ | ||
&& echo "Created ${DIR}/${EXTENSION}.ini" | ||
fi | ||
done | ||
|
||
# Attempt to enable the Runkit PHP module. | ||
if [ "$(command -v phpenmod)" ]; then | ||
sudo phpenmod runkit && echo "\\033[0;32mRunkit7 has been installed and activated!\\033[0;0m" | ||
sudo phpenmod "$EXTENSION" && echo "\\033[0;32m${EXTENSION} has been installed and activated!\\033[0;0m" | ||
else | ||
notice "${RUNKIT_VERSION} has been installed, but may require manual activation." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "stevegrunwell/runkit7-installer", | ||
"description": "Installer for PHP Runkit7", | ||
"description": "Installer for PHP's runkit and runkit7 extensions", | ||
"license": "MIT", | ||
"keywords": [ | ||
"runkit", | ||
|
@@ -9,18 +9,13 @@ | |
"authors": [ | ||
{ | ||
"name": "Steve Grunwell", | ||
"email": "[email protected]", | ||
"homepage": "https://stevegrunwell.com" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/stevegrunwell/runkit7-installer/issues", | ||
"source": "https://github.com/stevegrunwell/runkit7-installer" | ||
}, | ||
"require-dev": { | ||
"php": "^7.1", | ||
"phpunit/phpunit": ">=6.0" | ||
}, | ||
"bin": [ | ||
"bin/install-runkit.sh" | ||
] | ||
|
This file was deleted.
Oops, something went wrong.