From 6c6203b683c557e2a6d6e969cca9f648cd657f5b Mon Sep 17 00:00:00 2001
From: Shivam Mathur
Date: Tue, 31 Dec 2019 13:25:59 +0530
Subject: [PATCH 1/2] Improve ext-phalcon linux script and readme
---
README.md | 26 +++++++++++++-------------
src/scripts/ext/phalcon.sh | 12 ++++++------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
index 414dfc36..6b2149bb 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
-
+
Setup PHP with required extensions, php.ini configuration, code-coverage support and tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
@@ -62,7 +62,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|macOS X Catalina 10.15|`macOS-latest` or `macOS-10.15`|
## :heavy_plus_sign: PHP Extension Support
-- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
+- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
- On `macOS` extensions which are on `PECL` can be installed.
- Extensions which are installed along with PHP if specified are enabled.
@@ -70,11 +70,11 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
## :wrench: Tools Support
-The latest version of the following tools can be setup globally using the `tools` input
+The latest version of the following tools can be setup globally using the `tools` input.
`composer`, `codeception`, `deployer`, `pecl`, `phinx`, `phpcbf`, `phpcpd`, `php-cs-fixer`, `phpcs`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
-```yml
+```yaml
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
@@ -93,7 +93,7 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
```yaml
uses: shivammathur/setup-php@v1
with:
- php-version: '7.4'
+ php-version: '7.4'
coverage: xdebug
```
@@ -115,7 +115,7 @@ with:
### Disable coverage
-Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
+Specify `coverage: none` to disable both `Xdebug` and `PCOV`.
Consider disabling the coverage using this PHP action for these reasons.
- You are not generating coverage reports while testing.
@@ -141,7 +141,7 @@ Inputs supported by this GitHub Action.
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
-### Basic Setup
+### Basic Setup
> Setup a particular PHP version.
@@ -166,9 +166,9 @@ steps:
```yaml
jobs:
- run:
+ run:
runs-on: ${{ matrix.operating-system }}
- strategy:
+ strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
@@ -187,7 +187,7 @@ jobs:
tools: php-cs-fixer, phpunit #optional, setup tools globally
```
-### Experimental Setup
+### Experimental Setup
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
@@ -223,10 +223,10 @@ You can persist composer's internal cache directory using the [`action/cache`](h
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
-- name: Cache dependencies
+- name: Cache dependencies
uses: actions/cache@v1
with:
- path: ${{ steps.composer-cache.outputs.dir }}
+ path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
@@ -236,7 +236,7 @@ You can persist composer's internal cache directory using the [`action/cache`](h
In the above example, if you support a range of `composer` dependencies and do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
-```yml
+```yaml
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
```
diff --git a/src/scripts/ext/phalcon.sh b/src/scripts/ext/phalcon.sh
index 516f3c03..92118fe6 100644
--- a/src/scripts/ext/phalcon.sh
+++ b/src/scripts/ext/phalcon.sh
@@ -1,15 +1,15 @@
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
-sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
-for tool in php-config phpize; do
- if [ -e "/usr/bin/$tool$2" ]; then
- sudo update-alternatives --set $tool /usr/bin/"$tool$2"
- fi
-done
if [ ! "$(apt-cache search php"$2"-psr)" ]; then
+ sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
+ for tool in php-config phpize; do
+ if [ -e "/usr/bin/$tool$2" ]; then
+ sudo update-alternatives --set $tool /usr/bin/"$tool$2"
+ fi
+ done
cd ~ && git clone --depth=1 https://github.com/jbboehr/php-psr.git
cd php-psr && sudo /usr/bin/phpize"$2"
./configure --with-php-config=/usr/bin/php-config"$2"
From 0ac6f76d36a57243d3d210d95ea723bfd79471e2 Mon Sep 17 00:00:00 2001
From: Shivam Mathur
Date: Wed, 1 Jan 2020 16:05:01 +0530
Subject: [PATCH 2/2] Fix setup order
---
__tests__/install.test.ts | 6 +++---
dist/index.js | 2 +-
src/install.ts | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/__tests__/install.test.ts b/__tests__/install.test.ts
index 5c272af2..45119282 100644
--- a/__tests__/install.test.ts
+++ b/__tests__/install.test.ts
@@ -20,6 +20,9 @@ jest.mock('../src/install', () => ({
}
let script = 'initial script ' + filename + version + os_version;
+ if (tools_csv) {
+ script += 'add_tool';
+ }
if (extension_csv) {
script += 'install extensions';
}
@@ -29,9 +32,6 @@ jest.mock('../src/install', () => ({
if (coverage_driver) {
script += 'set coverage driver';
}
- if (tools_csv) {
- script += 'add_tool';
- }
return script;
}
diff --git a/dist/index.js b/dist/index.js
index 8d996a67..ffe43f67 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2042,6 +2042,7 @@ function build(filename, version, os_version) {
tools_csv = 'pecl, ' + tools_csv;
}
let script = yield utils.readScript(filename, version, os_version);
+ script += yield tools.addTools(tools_csv, os_version);
if (extension_csv) {
script += yield extensions.addExtension(extension_csv, version, os_version);
}
@@ -2051,7 +2052,6 @@ function build(filename, version, os_version) {
if (coverage_driver) {
script += yield coverage.addCoverage(coverage_driver, version, os_version);
}
- script += yield tools.addTools(tools_csv, os_version);
return yield utils.writeScript(filename, script);
});
}
diff --git a/src/install.ts b/src/install.ts
index eccc25d7..cfaadf74 100644
--- a/src/install.ts
+++ b/src/install.ts
@@ -34,6 +34,8 @@ export async function build(
}
let script: string = await utils.readScript(filename, version, os_version);
+ script += await tools.addTools(tools_csv, os_version);
+
if (extension_csv) {
script += await extensions.addExtension(extension_csv, version, os_version);
}
@@ -43,7 +45,6 @@ export async function build(
if (coverage_driver) {
script += await coverage.addCoverage(coverage_driver, version, os_version);
}
- script += await tools.addTools(tools_csv, os_version);
return await utils.writeScript(filename, script);
}