Skip to content

Commit

Permalink
Merge pull request #11 from stevegrunwell/release/v1.2.0
Browse files Browse the repository at this point in the history
Version 1.2.0
  • Loading branch information
stevegrunwell authored Nov 22, 2020
2 parents 76c4cda + f3f0fc3 commit 7a2ed7a
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 114 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/tests.yml
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

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
vendor
*.tgz
*.tgz
.phpunit.result.cache
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.2.0] — 2020-11-22

* Install different versions based on PHP version ([#10]).


## [1.1.1] - 2018-12-05

* Add PHP 7.3 support by [upgrading Runkit 7 to version 1.0.9](https://github.com/runkit7/runkit7/releases/tag/1.0.9) ([#8]).


## [1.1.0] - 2018-06-27

* Attempt to automatically create `runkit.ini` files upon installation ([#1]).
* Add a `name` attribute to the `<testsuite>` node, fixing some Travis build errors ([#2]).
* Document that root access might be necessary to run the installer ([#3]).
* Include [Shellcheck](https://www.shellcheck.net/) as part of the continuous integration process.


## [1.0.0] - 2018-03-29

* Initial public release.


[Unreleased]: https://github.com/stevegrunwell/runkit7-installer/compare/master...develop
[1.2.0]: https://github.com/stevegrunwell/runkit7-installer/releases/tag/v1.2.0
[1.1.1]: https://github.com/stevegrunwell/runkit7-installer/releases/tag/v1.1.1
[1.1.0]: https://github.com/stevegrunwell/runkit7-installer/releases/tag/v1.1.0
[1.0.0]: https://github.com/stevegrunwell/runkit7-installer/releases/tag/v1.0.0
[#1]: https://github.com/stevegrunwell/runkit7-installer/issues/1
[#2]: https://github.com/stevegrunwell/runkit7-installer/issues/2
[#3]: https://github.com/stevegrunwell/runkit7-installer/issues/3
[#8]: https://github.com/stevegrunwell/runkit7-installer/pull/8
[#10]: https://github.com/stevegrunwell/runkit7-installer/pull/10
83 changes: 65 additions & 18 deletions bin/install-runkit.sh
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
7 changes: 1 addition & 6 deletions composer.json
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",
Expand All @@ -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"
]
Expand Down
61 changes: 0 additions & 61 deletions tests/InstallTest.php

This file was deleted.

0 comments on commit 7a2ed7a

Please sign in to comment.