mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-05-14 01:21:38 +07:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c274d72a | ||
|
|
bc5c9f7652 | ||
|
|
90487d3de7 | ||
|
|
0229afa4a9 | ||
|
|
694649a4a3 | ||
|
|
46a991b6aa | ||
|
|
7748c24380 | ||
|
|
ac9c953234 | ||
|
|
7729e411ec | ||
|
|
af2322b95c | ||
|
|
45e37a5311 | ||
|
|
690cb7c9d8 | ||
|
|
b2cf73f5fa | ||
|
|
64e2975255 | ||
|
|
106fd0866c | ||
|
|
44724c9282 | ||
|
|
2fa35d2e4e | ||
|
|
29e04e0a1d | ||
|
|
ea13793c13 | ||
|
|
fd580061e0 | ||
|
|
90d81e2adc | ||
|
|
93cb3149d2 |
2
.github/workflows/node.yml
vendored
2
.github/workflows/node.yml
vendored
@@ -54,7 +54,7 @@ jobs:
|
|||||||
run: npm audit
|
run: npm audit
|
||||||
|
|
||||||
- name: Send Coverage
|
- name: Send Coverage
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
files: coverage/lcov.info
|
files: coverage/lcov.info
|
||||||
|
|||||||
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
@@ -16,6 +16,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout release
|
- name: Checkout release
|
||||||
if: github.event_name != 'workflow_dispatch'
|
if: github.event_name != 'workflow_dispatch'
|
||||||
@@ -30,7 +31,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20.x'
|
node-version: '24.x'
|
||||||
registry-url: https://registry.npmjs.org
|
registry-url: https://registry.npmjs.org
|
||||||
|
|
||||||
- name: Install dependencies and add lib
|
- name: Install dependencies and add lib
|
||||||
@@ -42,8 +43,6 @@ jobs:
|
|||||||
- name: Publish to NPM
|
- name: Publish to NPM
|
||||||
if: "!contains(github.event.inputs.skip, 'skip-npm')"
|
if: "!contains(github.event.inputs.skip, 'skip-npm')"
|
||||||
run: npm publish --access public
|
run: npm publish --access public
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|
||||||
- name: Change to GitHub Packages registry
|
- name: Change to GitHub Packages registry
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -268,7 +268,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.5'
|
php-version: '8.5'
|
||||||
tools: composer:v1
|
tools: composer:v2
|
||||||
```
|
```
|
||||||
|
|
||||||
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
- If you do not use composer in your workflow, you can specify `tools: none` to skip it.
|
||||||
@@ -950,11 +950,12 @@ Examples of using `setup-php` with various PHP frameworks and packages.
|
|||||||
| Framework/Package | Runs on | Workflow |
|
| Framework/Package | Runs on | Workflow |
|
||||||
|----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------|
|
|----------------------------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------|
|
||||||
| Blackfire | `macOS`, `ubuntu` and `windows` | [blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire") |
|
| Blackfire | `macOS`, `ubuntu` and `windows` | [blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire") |
|
||||||
| Blackfire Player | `macOS`, `ubuntu` and `windows` | [blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player") |
|
| Blackfire Player | `macOS` and `ubuntu` | [blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player") |
|
||||||
| CakePHP with `MySQL` and `Redis` | `ubuntu` | [cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis") |
|
| CakePHP with `MySQL` and `Redis` | `ubuntu` | [cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis") |
|
||||||
| CakePHP with `PostgreSQL` and `Redis` | `ubuntu` | [cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis") |
|
| CakePHP with `PostgreSQL` and `Redis` | `ubuntu` | [cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis") |
|
||||||
| CakePHP without services | `macOS`, `ubuntu` and `windows` | [cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services") |
|
| CakePHP without services | `macOS`, `ubuntu` and `windows` | [cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services") |
|
||||||
| CodeIgniter | `macOS`, `ubuntu` and `windows` | [codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter") |
|
| CodeIgniter | `macOS`, `ubuntu` and `windows` | [codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter") |
|
||||||
|
| Drupal 11 (Composer-managed) | `ubuntu` | [drupal.yml](./examples/drupal.yml "GitHub Action for Drupal 11 composer-managed projects") |
|
||||||
| Laminas MVC | `macOS`, `ubuntu` and `windows` | [laminas-mvc.yml](./examples/laminas-mvc.yml "GitHub Action for Laminas Framework MVC Projects") |
|
| Laminas MVC | `macOS`, `ubuntu` and `windows` | [laminas-mvc.yml](./examples/laminas-mvc.yml "GitHub Action for Laminas Framework MVC Projects") |
|
||||||
| Laravel with `MySQL` and `Redis` | `ubuntu` | [laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis") |
|
| Laravel with `MySQL` and `Redis` | `ubuntu` | [laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis") |
|
||||||
| Laravel with `PostgreSQL` and `Redis` | `ubuntu` | [laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis") |
|
| Laravel with `PostgreSQL` and `Redis` | `ubuntu` | [laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis") |
|
||||||
@@ -964,14 +965,16 @@ Examples of using `setup-php` with various PHP frameworks and packages.
|
|||||||
| Lumen without services | `macOS`, `ubuntu` and `windows` | [lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services") |
|
| Lumen without services | `macOS`, `ubuntu` and `windows` | [lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services") |
|
||||||
| Phalcon with `MySQL` | `ubuntu` | [phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL") |
|
| Phalcon with `MySQL` | `ubuntu` | [phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL") |
|
||||||
| Phalcon with `PostgreSQL` | `ubuntu` | [phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL") |
|
| Phalcon with `PostgreSQL` | `ubuntu` | [phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL") |
|
||||||
| Roots/bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for Wordpress Development using @roots/bedrock") |
|
|
||||||
| Roots/sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for Wordpress Development using @roots/sage") |
|
|
||||||
| Slim Framework | `macOS`, `ubuntu` and `windows` | [slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework") |
|
| Slim Framework | `macOS`, `ubuntu` and `windows` | [slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework") |
|
||||||
| Symfony with `MySQL` | `ubuntu` | [symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL") |
|
| Symfony with `MySQL` | `ubuntu` | [symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL") |
|
||||||
| Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") |
|
| Symfony with `PostgreSQL` | `ubuntu` | [symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL") |
|
||||||
| Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") |
|
| Symfony without services | `macOS`, `ubuntu` and `windows` | [symfony.yml](./examples/symfony.yml "GitHub Action for Symfony without services") |
|
||||||
| Yii2 Starter Kit with `MySQL` | `ubuntu` | [yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL") |
|
| WordPress plugin | `ubuntu` | [wordpress.yml](./examples/wordpress.yml "GitHub Action for WordPress plugins") |
|
||||||
| Yii2 Starter Kit with `PostgreSQL` | `ubuntu` | [yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL") |
|
| WordPress with Roots/Bedrock | `ubuntu` | [bedrock.yml](./examples/bedrock.yml "GitHub Action for WordPress development using @roots/bedrock") |
|
||||||
|
| WordPress with Roots/Sage | `ubuntu` | [sage.yml](./examples/sage.yml "GitHub Action for WordPress development using @roots/sage") |
|
||||||
|
| Yii3 web application with `MySQL` | `ubuntu` | [yii3-mysql.yml](./examples/yii3-mysql.yml "GitHub Action for Yii3 web application with MySQL") |
|
||||||
|
| Yii3 web application with `PostgreSQL` | `ubuntu` | [yii3-postgres.yml](./examples/yii3-postgres.yml "GitHub Action for Yii3 web application with PostgreSQL") |
|
||||||
|
| Yii3 web application | `ubuntu` and `windows` | [yii3.yml](./examples/yii3.yml "GitHub Action for Yii3 web application") |
|
||||||
|
|
||||||
## :bookmark: Versioning
|
## :bookmark: Versioning
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ function getData(data: Partial<ToolData>): ToolData {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unsetComposerAuthEnv(): void {
|
||||||
|
delete process.env['GITHUB_TOKEN'];
|
||||||
|
delete process.env['COMPOSER_TOKEN'];
|
||||||
|
delete process.env['COMPOSER_AUTH_JSON'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock fetch.ts
|
* Mock fetch.ts
|
||||||
*/
|
*/
|
||||||
@@ -423,6 +429,118 @@ describe('Tools tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it.each`
|
||||||
|
version | affected
|
||||||
|
${'1'} | ${false}
|
||||||
|
${'1.0.0-alpha1'} | ${true}
|
||||||
|
${'1.0.0-alpha2'} | ${true}
|
||||||
|
${'1.0.0-alpha3'} | ${true}
|
||||||
|
${'1.0.0-alpha4'} | ${true}
|
||||||
|
${'1.0.0-alpha5'} | ${true}
|
||||||
|
${'1.0.0-alpha6'} | ${true}
|
||||||
|
${'1.0.0-alpha7'} | ${true}
|
||||||
|
${'1.0.0-alpha8'} | ${true}
|
||||||
|
${'1.0.0-alpha9'} | ${true}
|
||||||
|
${'1.0.0-alpha10'} | ${true}
|
||||||
|
${'1.0.0-alpha11'} | ${true}
|
||||||
|
${'1.0.0-beta1'} | ${true}
|
||||||
|
${'1.0.0-beta2'} | ${true}
|
||||||
|
${'1.0.0'} | ${true}
|
||||||
|
${'1.10.27'} | ${true}
|
||||||
|
${'1.10.28'} | ${false}
|
||||||
|
${'2.0.0-alpha1'} | ${true}
|
||||||
|
${'2.0.0-alpha2'} | ${true}
|
||||||
|
${'2.0.0-alpha3'} | ${true}
|
||||||
|
${'2.0.0-RC1'} | ${true}
|
||||||
|
${'2.0.0-RC2'} | ${true}
|
||||||
|
${'2.2.27'} | ${true}
|
||||||
|
${'2.2.28'} | ${false}
|
||||||
|
${'2.3.0-RC1'} | ${true}
|
||||||
|
${'2.3.0-RC2'} | ${true}
|
||||||
|
${'2.9.7'} | ${true}
|
||||||
|
${'2.9.7-RC1'} | ${true}
|
||||||
|
${'2.9.8'} | ${false}
|
||||||
|
${'2.9.0RC1'} | ${false}
|
||||||
|
${'2.9.x-dev'} | ${false}
|
||||||
|
`('checking affected composer version: $version', ({version, affected}) => {
|
||||||
|
expect(tools.skipGitHubAuthForComposerVersion(version)).toBe(affected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking affected composer version with CRLF ranges', async () => {
|
||||||
|
let affected = false;
|
||||||
|
let fixed = true;
|
||||||
|
await jest.isolateModulesAsync(async () => {
|
||||||
|
jest.doMock('fs', () => ({
|
||||||
|
...jest.requireActual('fs'),
|
||||||
|
readFileSync: (
|
||||||
|
filePath: fs.PathOrFileDescriptor,
|
||||||
|
options?: unknown
|
||||||
|
) => {
|
||||||
|
if (String(filePath).includes('composer-gh-auth-no-op')) {
|
||||||
|
return '1.0.0-0 1.10.28\r\n2.0.0-0 2.2.28\r\n2.3.0-0 2.9.8';
|
||||||
|
}
|
||||||
|
return (jest.requireActual('fs') as typeof fs).readFileSync(
|
||||||
|
filePath,
|
||||||
|
options as fs.ObjectEncodingOptions & {flag?: string}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
const isolatedTools = await import('../src/tools');
|
||||||
|
affected = isolatedTools.skipGitHubAuthForComposerVersion('2.9.7');
|
||||||
|
fixed = isolatedTools.skipGitHubAuthForComposerVersion('2.9.8');
|
||||||
|
});
|
||||||
|
expect(affected).toBe(true);
|
||||||
|
expect(fixed).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each`
|
||||||
|
auth_json | expected
|
||||||
|
${'{"github-oauth":{"github.com":"ghs_new-token"},"http-basic":{"repo.example":{"username":"u","password":"p"}}}'} | ${'{"http-basic":{"repo.example":{"username":"u","password":"p"}}}'}
|
||||||
|
${'{"github-oauth":{"github.com":"ghs_new-token"}}'} | ${undefined}
|
||||||
|
${'{"http-basic":{"repo.example":{"username":"u","password":"p"}}}'} | ${'{"http-basic":{"repo.example":{"username":"u","password":"p"}}}'}
|
||||||
|
${'{"nested":{"github-oauth":{"github.com":"ghs_new-token"}}}'} | ${'{"nested":{"github-oauth":{"github.com":"ghs_new-token"}}}'}
|
||||||
|
${'{"github-oauth":'} | ${'{"github-oauth":'}
|
||||||
|
`('cleaning composer auth json', ({auth_json, expected}) => {
|
||||||
|
unsetComposerAuthEnv();
|
||||||
|
process.env['COMPOSER_AUTH_JSON'] = auth_json;
|
||||||
|
tools.cleanComposerAuthJson();
|
||||||
|
expect(process.env['COMPOSER_AUTH_JSON']).toBe(expected);
|
||||||
|
unsetComposerAuthEnv();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each`
|
||||||
|
version | os | envs | skip_github_auth
|
||||||
|
${'latest'} | ${'linux'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${false}
|
||||||
|
${'1'} | ${'linux'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${false}
|
||||||
|
${'2'} | ${'linux'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${false}
|
||||||
|
${'2.9.7'} | ${'linux'} | ${{}} | ${true}
|
||||||
|
${'2.9.7'} | ${'linux'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${true}
|
||||||
|
${'2.9.7'} | ${'linux'} | ${{COMPOSER_TOKEN: 'ghs_token'}} | ${true}
|
||||||
|
${'2.9.7'} | ${'linux'} | ${{COMPOSER_AUTH_JSON: '{"github-oauth":{"github.com":"ghs_new-token"}}'}} | ${true}
|
||||||
|
${'2.9.7'} | ${'linux'} | ${{COMPOSER_AUTH_JSON: '{"http-basic":{"repo.example":{"username":"u","password":"p"}}}'}} | ${true}
|
||||||
|
${'2.9.8'} | ${'linux'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${false}
|
||||||
|
${'2.9.7'} | ${'win32'} | ${{GITHUB_TOKEN: 'ghs_token'}} | ${true}
|
||||||
|
`(
|
||||||
|
'checking composer github auth skip flag: $version, $os',
|
||||||
|
async ({version, os, envs, skip_github_auth}) => {
|
||||||
|
unsetComposerAuthEnv();
|
||||||
|
Object.assign(process.env, envs);
|
||||||
|
const data = getData({
|
||||||
|
tool: 'composer',
|
||||||
|
os: os,
|
||||||
|
php_version: '7.4',
|
||||||
|
domain: 'https://getcomposer.org',
|
||||||
|
repository: 'composer/composer',
|
||||||
|
version: version
|
||||||
|
});
|
||||||
|
const script = await tools.addComposer(data);
|
||||||
|
expect(script).toContain(
|
||||||
|
`composer ${version}${skip_github_auth ? ' true' : ''}`
|
||||||
|
);
|
||||||
|
unsetComposerAuthEnv();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | uri
|
version | uri
|
||||||
${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
|
${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
|
||||||
@@ -642,6 +760,7 @@ describe('Tools tests', () => {
|
|||||||
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://artifacts.setup-php.com/composer/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://artifacts.setup-php.com/composer/composer-7.4-preview.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
||||||
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://artifacts.setup-php.com/composer/composer-7.4-1.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
||||||
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://artifacts.setup-php.com/composer/composer-7.4-snapshot.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
||||||
|
${'composer:2.9.7'} | ${'add_tool https://github.com/composer/composer/releases/download/2.9.7/composer.phar,https://getcomposer.org/download/2.9.7/composer.phar composer 2.9.7 true'}
|
||||||
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
|
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
|
||||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ describe('Utils tests', () => {
|
|||||||
|
|
||||||
expect(await utils.extensionArray('')).toEqual([]);
|
expect(await utils.extensionArray('')).toEqual([]);
|
||||||
expect(await utils.extensionArray(' ')).toEqual([]);
|
expect(await utils.extensionArray(' ')).toEqual([]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
await utils.extensionArray('apcu, mbstring, \\ pdo_pgsql, posix, session')
|
||||||
|
).toEqual(['apcu', 'mbstring', 'pdo_pgsql', 'posix', 'session']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking INIArray', async () => {
|
it('checking INIArray', async () => {
|
||||||
@@ -173,9 +177,9 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking suppressOutput', async () => {
|
it('checking suppressOutput', async () => {
|
||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
|
|||||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
blackfire-player:
|
blackfire-player:
|
||||||
name: Blackfire (PHP ${{ matrix.php-versions }})
|
name: Blackfire (PHP ${{ matrix.php-versions }})
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
# Add your Blackfire credentials securely using GitHub Secrets
|
# Add your Blackfire credentials securely using GitHub Secrets
|
||||||
env:
|
env:
|
||||||
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
|
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
|
||||||
@@ -14,9 +17,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
# blackfire-player supports PHP >= 5.5
|
# Blackfire Player supports PHP 8.5 and is available on Ubuntu and macOS.
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -31,6 +34,14 @@ jobs:
|
|||||||
tools: blackfire, blackfire-player
|
tools: blackfire, blackfire-player
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
# Refer to https://blackfire.io/docs/player/index#usage
|
- name: Start local endpoint
|
||||||
|
run: |
|
||||||
|
php -S 127.0.0.1:8080 > "$RUNNER_TEMP/blackfire-player.log" 2>&1 &
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
- name: Validate scenario
|
||||||
|
run: blackfire-player validate scenario.bkf
|
||||||
|
|
||||||
|
# Refer to https://docs.blackfire.io/builds-cookbooks/player
|
||||||
- name: Play the scenario
|
- name: Play the scenario
|
||||||
run: blackfire-player run scenario.bkf
|
run: blackfire-player run scenario.bkf --endpoint=http://127.0.0.1:8080
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
# Blackfire supports PHP >= 5.3 on Ubuntu and macOS, and PHP >= 5.4 on Windows
|
# Blackfire supports the current PHP releases on Ubuntu, macOS, and Windows.
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -26,12 +26,24 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Setup Blackfire extension and CLI
|
# Setup Blackfire extension and CLI.
|
||||||
extensions: blackfire
|
extensions: blackfire, :xdebug
|
||||||
tools: blackfire
|
tools: blackfire
|
||||||
# Disable Xdebug and PCOV coverage drivers
|
# Disable Xdebug and PCOV coverage drivers
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
# Refer to https://blackfire.io/docs/cookbooks/profiling-cli
|
# Refer to https://blackfire.io/docs/cookbooks/profiling-cli
|
||||||
- name: Profile
|
- name: Profile
|
||||||
run: blackfire run php my-script.php
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set +e
|
||||||
|
output=$(blackfire run php my-script.php 2>&1)
|
||||||
|
exit_code=$?
|
||||||
|
printf '%s\n' "$output"
|
||||||
|
if [ "$exit_code" -ne 0 ]; then
|
||||||
|
if printf '%s' "$output" | grep -q "upgrade your subscription"; then
|
||||||
|
echo "Blackfire profiling reached the repository quota limit; treating this as a known non-fatal condition."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit "$exit_code"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest cakephp/app release resolves dev dependencies that require PHP 8.4+.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
@@ -37,7 +38,7 @@ jobs:
|
|||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
||||||
# Install memcached if using ext-memcached
|
# Install memcached if using ext-memcached
|
||||||
extensions: mbstring, intl, redis, pdo_mysql
|
extensions: mbstring, intl, redis, apcu, pdo_mysql
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
|
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
# Local MySQL service in GitHub hosted environments is disabled by default.
|
||||||
@@ -61,14 +62,15 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
# Add a step to run migrations if required
|
# Add a step to run migrations if required
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
DB_DSN: "mysql://root:password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/cakephp?init[]=SET sql_mode = \"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\""
|
DATABASE_URL: "mysql://root:password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/cakephp?init[]=SET sql_mode = \"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\""
|
||||||
|
DATABASE_TEST_URL: "mysql://root:password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/cakephp?init[]=SET sql_mode = \"STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\""
|
||||||
|
|
||||||
coding-standard:
|
coding-standard:
|
||||||
name: Coding Standard
|
name: Coding Standard
|
||||||
@@ -81,7 +83,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
@@ -114,7 +116,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
@@ -132,7 +134,9 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest cakephp/app release resolves dev dependencies that require PHP 8.4+.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
@@ -37,7 +39,7 @@ jobs:
|
|||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
# You can also use ext-apcu or ext-memcached instead of ext-redis
|
||||||
# Install memcached if using ext-memcached
|
# Install memcached if using ext-memcached
|
||||||
extensions: mbstring, intl, redis, pdo_pgsql
|
extensions: mbstring, intl, redis, apcu, pdo_pgsql
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
||||||
@@ -61,14 +63,15 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
# Add a step to run migrations if required
|
# Add a step to run migrations if required
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
DB_DSN: postgres://postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres
|
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres?encoding=UTF8
|
||||||
|
DATABASE_TEST_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres?encoding=UTF8
|
||||||
|
|
||||||
coding-standard:
|
coding-standard:
|
||||||
name: Coding Standard
|
name: Coding Standard
|
||||||
@@ -81,8 +84,8 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl, apcu
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
@@ -114,8 +117,8 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl, apcu
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
@@ -132,7 +135,9 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest cakephp/app release resolves dev dependencies that require PHP 8.4+.
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -23,6 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
@@ -37,7 +39,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
composer run-script post-install-cmd
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
@@ -53,10 +55,11 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
@@ -85,12 +88,13 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.5'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
tools: phpstan
|
tools: phpstan
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
@@ -103,7 +107,9 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: |
|
||||||
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
composer run-script post-install-cmd --no-interaction
|
||||||
|
|
||||||
- name: Static Analysis using PHPStan
|
- name: Static Analysis using PHPStan
|
||||||
run: phpstan analyse --no-progress src/
|
run: phpstan analyse --no-progress src/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -17,12 +17,13 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl, curl, dom
|
extensions: mbstring, intl, curl, dom, sqlite3, pdo_sqlite
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
shell: bash
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
|
|||||||
59
examples/drupal.yml
Normal file
59
examples/drupal.yml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# GitHub Action for Drupal 11 composer-managed projects
|
||||||
|
# Requires drupal/core-dev in require-dev for vendor/bin/phpunit
|
||||||
|
name: Testing Drupal
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
drupal:
|
||||||
|
name: Drupal (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
SIMPLETEST_BASE_URL: http://127.0.0.1:8080
|
||||||
|
SIMPLETEST_DB: sqlite://localhost/sites/default/files/.ht.sqlite
|
||||||
|
BROWSERTEST_OUTPUT_DIRECTORY: /tmp/browser_output
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: apcu, ctype, curl, dom, gd, iconv, intl, mbstring, pdo_sqlite, simplexml, xml, zip
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composer-cache
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.php-versions }}" = "8.3" ]; then
|
||||||
|
composer require --dev drupal/core-dev:11.2.10 doctrine/instantiator:^2.0.0 --no-interaction --no-update
|
||||||
|
composer update drupal/core-dev doctrine/instantiator --with-all-dependencies --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
else
|
||||||
|
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Prepare Drupal test directories
|
||||||
|
run: mkdir -p web/sites/default/files "$BROWSERTEST_OUTPUT_DIRECTORY"
|
||||||
|
|
||||||
|
- name: Start Drupal web server
|
||||||
|
run: php -S 127.0.0.1:8080 -t web >/tmp/php-server.log 2>&1 &
|
||||||
|
|
||||||
|
- name: Test with phpunit
|
||||||
|
# Adjust the test path to match your custom modules or themes.
|
||||||
|
run: vendor/bin/phpunit -c web/core web/modules/custom
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
# GitHub Action for Laminas framework MVC projects
|
# GitHub Action for Laminas framework MVC projects
|
||||||
name: Testing Zend Framework
|
name: Testing Laminas MVC
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.1', '8.2', '8.3']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -21,6 +21,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ jobs:
|
|||||||
name: Laravel (PHP ${{ matrix.php-versions }})
|
name: Laravel (PHP ${{ matrix.php-versions }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
|
DB_CONNECTION: mysql
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
DB_DATABASE: laravel
|
DB_DATABASE: laravel
|
||||||
DB_USERNAME: root
|
DB_USERNAME: root
|
||||||
DB_PASSWORD: password
|
DB_PASSWORD: password
|
||||||
BROADCAST_DRIVER: log
|
BROADCAST_CONNECTION: log
|
||||||
CACHE_DRIVER: redis
|
CACHE_STORE: redis
|
||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
SESSION_DRIVER: redis
|
SESSION_DRIVER: redis
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
SESSION_DRIVER: redis
|
SESSION_DRIVER: redis
|
||||||
DB_CONNECTION: pgsql
|
DB_CONNECTION: pgsql
|
||||||
DB_HOST: localhost
|
DB_HOST: 127.0.0.1
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
DB_USERNAME: postgres
|
DB_USERNAME: postgres
|
||||||
DB_DATABASE: postgres
|
DB_DATABASE: postgres
|
||||||
@@ -36,7 +36,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -81,11 +81,11 @@ jobs:
|
|||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -24,6 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -83,7 +83,7 @@ jobs:
|
|||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text --coverage-filter app
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
SESSION_DRIVER: redis
|
SESSION_DRIVER: redis
|
||||||
DB_CONNECTION: pgsql
|
DB_CONNECTION: pgsql
|
||||||
DB_HOST: localhost
|
DB_HOST: 127.0.0.1
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
DB_USERNAME: postgres
|
DB_USERNAME: postgres
|
||||||
DB_DATABASE: postgres
|
DB_DATABASE: postgres
|
||||||
@@ -36,7 +36,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, dom, fileinfo, pgsql
|
extensions: mbstring, dom, fileinfo, pgsql
|
||||||
coverage: xdebug
|
coverage: none
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
# If you are using it instead of service containers, make sure you start it.
|
||||||
@@ -81,11 +81,11 @@ jobs:
|
|||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: php artisan migrate -v
|
run: php artisan migrate -v
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -24,6 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
@@ -42,4 +43,4 @@ jobs:
|
|||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
|
||||||
- name: Test with phpunit
|
- name: Test with phpunit
|
||||||
run: vendor/bin/phpunit --coverage-text
|
run: vendor/bin/phpunit --coverage-text --coverage-filter app
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DB_ADAPTER: mysql
|
DB_ADAPTER: mysql
|
||||||
DB_HOST: 127.0.0.1
|
DB_HOST: 127.0.0.1
|
||||||
DB_NAME: phalcon
|
DB_NAME: vokuro
|
||||||
DB_USERNAME: root
|
DB_USERNAME: root
|
||||||
DB_PASSWORD: password
|
DB_PASSWORD: password
|
||||||
CODECEPTION_URL: 127.0.0.1
|
CODECEPTION_URL: 127.0.0.1
|
||||||
@@ -20,11 +20,11 @@ jobs:
|
|||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
MYSQL_DATABASE: phalcon
|
MYSQL_DATABASE: vokuro
|
||||||
ports:
|
ports:
|
||||||
- 3306/tcp
|
- 3306/tcp
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
@@ -32,8 +32,6 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.2', '7.3', '7.4']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
# For phalcon 3.x, use
|
|
||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -43,7 +41,7 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Use phalcon3 for the phalcon 3.x.
|
# Use phalcon4 for the latest compatible Vokuro sample release.
|
||||||
extensions: mbstring, dom, zip, phalcon4, mysql
|
extensions: mbstring, dom, zip, phalcon4, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
@@ -73,7 +71,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
|
||||||
vendor/bin/phinx migrate
|
vendor/bin/phinx migrate
|
||||||
vendor/bin/phinx seed:run
|
vendor/bin/phinx seed:run
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -11,21 +11,18 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DB_ADAPTER: pgsql
|
DB_ADAPTER: pgsql
|
||||||
DB_HOST: 127.0.0.1
|
DB_HOST: 127.0.0.1
|
||||||
DB_NAME: postgres
|
DB_NAME: vokuro
|
||||||
DB_USERNAME: postgres
|
DB_USERNAME: postgres
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
CODECEPTION_URL: 127.0.0.1
|
CODECEPTION_URL: 127.0.0.1
|
||||||
CODECEPTION_PORT: 8888
|
CODECEPTION_PORT: 8888
|
||||||
DB_CONNECTION: pgsql
|
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
POSTGRES_DB: postgres
|
POSTGRES_DB: vokuro
|
||||||
ports:
|
ports:
|
||||||
- 5432/tcp
|
- 5432/tcp
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
@@ -33,8 +30,6 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.2', '7.3', '7.4']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
# For phalcon 3.x, use
|
|
||||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -44,40 +39,39 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
# Use phalcon3 for the phalcon 3.x
|
|
||||||
extensions: mbstring, dom, zip, phalcon4, pgsql
|
extensions: mbstring, dom, zip, phalcon4, pgsql
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-security-blocking
|
||||||
|
|
||||||
- name: Prepare the application
|
- name: Prepare the application
|
||||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
run: |
|
||||||
|
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||||
|
mkdir -p var/cache/acl var/cache/metaData var/cache/session var/cache/volt var/logs
|
||||||
|
chmod -R 777 var/cache var/logs
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
|
||||||
vendor/bin/phinx migrate
|
vendor/bin/phinx migrate
|
||||||
vendor/bin/phinx seed:run
|
vendor/bin/phinx seed:run
|
||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > vokuro.log 2>&1 &)
|
||||||
vendor/bin/codecept build
|
vendor/bin/codecept build
|
||||||
vendor/bin/codecept run
|
vendor/bin/codecept run
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
node-versions: ['16']
|
node-versions: ['20']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -53,17 +53,10 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install yarn dependencies
|
- name: Install yarn dependencies
|
||||||
run: yarn -V
|
run: yarn install --frozen-lockfile --non-interactive
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Yarn test and build
|
- name: Yarn build
|
||||||
run: |
|
run: yarn build
|
||||||
yarn run test
|
|
||||||
yarn run build
|
|
||||||
yarn run rmdist
|
|
||||||
yarn run "build:production"
|
|
||||||
|
|
||||||
- name: PHP test
|
|
||||||
run: composer test
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -22,6 +22,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ jobs:
|
|||||||
symfony:
|
symfony:
|
||||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APP_ENV: test
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:8.4
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
MYSQL_ROOT_PASSWORD: symfony
|
MYSQL_ROOT_PASSWORD: symfony
|
||||||
@@ -20,7 +22,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5', '8.6']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -30,7 +32,6 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
@@ -53,18 +54,17 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Prepare database
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack
|
php bin/console doctrine:database:create --if-not-exists --no-interaction
|
||||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
php bin/console doctrine:schema:create --no-interaction
|
||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:fixtures:load --no-interaction
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony?serverVersion=8.4&charset=utf8mb4
|
||||||
|
|
||||||
- name: Install PHPUnit
|
|
||||||
run: simple-phpunit install
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: php bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony?serverVersion=8.4&charset=utf8mb4
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ jobs:
|
|||||||
symfony:
|
symfony:
|
||||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APP_ENV: test
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:16
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
@@ -20,7 +22,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5', '8.6']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -30,8 +32,7 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_pgsql, pgsql
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
||||||
@@ -55,16 +56,15 @@ jobs:
|
|||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Run Migration
|
- name: Prepare database
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack
|
php bin/console doctrine:database:create --if-not-exists --no-interaction
|
||||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
php bin/console doctrine:schema:create --no-interaction
|
||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:fixtures:load --no-interaction
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?serverVersion=16.0.0&charset=utf8
|
||||||
|
|
||||||
- name: Install PHPUnit
|
|
||||||
run: simple-phpunit install
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: php bin/phpunit --coverage-text
|
||||||
|
env:
|
||||||
|
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?serverVersion=16.0.0&charset=utf8
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['8.4', '8.5', '8.6']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -19,12 +19,12 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
tools: phpunit-bridge
|
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, zip
|
||||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
|
|
||||||
- name: Get composer cache directory
|
- name: Get composer cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
- name: Cache composer dependencies
|
||||||
@@ -39,8 +39,5 @@ jobs:
|
|||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Install PHPUnit
|
|
||||||
run: simple-phpunit install
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: simple-phpunit --coverage-text
|
run: ./bin/phpunit --coverage-text
|
||||||
|
|||||||
68
examples/wordpress.yml
Normal file
68
examples/wordpress.yml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# GitHub Action for WordPress plugins
|
||||||
|
# Tested with files scaffolded by wp scaffold plugin-tests --ci=github
|
||||||
|
# Requires phpunit/phpunit and yoast/phpunit-polyfills in require-dev for vendor/bin/phpunit
|
||||||
|
name: Testing WordPress
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
wordpress:
|
||||||
|
name: WordPress (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['8.3', '8.4', '8.5']
|
||||||
|
|
||||||
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:latest
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
MYSQL_DATABASE: wordpress_test
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: mbstring, xml, zip, intl, mysql
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composer-cache
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y subversion default-mysql-client
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.php-versions }}" = "8.3" ]; then
|
||||||
|
composer require --dev doctrine/instantiator:^2.0.0 --no-interaction --no-update
|
||||||
|
composer update doctrine/instantiator --with-all-dependencies --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
else
|
||||||
|
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install WordPress test environment
|
||||||
|
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:${{ job.services.mysql.ports['3306'] }} latest true
|
||||||
|
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# GitHub Action for Yii Framework with MySQL
|
|
||||||
name: Testing Yii2 with MySQL
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
yii:
|
|
||||||
name: Yii2 (PHP ${{ matrix.php-versions }})
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
DB_USERNAME: root
|
|
||||||
DB_PASSWORD: yii
|
|
||||||
TEST_DB_USERNAME: root
|
|
||||||
TEST_DB_PASSWORD: yii
|
|
||||||
DB_CHARSET: utf8
|
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql:latest
|
|
||||||
env:
|
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
||||||
MYSQL_ROOT_PASSWORD: yii
|
|
||||||
MYSQL_DATABASE: yii
|
|
||||||
ports:
|
|
||||||
- 3306/tcp
|
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
php-versions: ['7.4', '8.0']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
|
||||||
uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 10.x
|
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
|
|
||||||
coverage: xdebug
|
|
||||||
|
|
||||||
# Local MySQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start mysql service
|
|
||||||
# run: sudo systemctl start mysql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
|
||||||
id: composer-cache
|
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
|
||||||
|
|
||||||
- name: Prepare the application
|
|
||||||
run: |
|
|
||||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
|
||||||
php console/yii app/setup
|
|
||||||
npm install --development
|
|
||||||
npm run build
|
|
||||||
env:
|
|
||||||
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
|
||||||
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
|
||||||
|
|
||||||
- name: Run Tests
|
|
||||||
run: |
|
|
||||||
vendor/bin/codecept build
|
|
||||||
php tests/bin/yii app/setup --interactive=0
|
|
||||||
nohup php -S localhost:8080 > yii.log 2>&1 &
|
|
||||||
vendor/bin/codecept run
|
|
||||||
env:
|
|
||||||
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
|
||||||
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
# GitHub Action for Yii Framework with PostgreSQL
|
|
||||||
name: Testing Yii2 with PostgreSQL
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
yii:
|
|
||||||
name: Yii2 (PHP ${{ matrix.php-versions }})
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
DB_USERNAME: postgres
|
|
||||||
DB_PASSWORD: postgres
|
|
||||||
TEST_DB_USERNAME: postgres
|
|
||||||
TEST_DB_PASSWORD: postgres
|
|
||||||
DB_CHARSET: utf8
|
|
||||||
|
|
||||||
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:latest
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: postgres
|
|
||||||
ports:
|
|
||||||
- 5432/tcp
|
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
php-versions: ['7.4', '8.0']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set Node.js 10.x
|
|
||||||
uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: 10.x
|
|
||||||
|
|
||||||
# Docs: https://github.com/shivammathur/setup-php
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-versions }}
|
|
||||||
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
|
||||||
coverage: xdebug
|
|
||||||
|
|
||||||
# Local PostgreSQL service in GitHub hosted environments is disabled by default.
|
|
||||||
# If you are using it instead of service containers, make sure you start it.
|
|
||||||
# - name: Start postgresql service
|
|
||||||
# run: sudo systemctl start postgresql.service
|
|
||||||
|
|
||||||
- name: Get composer cache directory
|
|
||||||
id: composer-cache
|
|
||||||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Cache composer dependencies
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
# Use composer.json for key, if composer.lock is not committed.
|
|
||||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
|
||||||
|
|
||||||
- name: Prepare the application
|
|
||||||
run: |
|
|
||||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
|
||||||
php console/yii app/setup
|
|
||||||
npm install --development
|
|
||||||
npm run build
|
|
||||||
env:
|
|
||||||
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
|
||||||
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
|
||||||
|
|
||||||
- name: Run Tests
|
|
||||||
run: |
|
|
||||||
vendor/bin/codecept build
|
|
||||||
php tests/bin/yii app/setup --interactive=0
|
|
||||||
nohup php -S localhost:8080 > yii.log 2>&1 &
|
|
||||||
vendor/bin/codecept run
|
|
||||||
env:
|
|
||||||
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
|
||||||
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
|
||||||
78
examples/yii3-mysql.yml
Normal file
78
examples/yii3-mysql.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# GitHub Action for Yii3 web application with MySQL
|
||||||
|
# Tested with https://github.com/yiisoft/app
|
||||||
|
name: Testing Yii3 with MySQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
yii:
|
||||||
|
name: Yii3 (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APP_C3: true
|
||||||
|
APP_ENV: test
|
||||||
|
APP_DEBUG: false
|
||||||
|
|
||||||
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.4
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
MYSQL_DATABASE: app
|
||||||
|
ports:
|
||||||
|
- 3306/tcp
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest yiisoft/app release resolves Symfony 8.0 packages that require PHP 8.4+.
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: fileinfo, intl, pdo_mysql
|
||||||
|
ini-values: date.timezone='UTC', register_argc_argv=On
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composer-cache
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Run migrations
|
||||||
|
run: php yii migrate:up --no-interaction
|
||||||
|
env:
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
DB_NAME: app
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: password
|
||||||
|
|
||||||
|
- name: Run codeception build
|
||||||
|
run: vendor/bin/codecept build
|
||||||
|
|
||||||
|
- name: Run tests with Codeception
|
||||||
|
run: vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||||
|
DB_NAME: app
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PASSWORD: password
|
||||||
78
examples/yii3-postgres.yml
Normal file
78
examples/yii3-postgres.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# GitHub Action for Yii3 web application with PostgreSQL
|
||||||
|
# Tested with https://github.com/yiisoft/app
|
||||||
|
name: Testing Yii3 with PostgreSQL
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
yii:
|
||||||
|
name: Yii3 (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APP_C3: true
|
||||||
|
APP_ENV: test
|
||||||
|
APP_DEBUG: false
|
||||||
|
|
||||||
|
# Docs: https://docs.github.com/en/actions/using-containerized-services
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: app
|
||||||
|
ports:
|
||||||
|
- 5432/tcp
|
||||||
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest yiisoft/app release resolves Symfony 8.0 packages that require PHP 8.4+.
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: fileinfo, intl, pdo_pgsql
|
||||||
|
ini-values: date.timezone='UTC', register_argc_argv=On
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composer-cache
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Run migrations
|
||||||
|
run: php yii migrate:up --no-interaction
|
||||||
|
env:
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
|
DB_NAME: app
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
|
||||||
|
- name: Run codeception build
|
||||||
|
run: vendor/bin/codecept build
|
||||||
|
|
||||||
|
- name: Run tests with Codeception
|
||||||
|
run: vendor/bin/codecept run
|
||||||
|
env:
|
||||||
|
DB_HOST: 127.0.0.1
|
||||||
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||||
|
DB_NAME: app
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
53
examples/yii3.yml
Normal file
53
examples/yii3.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# GitHub Action for Yii3 web application
|
||||||
|
# Tested with https://github.com/yiisoft/app
|
||||||
|
name: Testing Yii3
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
yii:
|
||||||
|
name: Yii3 (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
env:
|
||||||
|
APP_C3: true
|
||||||
|
APP_ENV: test
|
||||||
|
APP_DEBUG: false
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest]
|
||||||
|
php-versions: ['8.4', '8.5']
|
||||||
|
# The latest yiisoft/app release resolves Symfony 8.0 packages that require PHP 8.4+.
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
# Docs: https://github.com/shivammathur/setup-php
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-versions }}
|
||||||
|
extensions: fileinfo, intl
|
||||||
|
ini-values: date.timezone='UTC', register_argc_argv=On
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get composer cache directory
|
||||||
|
id: composer-cache
|
||||||
|
shell: bash
|
||||||
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache composer dependencies
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
# Use composer.json for key, if composer.lock is not committed.
|
||||||
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Run codeception build
|
||||||
|
run: vendor/bin/codecept build
|
||||||
|
|
||||||
|
- name: Run tests with Codeception
|
||||||
|
run: vendor/bin/codecept run
|
||||||
1165
package-lock.json
generated
1165
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.37.0",
|
"version": "2.37.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "lib/install.js",
|
"main": "lib/install.js",
|
||||||
@@ -38,26 +38,26 @@
|
|||||||
"compare-versions": "^6.1.1"
|
"compare-versions": "^6.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^2.0.3",
|
"@eslint/compat": "^2.1.0",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^25.5.0",
|
"@types/node": "^25.7.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
||||||
"@typescript-eslint/parser": "^8.57.0",
|
"@typescript-eslint/parser": "^8.59.3",
|
||||||
"@vercel/ncc": "^0.38.4",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint": "^10.0.3",
|
"eslint": "^10.3.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import-x": "^4.16.2",
|
"eslint-plugin-import-x": "^4.16.2",
|
||||||
"eslint-plugin-jest": "^29.15.0",
|
"eslint-plugin-jest": "^29.15.2",
|
||||||
"eslint-plugin-prettier": "^5.5.5",
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.6.0",
|
||||||
"jest": "^30.3.0",
|
"jest": "^30.4.2",
|
||||||
"jest-circus": "^30.3.0",
|
"jest-circus": "^30.4.2",
|
||||||
"nock": "^14.0.11",
|
"nock": "^14.0.15",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.3",
|
||||||
"simple-git-hooks": "^2.13.1",
|
"simple-git-hooks": "^2.13.1",
|
||||||
"ts-jest": "^29.4.6",
|
"ts-jest": "^29.4.9",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export async function addINIValuesUnix(
|
|||||||
return (
|
return (
|
||||||
'echo "' +
|
'echo "' +
|
||||||
ini_values.join('\n') +
|
ini_values.join('\n') +
|
||||||
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
|
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" ' +
|
||||||
script
|
script
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
3
src/configs/composer-gh-auth-no-op
Normal file
3
src/configs/composer-gh-auth-no-op
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
1.0.0-0 1.10.28
|
||||||
|
2.0.0-0 2.2.28
|
||||||
|
2.3.0-0 2.9.8
|
||||||
1
src/configs/composer-gh-auth-warn
Normal file
1
src/configs/composer-gh-auth-warn
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Composer %s has a known GitHub token parsing bug that exposes GitHub tokens in the error output. So, GitHub authentication has not been configured for this Composer version. Please update to the latest version of Composer. See: https://github.com/composer/composer/security/advisories/GHSA-f9f8-rm49-7jv2
|
||||||
@@ -21,4 +21,7 @@
|
|||||||
23.10,mantic
|
23.10,mantic
|
||||||
24.04,noble
|
24.04,noble
|
||||||
24.10,oracular
|
24.10,oracular
|
||||||
25.10,plucky
|
25.05,plucky
|
||||||
|
25.10,questing
|
||||||
|
26.04,resolute
|
||||||
|
26.10,stonking
|
||||||
|
|||||||
|
@@ -13,10 +13,10 @@ handle_dependency_extensions() {
|
|||||||
suffix="$(get_php_formula_suffix)"
|
suffix="$(get_php_formula_suffix)"
|
||||||
if [[ -n "$suffix" ]]; then
|
if [[ -n "$suffix" ]]; then
|
||||||
brew_opts=(-sf)
|
brew_opts=(-sf)
|
||||||
patch_abstract_file >/dev/null 2>&1
|
patch_abstract_file
|
||||||
for dependency_extension in "${dependency_extensions[@]}"; do
|
for dependency_extension in "${dependency_extensions[@]}"; do
|
||||||
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 &&
|
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" &&
|
||||||
brew link --overwrite --force "$dependency_extension@$version" >/dev/null 2>&1 &&
|
brew link --overwrite --force "$dependency_extension@$version" &&
|
||||||
copy_brew_extensions "$dependency_extension"
|
copy_brew_extensions "$dependency_extension"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -33,7 +33,7 @@ disable_extension_helper() {
|
|||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
sudo rm -rf "$scan_dir"/*"$extension"* /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get extension name from brew formula.
|
# Function to get extension name from brew formula.
|
||||||
@@ -83,13 +83,13 @@ add_brew_extension() {
|
|||||||
add_brew_tap "$php_tap"
|
add_brew_tap "$php_tap"
|
||||||
add_brew_tap "$ext_tap"
|
add_brew_tap "$ext_tap"
|
||||||
formula="$(get_renamed_formula "$formula")"
|
formula="$(get_renamed_formula "$formula")"
|
||||||
update_dependencies >/dev/null 2>&1
|
update_dependencies
|
||||||
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
handle_dependency_extensions "$formula" "$extension"
|
||||||
(
|
(
|
||||||
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 &&
|
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" &&
|
||||||
brew link --overwrite --force "$formula@$version" >/dev/null 2>&1 &&
|
brew link --overwrite --force "$formula@$version" &&
|
||||||
copy_brew_extensions "$formula"
|
copy_brew_extensions "$formula"
|
||||||
) || pecl_install "$extension" >/dev/null 2>&1
|
) || pecl_install "$extension"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ add_brew_extension() {
|
|||||||
patch_abstract_file() {
|
patch_abstract_file() {
|
||||||
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
abstract_path="$tap_dir"/"$ext_tap"/Abstract/abstract-php-extension.rb
|
||||||
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
if [[ -e "$abstract_path" && ! -e /tmp/abstract_patch ]]; then
|
||||||
echo '' | sudo tee /tmp/abstract_patch >/dev/null 2>&1
|
echo '' | sudo tee /tmp/abstract_patch
|
||||||
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
sudo sed -i '' -e "s|php@#{\(.*\)}|php@#{\1}$suffix|g" -e "s|php_version /|\"#{php_version}$suffix\" /|g" "$abstract_path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -108,9 +108,9 @@ add_extension_helper() {
|
|||||||
local extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
if [[ "$version" =~ ${old_versions:?} ]] && [ "$extension" = "imagick" ]; then
|
||||||
run_script "php5-darwin" "${version/./}" "$extension" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}" "$extension"
|
||||||
else
|
else
|
||||||
pecl_install "$extension" >/dev/null 2>&1 &&
|
pecl_install "$extension" &&
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
if [[ "$version" =~ ${old_versions:?} ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||||
fi
|
fi
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@@ -124,8 +124,8 @@ add_devtools() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
enable_extension xml extension >/dev/null 2>&1
|
enable_extension xml extension
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pear_version"
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ update_dependencies() {
|
|||||||
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
|
git_retry -C "$repo" fetch origin main && git -C "$repo" reset --hard origin/main
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
|
echo '' | sudo tee /tmp/update_dependencies
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ add_php_config() {
|
|||||||
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
if [[ "$ini" = "production" || "$ini" = "development" ]]; then
|
||||||
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
sudo cp "$ini_dir"/php.ini-"$ini" "$ini_dir"/php.ini
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ get_scan_dir() {
|
|||||||
|
|
||||||
# Function to handle self-hosted runner setup.
|
# Function to handle self-hosted runner setup.
|
||||||
self_hosted_helper() {
|
self_hosted_helper() {
|
||||||
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
sudo mkdir -p /opt/hostedtoolcache || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Setup PHP.
|
# Function to Setup PHP.
|
||||||
@@ -250,15 +250,15 @@ setup_php() {
|
|||||||
existing_version=$(get_brewed_php)
|
existing_version=$(get_brewed_php)
|
||||||
status="Found"
|
status="Found"
|
||||||
if [[ "$version" =~ ${old_versions:?} ]]; then
|
if [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
run_script "php5-darwin" "${version/./}"
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [ "${existing_version:0:3}" != "$version" ]; then
|
elif [ "${existing_version:0:3}" != "$version" ]; then
|
||||||
add_php "install" "$existing_version" >/dev/null 2>&1
|
add_php "install" "$existing_version"
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
|
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
|
||||||
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
|
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
|
||||||
if [ "$brew_php_version" != "$existing_version" ]; then
|
if [ "$brew_php_version" != "$existing_version" ]; then
|
||||||
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
add_php "upgrade" "$existing_version"
|
||||||
status="Upgraded"
|
status="Upgraded"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ enable_extension() {
|
|||||||
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
||||||
enable_extension_dependencies "$1" "$2"
|
enable_extension_dependencies "$1" "$2"
|
||||||
enable_cache_extension_dependencies "$1" "$2"
|
enable_cache_extension_dependencies "$1" "$2"
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod >/dev/null 2>&1; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && command -v phpenmod ; then
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "$pecl_file"
|
||||||
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
mod="${ini_dir:?}"/../mods-available/"$1".ini
|
||||||
if ! [ -e "$mod" ]; then
|
if ! [ -e "$mod" ]; then
|
||||||
@@ -59,7 +59,7 @@ enable_extension() {
|
|||||||
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
[ -n "$mod_priority_line" ] && priority=$(echo "$mod_priority_line" | cut -d'=' -f 2)
|
||||||
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
(echo "; priority=$priority"; echo "$2=${ext_dir:?}/$1.so") | sudo tee "$mod" >/dev/null
|
||||||
fi
|
fi
|
||||||
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
sudo phpenmod -v "$version" "$1"
|
||||||
else
|
else
|
||||||
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
||||||
fi
|
fi
|
||||||
@@ -71,7 +71,7 @@ enable_extensions() {
|
|||||||
local extensions=("$@")
|
local extensions=("$@")
|
||||||
to_wait=()
|
to_wait=()
|
||||||
for ext in "${extensions[@]}"; do
|
for ext in "${extensions[@]}"; do
|
||||||
enable_extension "$ext" extension >/dev/null 2>&1 &
|
enable_extension "$ext" extension &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
done
|
done
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
@@ -79,7 +79,7 @@ enable_extensions() {
|
|||||||
|
|
||||||
# Function to get a map of extensions and their dependent shared extensions.
|
# Function to get a map of extensions and their dependent shared extensions.
|
||||||
get_extension_map() {
|
get_extension_map() {
|
||||||
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig >/dev/null 2>&1
|
php -d'error_reporting=0' "${src:?}"/scripts/extensions/extension_map.php /tmp/map"$version".orig
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to enable extension dependencies which are also extensions.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
@@ -125,7 +125,7 @@ disable_extension() {
|
|||||||
disable_all_shared() {
|
disable_all_shared() {
|
||||||
get_extension_map
|
get_extension_map
|
||||||
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
sudo sed -i.orig -E -e "/^(zend_)?extension\s*=/d" "${ini_file[@]}" "$pecl_file" 2>/dev/null || true
|
||||||
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "${ini_dir:-$scan_dir}"/.. -name "*.ini" -not -path "*php.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
sudo find "$ext_dir" -name '*.so' -print0 | xargs -0 -n 1 basename -s .so | xargs -I{} touch /tmp/extdisabled/"$version"/{}
|
||||||
@@ -139,7 +139,7 @@ configure_pecl() {
|
|||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" channel-update "$script".php.net
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,8 +177,8 @@ get_pecl_version() {
|
|||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
local prefix=${2:-extension}
|
local prefix=${2:-extension}
|
||||||
add_pecl >/dev/null 2>&1
|
add_pecl
|
||||||
disable_extension_helper "${extension%-*}" >/dev/null 2>&1
|
disable_extension_helper "${extension%-*}"
|
||||||
# Compare version with 8.3 so it runs only on 8.4 and above
|
# Compare version with 8.3 so it runs only on 8.4 and above
|
||||||
# Install using the source interface as it allows for patching.
|
# Install using the source interface as it allows for patching.
|
||||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||||
@@ -191,11 +191,11 @@ pecl_install() {
|
|||||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
|
||||||
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
||||||
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
|
(( ${#libraries[@]} )) && add_libs "${libraries[@]}"
|
||||||
if [ "$version" = "5.3" ]; then
|
if [ "$version" = "5.3" ]; then
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f "$extension"
|
||||||
else
|
else
|
||||||
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension"
|
||||||
fi
|
fi
|
||||||
local exit_code=$?
|
local exit_code=$?
|
||||||
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
sudo pecl info "$extension" | grep -iq 'zend extension' && prefix=zend_extension
|
||||||
@@ -218,7 +218,7 @@ add_pecl_extension() {
|
|||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
||||||
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1)
|
pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" )
|
||||||
extension_version="$(php -r "echo phpversion('$extension');")"
|
extension_version="$(php -r "echo phpversion('$extension');")"
|
||||||
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
||||||
add_extension_log "$extension$extension_version" "Installed and enabled"
|
add_extension_log "$extension$extension_version" "Installed and enabled"
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ add_blackfire() {
|
|||||||
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so >/dev/null 2>&1
|
get -q -n "${ext_dir:?}/blackfire.so" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_"$arch_name"-php-"$no_dot_version".so
|
||||||
fi
|
fi
|
||||||
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
if [ -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
disable_extension xdebug >/dev/null 2>&1
|
disable_extension xdebug
|
||||||
disable_extension pcov >/dev/null 2>&1
|
disable_extension pcov
|
||||||
enable_extension blackfire extension
|
enable_extension blackfire extension
|
||||||
add_extension_log blackfire "$status"
|
add_extension_log blackfire "$status"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ add_couchbase() {
|
|||||||
ext=$(get_couchbase_version)
|
ext=$(get_couchbase_version)
|
||||||
fi
|
fi
|
||||||
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
if [[ "$ext" =~ couchbase-[2-3].+ ]]; then
|
||||||
add_couchbase_clibs "$ext" >/dev/null 2>&1
|
add_couchbase_clibs "$ext"
|
||||||
else
|
else
|
||||||
add_couchbase_cxxlibs >/dev/null 2>&1
|
add_couchbase_cxxlibs
|
||||||
fi
|
fi
|
||||||
enable_extension "couchbase" "extension"
|
enable_extension "couchbase" "extension"
|
||||||
if check_extension "couchbase"; then
|
if check_extension "couchbase"; then
|
||||||
@@ -72,9 +72,9 @@ add_couchbase() {
|
|||||||
n_proc="$(nproc)"
|
n_proc="$(nproc)"
|
||||||
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
export COUCHBASE_SUFFIX_OPTS="CMAKE_BUILD_TYPE=Release"
|
||||||
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
export CMAKE_BUILD_PARALLEL_LEVEL="$n_proc"
|
||||||
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
|
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl
|
||||||
else
|
else
|
||||||
pecl_install "${ext}" >/dev/null 2>&1
|
pecl_install "${ext}"
|
||||||
fi
|
fi
|
||||||
add_extension_log "couchbase" "Installed and enabled"
|
add_extension_log "couchbase" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
@@ -93,6 +93,6 @@ add_couchbase() {
|
|||||||
fi
|
fi
|
||||||
add_brew_extension couchbase extension
|
add_brew_extension couchbase extension
|
||||||
find "${brew_prefix:?}/lib" "${brew_prefix:?}/opt/couchbase@${version:?}" "${brew_prefix:?}/Cellar/couchbase@${version:?}" \
|
find "${brew_prefix:?}/lib" "${brew_prefix:?}/opt/couchbase@${version:?}" "${brew_prefix:?}/Cellar/couchbase@${version:?}" \
|
||||||
-name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \; >/dev/null 2>&1
|
-name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \;
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ add_cubrid_helper() {
|
|||||||
add_cubrid() {
|
add_cubrid() {
|
||||||
ext=$1
|
ext=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
add_cubrid_helper "$ext" >/dev/null 2>&1
|
add_cubrid_helper "$ext"
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ add_event() {
|
|||||||
add_log "${tick:?}" "event" "Enabled"
|
add_log "${tick:?}" "event" "Enabled"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
||||||
add_brew_extension event extension >/dev/null 2>&1
|
add_brew_extension event extension
|
||||||
else
|
else
|
||||||
add_event_helper "$ext" >/dev/null 2>&1
|
add_event_helper "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "event" "Installed and enabled"
|
add_extension_log "event" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ add_firebird() {
|
|||||||
else
|
else
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
if [[ "${version:?}" =~ 5.3|${php_builder_versions:?} ]]; then
|
if [[ "${version:?}" =~ 5.3|${php_builder_versions:?} ]]; then
|
||||||
add_firebird_helper /usr >/dev/null 2>&1
|
add_firebird_helper /usr
|
||||||
else
|
else
|
||||||
add_pdo_extension firebird >/dev/null 2>&1
|
add_pdo_extension firebird
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
add_brew_extension pdo_firebird extension >/dev/null 2>&1
|
add_brew_extension pdo_firebird extension
|
||||||
fi
|
fi
|
||||||
add_extension_log pdo_firebird "Installed and enabled"
|
add_extension_log pdo_firebird "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Helper function to add gearman extension.
|
# Helper function to add gearman extension.
|
||||||
add_gearman_helper() {
|
add_gearman_helper() {
|
||||||
install_packages libgearman-dev
|
|
||||||
enable_extension gearman extension
|
enable_extension gearman extension
|
||||||
if ! check_extension gearman; then
|
if ! check_extension gearman; then
|
||||||
status="Installed and enabled"
|
status="Installed and enabled"
|
||||||
|
install_packages libgearman-dev
|
||||||
if [[ "${version:?}" =~ 5.[3-6] ]]; then
|
if [[ "${version:?}" =~ 5.[3-6] ]]; then
|
||||||
pecl_install gearman-1.1.2
|
pecl_install gearman-1.1.2
|
||||||
elif [[ "${version:?}" =~ 7.0 ]]; then
|
elif [[ "${version:?}" =~ 7.0 ]]; then
|
||||||
@@ -19,7 +19,7 @@ add_gearman_helper() {
|
|||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [ "$(uname -s)" = 'Linux' ]; then
|
if [ "$(uname -s)" = 'Linux' ]; then
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper
|
||||||
add_extension_log "gearman" "$status"
|
add_extension_log "gearman" "$status"
|
||||||
else
|
else
|
||||||
add_brew_extension gearman extension
|
add_brew_extension gearman extension
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ add_geos() {
|
|||||||
if check_extension "geos"; then
|
if check_extension "geos"; then
|
||||||
add_log "${tick:?}" "geos" "Enabled"
|
add_log "${tick:?}" "geos" "Enabled"
|
||||||
else
|
else
|
||||||
add_geos_helper >/dev/null 2>&1
|
add_geos_helper
|
||||||
add_extension_log "geos" "Installed and enabled"
|
add_extension_log "geos" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ Function Repair-ICU() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Http() {
|
Function Add-Http() {
|
||||||
Add-Extension iconv >$null 2>&1
|
Add-Extension iconv
|
||||||
Add-Extension raphf >$null 2>&1
|
Add-Extension raphf
|
||||||
if($version -lt '8.0') {
|
if($version -lt '8.0') {
|
||||||
Add-Extension propro >$null 2>&1
|
Add-Extension propro
|
||||||
}
|
}
|
||||||
Add-Extension pecl_http >$null 2>&1
|
Add-Extension pecl_http
|
||||||
Repair-ICU
|
Repair-ICU
|
||||||
Add-ExtensionLog http "Installed and enabled"
|
Add-ExtensionLog http "Installed and enabled"
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ add_http_latest() {
|
|||||||
if [ "$os" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
add_http_dependencies
|
add_http_dependencies
|
||||||
package="php$version-http"
|
package="php$version-http"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
(check_package "$package" && install_packages "$package") || add_http_helper "$(get_http_version)" "$os"
|
||||||
else
|
else
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
@@ -103,9 +103,9 @@ add_http() {
|
|||||||
ext=$1
|
ext=$1
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
||||||
add_http_latest >/dev/null 2>&1
|
add_http_latest
|
||||||
else
|
else
|
||||||
add_http_version "$ext" >/dev/null 2>&1
|
add_http_version "$ext"
|
||||||
fi
|
fi
|
||||||
add_extension_log "http" "$status"
|
add_extension_log "http" "$status"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ add_cli_driver() {
|
|||||||
else
|
else
|
||||||
libs='/usr/local/lib'
|
libs='/usr/local/lib'
|
||||||
sudo mkdir -p "$libs"
|
sudo mkdir -p "$libs"
|
||||||
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" >/dev/null 2>&1 || true
|
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +93,11 @@ add_ibm() {
|
|||||||
status='Enabled'
|
status='Enabled'
|
||||||
ibm_home='/opt/ibm'
|
ibm_home='/opt/ibm'
|
||||||
ibm_cli=$ibm_home/clidriver
|
ibm_cli=$ibm_home/clidriver
|
||||||
if ! add_cli_driver >/dev/null 2>&1; then
|
if ! add_cli_driver ; then
|
||||||
add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
|
add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
add_ibm_helper >/dev/null 2>&1
|
add_ibm_helper
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ add_intl() {
|
|||||||
add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
|
add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
|
||||||
else
|
else
|
||||||
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
[ "${ts:?}" = 'zts' ] && suffix='-zts'
|
||||||
install_icu "$icu" >/dev/null 2>&1
|
install_icu "$icu"
|
||||||
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
|
get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
|
||||||
enable_extension intl extension
|
enable_extension intl extension
|
||||||
add_extension_log intl "Installed and enabled with ICU $icu"
|
add_extension_log intl "Installed and enabled with ICU $icu"
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ add_ioncube() {
|
|||||||
if [ -e "$loader_file" ]; then
|
if [ -e "$loader_file" ]; then
|
||||||
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
sudo mv /tmp/ioncube/ioncube_loader_"${os_suffix%%_*}_${version:?}$ts_part".so "${ext_dir:?}/ioncube.so"
|
||||||
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
sudo cp /tmp/ioncube/LICENSE.txt "$ext_dir"/IONCUBE_LICENSE.txt
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini"
|
||||||
fi
|
fi
|
||||||
add_extension_log "ioncube" "$status"
|
add_extension_log "ioncube" "$status"
|
||||||
check_extension "ioncube" && add_license_log
|
check_extension "ioncube" && add_license_log
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ Function Add-Oci() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
Add-ExtensionLog $extension $status
|
Add-ExtensionLog $extension $status
|
||||||
Add-LicenseLog
|
Add-LicenseLog
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ add_oci() {
|
|||||||
oracle_home='/opt/oracle'
|
oracle_home='/opt/oracle'
|
||||||
oracle_client=$oracle_home/instantclient
|
oracle_client=$oracle_home/instantclient
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
add_client >/dev/null 2>&1
|
add_client
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ Function Get-PhalconSemver() {
|
|||||||
return '4.1.0'
|
return '4.1.0'
|
||||||
} elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
|
} elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
|
||||||
return '5.4.0'
|
return '5.4.0'
|
||||||
|
} elseif (($extension_version -eq '5') -and ($version -eq '8.0')) {
|
||||||
|
return '5.10.0'
|
||||||
}
|
}
|
||||||
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ get_phalcon_version() {
|
|||||||
if [ "$extension" = "phalcon5" ]; then
|
if [ "$extension" = "phalcon5" ]; then
|
||||||
if [ "${version:?}" = "7.4" ]; then
|
if [ "${version:?}" = "7.4" ]; then
|
||||||
echo '5.4.0'
|
echo '5.4.0'
|
||||||
|
elif [ "${version:?}" = "8.0" ]; then
|
||||||
|
echo '5.10.0'
|
||||||
else
|
else
|
||||||
get_pecl_version phalcon stable 5
|
get_pecl_version phalcon stable 5
|
||||||
fi
|
fi
|
||||||
@@ -34,7 +36,7 @@ add_phalcon_helper() {
|
|||||||
add_brew_extension "$extension" extension
|
add_brew_extension "$extension" extension
|
||||||
else
|
else
|
||||||
package="php${version:?}-$extension"
|
package="php${version:?}-$extension"
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
[[ "$extension" =~ phalcon[4|5] ]] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
||||||
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
||||||
fi
|
fi
|
||||||
@@ -94,7 +96,7 @@ add_phalcon() {
|
|||||||
[ "$extension" = "phalcon" ] && extension=phalcon5
|
[ "$extension" = "phalcon" ] && extension=phalcon5
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
||||||
add_phalcon"$extension_major_version" >/dev/null 2>&1
|
add_phalcon"$extension_major_version"
|
||||||
fi
|
fi
|
||||||
add_extension_log "phalcon" "$status"
|
add_extension_log "phalcon" "$status"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,14 +145,14 @@ add_relay() {
|
|||||||
error="Relay extension is not available for macOS x86_64 architecture"
|
error="Relay extension is not available for macOS x86_64 architecture"
|
||||||
else
|
else
|
||||||
relay_version=$(get_relay_version "$ext")
|
relay_version=$(get_relay_version "$ext")
|
||||||
add_relay_dependencies >/dev/null 2>&1
|
add_relay_dependencies
|
||||||
if shared_extension relay; then
|
if shared_extension relay; then
|
||||||
message="Enabled"
|
message="Enabled"
|
||||||
else
|
else
|
||||||
add_relay_helper "$arch" >/dev/null 2>&1
|
add_relay_helper "$arch"
|
||||||
message="Installed and enabled ${relay_version}"
|
message="Installed and enabled ${relay_version}"
|
||||||
fi
|
fi
|
||||||
configure_relay >/dev/null 2>&1
|
configure_relay
|
||||||
fi
|
fi
|
||||||
add_extension_log relay "$message" "$error"
|
add_extension_log relay "$message" "$error"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ check_lib() {
|
|||||||
add_linux_libs() {
|
add_linux_libs() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
install_packages "$lib" >/dev/null 2>&1 || true
|
install_packages "$lib" || true
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
}
|
}
|
||||||
@@ -61,10 +61,10 @@ add_darwin_libs() {
|
|||||||
local lib=$1
|
local lib=$1
|
||||||
if ! check_lib "$lib"; then
|
if ! check_lib "$lib"; then
|
||||||
if [[ "$lib" = *@* ]]; then
|
if [[ "$lib" = *@* ]]; then
|
||||||
safe_brew install --skip-link "$lib" >/dev/null 2>&1 || true
|
safe_brew install --skip-link "$lib" || true
|
||||||
brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
|
brew link --overwrite --force "$lib" || true
|
||||||
else
|
else
|
||||||
safe_brew install "$lib" >/dev/null 2>&1 || true
|
safe_brew install "$lib" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
add_lib_log "$lib"
|
add_lib_log "$lib"
|
||||||
@@ -99,7 +99,7 @@ get_libraries() {
|
|||||||
run_group() {
|
run_group() {
|
||||||
local command=$1
|
local command=$1
|
||||||
local log=$2
|
local log=$2
|
||||||
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
echo "$command" | sudo tee ./run_group.sh
|
||||||
echo "$GROUP$log"
|
echo "$GROUP$log"
|
||||||
. ./run_group.sh
|
. ./run_group.sh
|
||||||
local status=$?
|
local status=$?
|
||||||
@@ -163,7 +163,7 @@ add_extension_from_source() {
|
|||||||
sub_dir="$(parse_args "$extension" PATH)"
|
sub_dir="$(parse_args "$extension" PATH)"
|
||||||
step_log "Setup $slug"
|
step_log "Setup $slug"
|
||||||
(
|
(
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
disable_extension_helper "$extension"
|
disable_extension_helper "$extension"
|
||||||
fetch_extension "$extension" "$fetch"
|
fetch_extension "$extension" "$fetch"
|
||||||
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
||||||
@@ -171,7 +171,7 @@ add_extension_from_source() {
|
|||||||
else
|
else
|
||||||
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
||||||
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
||||||
patch_extension "$extension" >/dev/null 2>&1
|
patch_extension "$extension"
|
||||||
run_group "phpize" "phpize" && \
|
run_group "phpize" "phpize" && \
|
||||||
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
|
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure" && \
|
||||||
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make" && \
|
run_group "sudo $prefix_opts make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make" && \
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ Function Add-Sqlsrv() {
|
|||||||
Add-ExtensionFromGithub $extension > $null 2>&1
|
Add-ExtensionFromGithub $extension > $null 2>&1
|
||||||
} catch {}
|
} catch {}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-SqlsrvFromMSGithub $extension >$null 2>&1
|
Add-SqlsrvFromMSGithub $extension
|
||||||
}
|
}
|
||||||
if (-not(Test-Extension $extension)) {
|
if (-not(Test-Extension $extension)) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ Function Add-ZephirParser() {
|
|||||||
try {
|
try {
|
||||||
Add-ZephirParserFromGitHub $extension
|
Add-ZephirParserFromGitHub $extension
|
||||||
} catch {
|
} catch {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Add-ExtensionLog zephir_parser $status
|
Add-ExtensionLog zephir_parser $status
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ add_zephir_parser() {
|
|||||||
zp_releases=https://github.com/"$repo"/releases
|
zp_releases=https://github.com/"$repo"/releases
|
||||||
if ! shared_extension zephir_parser; then
|
if ! shared_extension zephir_parser; then
|
||||||
message='Installed and enabled'
|
message='Installed and enabled'
|
||||||
add_zephir_parser_helper "$ext" >/dev/null 2>&1
|
add_zephir_parser_helper "$ext"
|
||||||
else
|
else
|
||||||
message='Enabled'
|
message='Enabled'
|
||||||
enable_extension zephir_parser extension
|
enable_extension zephir_parser extension
|
||||||
|
|||||||
@@ -20,23 +20,38 @@ self_hosted_helper() {
|
|||||||
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
sudo mkdir -p /opt/hostedtoolcache >/dev/null 2>&1 || true
|
sudo mkdir -p /opt/hostedtoolcache || true
|
||||||
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to fix broken packages.
|
# Function to fix broken packages.
|
||||||
fix_broken_packages() {
|
fix_broken_packages() {
|
||||||
sudo apt --fix-broken install >/dev/null 2>&1
|
sudo apt --fix-broken install
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to switch the Ubuntu apt mirror from Azure to the main Ubuntu archive.
|
||||||
|
switch_mirror() {
|
||||||
|
[ "${ID:-}" = "ubuntu" ] || return 0
|
||||||
|
if [ -f /etc/apt/apt-mirrors.txt ] && grep -Eq 'azure\.archive\.ubuntu\.com' /etc/apt/apt-mirrors.txt; then
|
||||||
|
sudo sed -i -E '/azure\.archive\.ubuntu\.com/d' /etc/apt/apt-mirrors.txt
|
||||||
|
sudo rm -f /tmp/os_lists
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a package
|
# Function to install a package
|
||||||
install_packages() {
|
install_packages() {
|
||||||
packages=("$@")
|
packages=("$@")
|
||||||
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
if ! [ -e /etc/dpkg/dpkg.cfg.d/force-confnew ]; then
|
||||||
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew >/dev/null 2>&1
|
echo "force-confnew" | sudo tee /etc/dpkg/dpkg.cfg.d/force-confnew
|
||||||
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
trap "sudo rm -f /etc/dpkg/dpkg.cfg.d/force-confnew 2>/dev/null" exit
|
||||||
fi
|
fi
|
||||||
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
if $apt_install "${packages[@]}" ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if update_lists && fix_broken_packages && $apt_install "${packages[@]}" ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
switch_mirror && update_lists && $apt_install "${packages[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable an extension.
|
# Function to disable an extension.
|
||||||
@@ -48,10 +63,10 @@ disable_extension_helper() {
|
|||||||
disable_extension_dependents "$extension"
|
disable_extension_dependents "$extension"
|
||||||
fi
|
fi
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?\"?$/d" "${ini_file[@]}" "$pecl_file"
|
||||||
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
sudo find "$ini_dir"/.. -name "*-$extension.ini" -not -path "*phar.ini" -not -path "*pecl.ini" -not -path "*mods-available*" -delete || true
|
||||||
sudo rm -f /tmp/php"$version"_extensions
|
sudo rm -f /tmp/php"$version"_extensions
|
||||||
mkdir -p /tmp/extdisabled/"$version"
|
mkdir -p /tmp/extdisabled/"$version"
|
||||||
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add PDO extension.
|
# Function to add PDO extension.
|
||||||
@@ -64,7 +79,7 @@ add_pdo_extension() {
|
|||||||
ext_name=$1
|
ext_name=$1
|
||||||
if shared_extension pdo; then
|
if shared_extension pdo; then
|
||||||
disable_extension_helper pdo
|
disable_extension_helper pdo
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}"
|
||||||
fi
|
fi
|
||||||
if [ "$ext" = "mysql" ]; then
|
if [ "$ext" = "mysql" ]; then
|
||||||
enable_extension "mysqlnd" "extension"
|
enable_extension "mysqlnd" "extension"
|
||||||
@@ -72,15 +87,15 @@ add_pdo_extension() {
|
|||||||
elif [ "$ext" = "dblib" ]; then
|
elif [ "$ext" = "dblib" ]; then
|
||||||
ext_name="sybase"
|
ext_name="sybase"
|
||||||
elif [ "$ext" = "firebird" ]; then
|
elif [ "$ext" = "firebird" ]; then
|
||||||
install_packages libfbclient2 >/dev/null 2>&1
|
install_packages libfbclient2
|
||||||
enable_extension "pdo_firebird" "extension"
|
enable_extension "pdo_firebird" "extension"
|
||||||
ext_name="interbase"
|
ext_name="interbase"
|
||||||
elif [ "$ext" = "sqlite" ]; then
|
elif [ "$ext" = "sqlite" ]; then
|
||||||
ext="sqlite3"
|
ext="sqlite3"
|
||||||
ext_name="sqlite3"
|
ext_name="sqlite3"
|
||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "extension"
|
||||||
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
add_extension "$pdo_ext" "extension"
|
||||||
add_extension_log "$pdo_ext" "Enabled"
|
add_extension_log "$pdo_ext" "Enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -94,7 +109,7 @@ check_package() {
|
|||||||
add_extension_helper() {
|
add_extension_helper() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
packages=(php"$version"-"$extension")
|
packages=(php"$version"-"$extension")
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
||||||
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
@@ -108,7 +123,7 @@ add_devtools() {
|
|||||||
install_packages "php$version-dev"
|
install_packages "php$version-dev"
|
||||||
fi
|
fi
|
||||||
switch_version "phpize" "php-config"
|
switch_version "phpize" "php-config"
|
||||||
add_extension xml extension >/dev/null 2>&1
|
add_extension xml extension
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +174,7 @@ register_alternative() {
|
|||||||
fi
|
fi
|
||||||
link="$(alternative_link "$tool")"
|
link="$(alternative_link "$tool")"
|
||||||
priority="${version//./}"
|
priority="${version//./}"
|
||||||
sudo update-alternatives --install "$link" "$tool" "$target" "$priority" >/dev/null 2>&1
|
sudo update-alternatives --install "$link" "$tool" "$target" "$priority"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to register and switch an alternative.
|
# Function to register and switch an alternative.
|
||||||
@@ -169,16 +184,16 @@ set_alternative() {
|
|||||||
target="$(alternative_target "$tool")"
|
target="$(alternative_target "$tool")"
|
||||||
[ -e "$target" ] || return 0
|
[ -e "$target" ] || return 0
|
||||||
register_alternative "$tool" || return 1
|
register_alternative "$tool" || return 1
|
||||||
sudo update-alternatives --set "$tool" "$target" >/dev/null 2>&1
|
sudo update-alternatives --set "$tool" "$target"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add PECL.
|
# Function to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools phpize >/dev/null 2>&1
|
add_devtools phpize
|
||||||
if ! command -v pecl >/dev/null; then
|
if ! command -v pecl >/dev/null; then
|
||||||
install_packages php-pear
|
install_packages php-pear
|
||||||
fi
|
fi
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl
|
||||||
pear_version=$(get_tool_version "pecl" "version")
|
pear_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
||||||
}
|
}
|
||||||
@@ -207,7 +222,7 @@ get_php_packages() {
|
|||||||
|
|
||||||
# Function to install packaged PHP
|
# Function to install packaged PHP
|
||||||
add_packaged_php() {
|
add_packaged_php() {
|
||||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
add_ppa ondrej/php || update_ppa ondrej/php
|
||||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||||
install_packages "${packages[@]}"
|
install_packages "${packages[@]}"
|
||||||
}
|
}
|
||||||
@@ -231,7 +246,7 @@ add_php() {
|
|||||||
setup_php_builder
|
setup_php_builder
|
||||||
else
|
else
|
||||||
add_packaged_php
|
add_packaged_php
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
add_pecl
|
add_pecl
|
||||||
fi
|
fi
|
||||||
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
@@ -244,7 +259,7 @@ add_php() {
|
|||||||
|
|
||||||
# Function to ini file for pear and link it to each SAPI.
|
# Function to ini file for pear and link it to each SAPI.
|
||||||
link_pecl_file() {
|
link_pecl_file() {
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file"
|
||||||
for file in "${ini_file[@]}"; do
|
for file in "${ini_file[@]}"; do
|
||||||
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
||||||
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
if [ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ]; then
|
||||||
@@ -277,9 +292,9 @@ add_php_config() {
|
|||||||
elif [ "$ini" = "development" ]; then
|
elif [ "$ini" = "development" ]; then
|
||||||
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
echo "${ini_file[@]}" | xargs -n 1 -P 6 sudo cp "$php_lib_dir"/php.ini-development
|
||||||
elif [ "$ini" = "none" ]; then
|
elif [ "$ini" = "none" ]; then
|
||||||
echo '' | sudo tee "${ini_file[@]}" >/dev/null 2>&1
|
echo '' | sudo tee "${ini_file[@]}"
|
||||||
fi
|
fi
|
||||||
echo "$ini" | sudo tee "$current_ini" >/dev/null 2>&1
|
echo "$ini" | sudo tee "$current_ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Setup PHP
|
# Function to Setup PHP
|
||||||
@@ -290,13 +305,13 @@ setup_php() {
|
|||||||
check_pre_installed
|
check_pre_installed
|
||||||
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
if [[ -z "$php_config" ]] || [ "$(php_semver | cut -c 1-3)" != "$version" ]; then
|
||||||
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
if [ ! -e "/usr/bin/php$version" ] || [ ! -e "/usr/bin/php-config$version" ]; then
|
||||||
add_php >/dev/null 2>&1
|
add_php
|
||||||
else
|
else
|
||||||
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
fi
|
fi
|
||||||
if [ "${update:?}" = "true" ]; then
|
if [ "${update:?}" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Switched to"
|
status="Switched to"
|
||||||
fi
|
fi
|
||||||
@@ -304,7 +319,7 @@ setup_php() {
|
|||||||
php_config="$(command -v php-config)"
|
php_config="$(command -v php-config)"
|
||||||
else
|
else
|
||||||
if [ "$update" = "true" ]; then
|
if [ "$update" = "true" ]; then
|
||||||
update_php >/dev/null 2>&1
|
update_php
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
@@ -324,7 +339,7 @@ setup_php() {
|
|||||||
link_pecl_file
|
link_pecl_file
|
||||||
configure_php
|
configure_php
|
||||||
set_output "php-version" "$semver"
|
set_output "php-version" "$semver"
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit
|
||||||
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
||||||
@@ -338,8 +353,8 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|||||||
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
||||||
scripts="$src"/scripts
|
scripts="$src"/scripts
|
||||||
|
|
||||||
add_sudo >/dev/null 2>&1
|
add_sudo
|
||||||
link_apt_fast >/dev/null 2>&1
|
link_apt_fast
|
||||||
|
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
# shellcheck source=.
|
# shellcheck source=.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ $composer_home = "$env:APPDATA\Composer"
|
|||||||
$composer_bin = "$composer_home\vendor\bin"
|
$composer_bin = "$composer_home\vendor\bin"
|
||||||
$composer_json = "$composer_home\composer.json"
|
$composer_json = "$composer_home\composer.json"
|
||||||
$composer_lock = "$composer_home\composer.lock"
|
$composer_lock = "$composer_home\composer.lock"
|
||||||
|
$skip_composer_github_auth = $false
|
||||||
|
|
||||||
# Function to configure composer.
|
# Function to configure composer.
|
||||||
Function Edit-ComposerConfig() {
|
Function Edit-ComposerConfig() {
|
||||||
@@ -23,6 +24,7 @@ Function Edit-ComposerConfig() {
|
|||||||
if (-not(Test-Path $composer_json)) {
|
if (-not(Test-Path $composer_json)) {
|
||||||
Set-Content -Path $composer_json -Value "{}"
|
Set-Content -Path $composer_json -Value "{}"
|
||||||
}
|
}
|
||||||
|
Get-ToolVersion "composer" $null | Out-Null
|
||||||
Set-ComposerEnv
|
Set-ComposerEnv
|
||||||
Add-Path $composer_bin
|
Add-Path $composer_bin
|
||||||
Set-ComposerAuth
|
Set-ComposerAuth
|
||||||
@@ -74,8 +76,18 @@ function Test-GitHubPublicAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function Write-ComposerGhAuthNoOpWarning() {
|
||||||
|
$message = (Get-Content (Join-Path $src 'configs\composer-gh-auth-warn') -Raw).Trim().Replace('%s', $composer_version)
|
||||||
|
if($env:fail_fast -eq 'true') {
|
||||||
|
Add-Log "$cross" "composer" $message
|
||||||
|
} else {
|
||||||
|
Write-Output "::warning::$message"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup authentication in composer.
|
# Function to setup authentication in composer.
|
||||||
Function Set-ComposerAuth() {
|
Function Set-ComposerAuth() {
|
||||||
|
$token = if ($env:COMPOSER_TOKEN) { $env:COMPOSER_TOKEN } else { $env:GITHUB_TOKEN }
|
||||||
if(Test-Path env:COMPOSER_AUTH_JSON) {
|
if(Test-Path env:COMPOSER_AUTH_JSON) {
|
||||||
if(Test-Json -JSON $env:COMPOSER_AUTH_JSON) {
|
if(Test-Json -JSON $env:COMPOSER_AUTH_JSON) {
|
||||||
Set-Content -Path $composer_home\auth.json -Value $env:COMPOSER_AUTH_JSON
|
Set-Content -Path $composer_home\auth.json -Value $env:COMPOSER_AUTH_JSON
|
||||||
@@ -83,13 +95,18 @@ Function Set-ComposerAuth() {
|
|||||||
Add-Log "$cross" "composer" "Could not parse COMPOSER_AUTH_JSON as valid JSON"
|
Add-Log "$cross" "composer" "Could not parse COMPOSER_AUTH_JSON as valid JSON"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($skip_composer_github_auth) {
|
||||||
|
Write-ComposerGhAuthNoOpWarning
|
||||||
|
}
|
||||||
$composer_auth = @()
|
$composer_auth = @()
|
||||||
if(Test-Path env:PACKAGIST_TOKEN) {
|
if(Test-Path env:PACKAGIST_TOKEN) {
|
||||||
$composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}'
|
$composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}'
|
||||||
}
|
}
|
||||||
$write_token = $true
|
$write_token = $true
|
||||||
$token = if ($env:COMPOSER_TOKEN) { $env:COMPOSER_TOKEN } else { $env:GITHUB_TOKEN }
|
|
||||||
if ($token) {
|
if ($token) {
|
||||||
|
if ($skip_composer_github_auth) {
|
||||||
|
$write_token = $false
|
||||||
|
}
|
||||||
if ($env:GITHUB_SERVER_URL -ne "https://github.com" -and -not(Test-GitHubPublicAccess $token)) {
|
if ($env:GITHUB_SERVER_URL -ne "https://github.com" -and -not(Test-GitHubPublicAccess $token)) {
|
||||||
$write_token = $false
|
$write_token = $false
|
||||||
}
|
}
|
||||||
@@ -183,7 +200,7 @@ Function Add-ToolsHelper() {
|
|||||||
$extensions += @('json', 'tokenizer')
|
$extensions += @('json', 'tokenizer')
|
||||||
} elseif($tool -eq "phpDocumentor") {
|
} elseif($tool -eq "phpDocumentor") {
|
||||||
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo
|
||||||
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
||||||
} elseif($tool -eq "phpunit") {
|
} elseif($tool -eq "phpunit") {
|
||||||
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
||||||
@@ -196,7 +213,7 @@ Function Add-ToolsHelper() {
|
|||||||
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
||||||
}
|
}
|
||||||
foreach($extension in $extensions) {
|
foreach($extension in $extensions) {
|
||||||
Add-Extension $extension >$null 2>&1
|
Add-Extension $extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +227,13 @@ Function Add-Tool() {
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
$tool,
|
$tool,
|
||||||
[Parameter(Position = 2, Mandatory = $false)]
|
[Parameter(Position = 2, Mandatory = $false)]
|
||||||
$ver_param
|
$ver_param,
|
||||||
|
[Parameter(Position = 3, Mandatory = $false)]
|
||||||
|
$skip_composer_github_auth
|
||||||
)
|
)
|
||||||
|
if($tool -eq "composer") {
|
||||||
|
$script:skip_composer_github_auth = $skip_composer_github_auth -eq 'true'
|
||||||
|
}
|
||||||
$urls = $urls -split ','
|
$urls = $urls -split ','
|
||||||
$tool_path = "$bin_dir\$tool"
|
$tool_path = "$bin_dir\$tool"
|
||||||
$is_exe = ((($urls[0] | Split-Path -Extension).ToLowerInvariant()) -eq '.exe')
|
$is_exe = ((($urls[0] | Split-Path -Extension).ToLowerInvariant()) -eq '.exe')
|
||||||
@@ -264,7 +286,7 @@ Function Add-Tool() {
|
|||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
||||||
Add-ToolsHelper $tool
|
Add-ToolsHelper $tool
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat"
|
||||||
$tool_version = Get-ToolVersion $tool $ver_param
|
$tool_version = Get-ToolVersion $tool $ver_param
|
||||||
Add-Log $tick $tool "Added $tool $tool_version"
|
Add-Log $tick $tool "Added $tool $tool_version"
|
||||||
} else {
|
} else {
|
||||||
@@ -302,9 +324,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
Remove-Item -Path $composer_lock -Force
|
Remove-Item -Path $composer_lock -Force
|
||||||
}
|
}
|
||||||
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer global require $prefix$release $composer_args >$null 2>&1
|
composer global require $prefix$release $composer_args
|
||||||
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
||||||
} else {
|
} else {
|
||||||
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
||||||
@@ -315,9 +337,9 @@ Function Add-ComposerToolHelper() {
|
|||||||
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
||||||
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
Set-Content -Path $scoped_dir\composer.json -Value "{}"
|
||||||
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||||
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true
|
||||||
}
|
}
|
||||||
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
|
composer require $prefix$release -d $unix_scoped_dir $composer_args
|
||||||
}
|
}
|
||||||
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
||||||
Add-Path $scoped_dir\vendor\bin
|
Add-Path $scoped_dir\vendor\bin
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export composer_home="$HOME/.composer"
|
|||||||
export composer_bin="$composer_home/vendor/bin"
|
export composer_bin="$composer_home/vendor/bin"
|
||||||
export composer_json="$composer_home/composer.json"
|
export composer_json="$composer_home/composer.json"
|
||||||
export composer_lock="$composer_home/composer.lock"
|
export composer_lock="$composer_home/composer.lock"
|
||||||
|
skip_composer_github_auth=false
|
||||||
|
|
||||||
# Function to extract tool version.
|
# Function to extract tool version.
|
||||||
get_tool_version() {
|
get_tool_version() {
|
||||||
@@ -41,6 +42,7 @@ configure_composer() {
|
|||||||
echo '{}' | tee "$composer_json" >/dev/null
|
echo '{}' | tee "$composer_json" >/dev/null
|
||||||
chmod 644 "$composer_json"
|
chmod 644 "$composer_json"
|
||||||
fi
|
fi
|
||||||
|
get_tool_version composer >/dev/null
|
||||||
set_composer_env
|
set_composer_env
|
||||||
add_path "$composer_bin"
|
add_path "$composer_bin"
|
||||||
set_composer_auth
|
set_composer_auth
|
||||||
@@ -67,25 +69,42 @@ update_auth_json() {
|
|||||||
|
|
||||||
# Function to check if public GitHub token authentication is possible.
|
# Function to check if public GitHub token authentication is possible.
|
||||||
can_access_public_github() {
|
can_access_public_github() {
|
||||||
curl --fail -s -H "Authorization: token $1" 'https://api.github.com/' >/dev/null 2>&1
|
curl --fail -s -H "Authorization: token $1" 'https://api.github.com/'
|
||||||
|
}
|
||||||
|
|
||||||
|
composer_gh_auth_no_op() {
|
||||||
|
local message
|
||||||
|
message="$(<"${src:?}"/configs/composer-gh-auth-warn)"
|
||||||
|
message="${message//%s/$composer_version}"
|
||||||
|
if [ "${fail_fast:-false}" = "true" ]; then
|
||||||
|
add_log "${cross:?}" "composer" "$message"
|
||||||
|
else
|
||||||
|
echo "::warning::$message"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup authentication in composer.
|
# Function to setup authentication in composer.
|
||||||
set_composer_auth() {
|
set_composer_auth() {
|
||||||
if [ -n "$COMPOSER_AUTH_JSON" ]; then
|
token="${COMPOSER_TOKEN:-$GITHUB_TOKEN}"
|
||||||
if php -r "json_decode('$COMPOSER_AUTH_JSON'); if(json_last_error() !== JSON_ERROR_NONE) { throw new Exception('invalid json'); }"; then
|
if [ -n "${COMPOSER_AUTH_JSON:-}" ]; then
|
||||||
echo "$COMPOSER_AUTH_JSON" | tee "$composer_home/auth.json" >/dev/null
|
if printf '%s' "$COMPOSER_AUTH_JSON" | jq -e . >/dev/null; then
|
||||||
|
printf '%s' "$COMPOSER_AUTH_JSON" | tee "$composer_home/auth.json" >/dev/null
|
||||||
else
|
else
|
||||||
add_log "${cross:?}" "composer" "Could not parse COMPOSER_AUTH_JSON as valid JSON"
|
add_log "${cross:?}" "composer" "Could not parse COMPOSER_AUTH_JSON as valid JSON"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ "$skip_composer_github_auth" = "true" ]; then
|
||||||
|
composer_gh_auth_no_op
|
||||||
|
fi
|
||||||
composer_auth=()
|
composer_auth=()
|
||||||
if [ -n "$PACKAGIST_TOKEN" ]; then
|
if [ -n "$PACKAGIST_TOKEN" ]; then
|
||||||
composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
|
composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
|
||||||
fi
|
fi
|
||||||
token="${COMPOSER_TOKEN:-$GITHUB_TOKEN}"
|
|
||||||
if [ -n "$token" ]; then
|
if [ -n "$token" ]; then
|
||||||
write_token=true
|
write_token=true
|
||||||
|
if [ "$skip_composer_github_auth" = "true" ]; then
|
||||||
|
write_token=false
|
||||||
|
fi
|
||||||
if [ "$GITHUB_SERVER_URL" != "https://github.com" ]; then
|
if [ "$GITHUB_SERVER_URL" != "https://github.com" ]; then
|
||||||
can_access_public_github "$token" || write_token=false
|
can_access_public_github "$token" || write_token=false
|
||||||
fi
|
fi
|
||||||
@@ -108,7 +127,7 @@ set_composer_env() {
|
|||||||
add_env_path "$composer_env"
|
add_env_path "$composer_env"
|
||||||
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
|
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
|
||||||
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
|
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
|
||||||
composer global config --no-plugins "allow-plugins.$plugin" true >/dev/null 2>&1
|
composer global config --no-plugins "allow-plugins.$plugin" true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -173,7 +192,7 @@ add_tools_helper() {
|
|||||||
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}" 2>/dev/null || true
|
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
for extension in "${extensions[@]}"; do
|
for extension in "${extensions[@]}"; do
|
||||||
add_extension "$extension" extension >/dev/null 2>&1
|
add_extension "$extension" extension
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,6 +201,9 @@ add_tool() {
|
|||||||
url=$1
|
url=$1
|
||||||
tool=$2
|
tool=$2
|
||||||
ver_param=$3
|
ver_param=$3
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
skip_composer_github_auth="${4:-false}"
|
||||||
|
fi
|
||||||
tool_path="$tool_path_dir/$tool"
|
tool_path="$tool_path_dir/$tool"
|
||||||
if ! [ -d "$tool_path_dir" ]; then
|
if ! [ -d "$tool_path_dir" ]; then
|
||||||
sudo mkdir -p "$tool_path_dir"
|
sudo mkdir -p "$tool_path_dir"
|
||||||
@@ -206,8 +228,8 @@ add_tool() {
|
|||||||
url[0]="${url[0]//releases\/latest\/download/releases/download/$(get -s -n "" "$(echo "${url[0]}" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "${url[0]}" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
url[0]="${url[0]//releases\/latest\/download/releases/download/$(get -s -n "" "$(echo "${url[0]}" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "${url[0]}" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
||||||
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" = "200" ] && [ "$use_cache" = "true" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
sudo cp -a "$tool_path" "$cache_path"
|
[ "$use_cache" = "true" ] && sudo cp -a "$tool_path" "$cache_path"
|
||||||
elif [ -f "$tool_path.bak" ]; then
|
elif [ -f "$tool_path.bak" ]; then
|
||||||
sudo mv "$tool_path.bak" "$tool_path"
|
sudo mv "$tool_path.bak" "$tool_path"
|
||||||
fi
|
fi
|
||||||
@@ -215,8 +237,8 @@ add_tool() {
|
|||||||
fi
|
fi
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
add_tools_helper "$tool"
|
add_tools_helper "$tool"
|
||||||
[ -L "$tool_cache_path_dir/$tool" ] || sudo ln -s "$tool_path" "$tool_cache_path_dir/$tool" 2>/dev/null || true
|
|
||||||
tool_version=$(get_tool_version "$tool" "$ver_param")
|
tool_version=$(get_tool_version "$tool" "$ver_param")
|
||||||
|
sudo ln -sfn "$tool_path" "$tool_cache_path_dir/$tool" 2>/dev/null || true
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $tool_version"
|
add_log "${tick:?}" "$tool" "Added $tool $tool_version"
|
||||||
else
|
else
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
@@ -240,22 +262,22 @@ add_composer_tool_helper() {
|
|||||||
enable_extensions curl mbstring openssl
|
enable_extensions curl mbstring openssl
|
||||||
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*"
|
||||||
if [ "$scope" = "global" ]; then
|
if [ "$scope" = "global" ]; then
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer global config --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
composer global require "$prefix$release" "$composer_args"
|
||||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
else
|
else
|
||||||
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
||||||
if ! [ -d "$scoped_dir" ]; then
|
if ! [ -d "$scoped_dir" ]; then
|
||||||
mkdir -p "$scoped_dir"
|
mkdir -p "$scoped_dir"
|
||||||
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
||||||
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||||
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true
|
||||||
fi
|
fi
|
||||||
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
composer require "$prefix$release" -d "$scoped_dir" "$composer_args"
|
||||||
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log
|
||||||
fi
|
fi
|
||||||
add_path "$scoped_dir"/vendor/bin
|
add_path "$scoped_dir"/vendor/bin
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ Function Add-Blackfire() {
|
|||||||
}
|
}
|
||||||
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\blackfire.zip
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
||||||
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
blackfire agent:config --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN
|
||||||
}
|
}
|
||||||
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
||||||
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
blackfire client:config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem
|
||||||
}
|
}
|
||||||
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ blackfire_config() {
|
|||||||
# Function to add blackfire cli.
|
# Function to add blackfire cli.
|
||||||
add_blackfire() {
|
add_blackfire() {
|
||||||
os="$(uname -s)"
|
os="$(uname -s)"
|
||||||
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
[ "$os" = "Linux" ] && add_blackfire_linux
|
||||||
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
[ "$os" = "Darwin" ] && add_blackfire_darwin
|
||||||
blackfire_config >/dev/null 2>&1
|
blackfire_config
|
||||||
tool_version=$(get_tool_version "blackfire" "version")
|
tool_version=$(get_tool_version "blackfire" "version")
|
||||||
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ add_brew_tap() {
|
|||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
else
|
else
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap"
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -59,12 +59,12 @@ terminate_process_tree() {
|
|||||||
local pid=$1
|
local pid=$1
|
||||||
local children child
|
local children child
|
||||||
children=$(pgrep -P "$pid" 2>/dev/null || true)
|
children=$(pgrep -P "$pid" 2>/dev/null || true)
|
||||||
kill -TERM "$pid" >/dev/null 2>&1 || true
|
kill -TERM "$pid" || true
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
terminate_process_tree "$child"
|
terminate_process_tree "$child"
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
kill -KILL "$pid" >/dev/null 2>&1 || true
|
kill -KILL "$pid" || true
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
terminate_process_tree "$child"
|
terminate_process_tree "$child"
|
||||||
done
|
done
|
||||||
@@ -113,7 +113,7 @@ run_with_inactivity_watchdog() {
|
|||||||
last_activity=$(get_file_mtime "$stdout_log")
|
last_activity=$(get_file_mtime "$stdout_log")
|
||||||
current_err_activity=$(get_file_mtime "$stderr_log")
|
current_err_activity=$(get_file_mtime "$stderr_log")
|
||||||
[ "$current_err_activity" -gt "$last_activity" ] && last_activity="$current_err_activity"
|
[ "$current_err_activity" -gt "$last_activity" ] && last_activity="$current_err_activity"
|
||||||
while kill -0 "$command_pid" >/dev/null 2>&1; do
|
while kill -0 "$command_pid" ; do
|
||||||
sleep "$poll_secs"
|
sleep "$poll_secs"
|
||||||
current_activity=$(get_file_mtime "$stdout_log")
|
current_activity=$(get_file_mtime "$stdout_log")
|
||||||
[ "$current_activity" -gt "$last_activity" ] && last_activity="$current_activity"
|
[ "$current_activity" -gt "$last_activity" ] && last_activity="$current_activity"
|
||||||
@@ -134,7 +134,7 @@ run_with_inactivity_watchdog() {
|
|||||||
exit_code=$?
|
exit_code=$?
|
||||||
wait "$stdout_reader_pid" 2>/dev/null || true
|
wait "$stdout_reader_pid" 2>/dev/null || true
|
||||||
wait "$stderr_reader_pid" 2>/dev/null || true
|
wait "$stderr_reader_pid" 2>/dev/null || true
|
||||||
kill "$monitor_pid" >/dev/null 2>&1 || true
|
kill "$monitor_pid" || true
|
||||||
wait "$monitor_pid" 2>/dev/null || true
|
wait "$monitor_pid" 2>/dev/null || true
|
||||||
|
|
||||||
if [ -e "$timeout_file" ]; then
|
if [ -e "$timeout_file" ]; then
|
||||||
@@ -178,7 +178,7 @@ add_brew() {
|
|||||||
brew_prefix="$(get_brew_prefix)"
|
brew_prefix="$(get_brew_prefix)"
|
||||||
if ! [ -d "$brew_prefix"/bin ]; then
|
if ! [ -d "$brew_prefix"/bin ]; then
|
||||||
step_log "Setup Brew"
|
step_log "Setup Brew"
|
||||||
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/main/install.sh" | bash -s >/dev/null 2>&1
|
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/main/install.sh" | bash -s
|
||||||
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
||||||
fi
|
fi
|
||||||
add_brew_bins_to_path "$brew_prefix"
|
add_brew_bins_to_path "$brew_prefix"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Function Add-Msys2() {
|
Function Add-Msys2() {
|
||||||
$msys_location = 'C:\msys64'
|
$msys_location = 'C:\msys64'
|
||||||
if (-not(Test-Path $msys_location)) {
|
if (-not(Test-Path $msys_location)) {
|
||||||
choco install msys2 -y >$null 2>&1
|
choco install msys2 -y
|
||||||
$msys_location = 'C:\tools\msys64'
|
$msys_location = 'C:\tools\msys64'
|
||||||
}
|
}
|
||||||
return $msys_location
|
return $msys_location
|
||||||
@@ -15,7 +15,7 @@ Function Add-GrpcPhpPlugin() {
|
|||||||
} else {
|
} else {
|
||||||
$grpc_package = 'mingw-w64-x86_64-grpc'
|
$grpc_package = 'mingw-w64-x86_64-grpc'
|
||||||
}
|
}
|
||||||
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package" >$null 2>&1
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm $grpc_package"
|
||||||
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
||||||
Add-Path $msys_location\mingw64\bin
|
Add-Path $msys_location\mingw64\bin
|
||||||
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ add_grpc_php_plugin_brew() {
|
|||||||
configure_brew
|
configure_brew
|
||||||
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
[ -e /usr/local/bin/protoc ] && sudo mv /usr/local/bin/protoc /tmp/protoc && sudo mv /usr/local/include/google /tmp
|
||||||
safe_brew install grpc
|
safe_brew install grpc
|
||||||
brew link --force --overwrite grpc >/dev/null 2>&1
|
brew link --force --overwrite grpc
|
||||||
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
[ -e /tmp/protoc ] && sudo mv /tmp/protoc /usr/local/bin/protoc && sudo mv /tmp/google /usr/local/include/
|
||||||
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
||||||
license_path="$(brew --prefix grpc)/LICENSE"
|
license_path="$(brew --prefix grpc)/LICENSE"
|
||||||
@@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|||||||
grpc_tag=$1
|
grpc_tag=$1
|
||||||
license_path=""
|
license_path=""
|
||||||
if [ "$grpc_tag" = "latest" ]; then
|
if [ "$grpc_tag" = "latest" ]; then
|
||||||
add_grpc_php_plugin_brew >/dev/null 2>&1
|
add_grpc_php_plugin_brew
|
||||||
else
|
else
|
||||||
add_grpc_php_plugin_compile >/dev/null 2>&1
|
add_grpc_php_plugin_compile
|
||||||
fi
|
fi
|
||||||
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ Function Add-Mago() {
|
|||||||
$arch_name = 'i686'
|
$arch_name = 'i686'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
|
$url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\mago.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\mago.zip
|
||||||
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force
|
||||||
Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
|
Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
|
||||||
Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
|
Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
|
||||||
Add-Log $tick "mago" "Added mago $mago_tag"
|
Add-Log $tick "mago" "Added mago $mago_tag"
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ add_mago() {
|
|||||||
sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
|
sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
|
||||||
sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
|
sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
|
||||||
sudo chmod +x /usr/local/bin/mago
|
sudo chmod +x /usr/local/bin/mago
|
||||||
) >/dev/null 2>&1
|
)
|
||||||
add_log "${tick:?}" "mago" "Added mago $mago_tag"
|
add_log "${tick:?}" "mago" "Added mago $mago_tag"
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ set_base_version() {
|
|||||||
else
|
else
|
||||||
set_base_version_codename
|
set_base_version_codename
|
||||||
set_base_version_id
|
set_base_version_id
|
||||||
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release >/dev/null 2>&1
|
printf "ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n" "$ID" "$VERSION_ID" "$VERSION_CODENAME" | tee /tmp/os-release
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +70,8 @@ update_lists() {
|
|||||||
list="$list_file"
|
list="$list_file"
|
||||||
fi
|
fi
|
||||||
if [ ! -e "$status_file" ]; then
|
if [ ! -e "$status_file" ]; then
|
||||||
update_lists_helper "$list" >/dev/null 2>&1
|
update_lists_helper "$list"
|
||||||
echo '' | tee "$status_file" >/dev/null 2>&1
|
echo '' | tee "$status_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ add_key() {
|
|||||||
key_urls+=("$ppa_sp/keys/$ppa.gpg")
|
key_urls+=("$ppa_sp/keys/$ppa.gpg")
|
||||||
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
[ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
|
||||||
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
|
||||||
sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
|
sudo gpg --batch --yes --dearmor "$key_file" && sudo mv "$key_file".gpg "$key_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ Architectures: $arch
|
|||||||
Signed-By: $key_file
|
Signed-By: $key_file
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list >/dev/null 2>&1
|
echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ Function Add-Protoc() {
|
|||||||
$arch_num = '32'
|
$arch_num = '32'
|
||||||
}
|
}
|
||||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||||
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
Get-File -Url $url -OutFile $bin_dir\protoc.zip
|
||||||
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force
|
||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ add_protoc() {
|
|||||||
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
|
get -q -n /tmp/protobuf.zip "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-$arch.zip"
|
||||||
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||||
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
||||||
) >/dev/null 2>&1
|
)
|
||||||
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
||||||
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/main/LICENSE
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ add_symfony() {
|
|||||||
if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
|
if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
|
||||||
add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
|
add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
|
||||||
else
|
else
|
||||||
add_symfony_helper "$symfony_tag" >/dev/null 2>&1
|
add_symfony_helper "$symfony_tag"
|
||||||
symfony_path="$(command -v symfony)"
|
symfony_path="$(command -v symfony)"
|
||||||
if [[ -n "$symfony_path" ]]; then
|
if [[ -n "$symfony_path" ]]; then
|
||||||
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ set_output() {
|
|||||||
name=$1
|
name=$1
|
||||||
value=$2
|
value=$2
|
||||||
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
||||||
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT" >/dev/null 2>&1
|
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ read_env() {
|
|||||||
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
||||||
if ! check_ppa ondrej/php; then
|
if ! check_ppa ondrej/php; then
|
||||||
update=true
|
update=true
|
||||||
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
|
echo '' | sudo tee /tmp/sp_update
|
||||||
elif [ -e /tmp/sp_update ]; then
|
elif [ -e /tmp/sp_update ]; then
|
||||||
update=true
|
update=true
|
||||||
fi
|
fi
|
||||||
@@ -94,7 +94,7 @@ acquire_lock() {
|
|||||||
else
|
else
|
||||||
if sudo test -f "$lock_path/pid"; then
|
if sudo test -f "$lock_path/pid"; then
|
||||||
lock_pid=$(sudo cat "$lock_path/pid")
|
lock_pid=$(sudo cat "$lock_path/pid")
|
||||||
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
|
if ! ps -p "$lock_pid" ; then
|
||||||
sudo rm -rf "$lock_path"
|
sudo rm -rf "$lock_path"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -178,7 +178,7 @@ add_path() {
|
|||||||
printf '%s\n%s' "$path_to_add" "$(grep -v "^${path_to_add}$" "$GITHUB_PATH" 2>/dev/null)" > "$GITHUB_PATH"
|
printf '%s\n%s' "$path_to_add" "$(grep -v "^${path_to_add}$" "$GITHUB_PATH" 2>/dev/null)" > "$GITHUB_PATH"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile" >/dev/null 2>&1
|
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
[[ ":$PATH:" == *":$path_to_add:"* ]] || export PATH="${PATH:+${PATH}:}$path_to_add"
|
[[ ":$PATH:" == *":$path_to_add:"* ]] || export PATH="${PATH:+${PATH}:}$path_to_add"
|
||||||
}
|
}
|
||||||
@@ -200,10 +200,10 @@ add_env() {
|
|||||||
env_name=$1
|
env_name=$1
|
||||||
env_value=$2
|
env_value=$2
|
||||||
if [[ -n "$GITHUB_ENV" ]]; then
|
if [[ -n "$GITHUB_ENV" ]]; then
|
||||||
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV" >/dev/null 2>&1
|
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
profile=$(get_shell_profile)
|
profile=$(get_shell_profile)
|
||||||
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile" >/dev/null 2>&1
|
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile"
|
||||||
fi
|
fi
|
||||||
export "$env_name"="$env_value"
|
export "$env_name"="$env_value"
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ self_hosted_setup() {
|
|||||||
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
self_hosted_helper >/dev/null 2>&1
|
self_hosted_helper
|
||||||
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
|
add_env RUNNER_TOOL_CACHE /opt/hostedtoolcache
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -252,8 +252,8 @@ configure_php() {
|
|||||||
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
|
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
|
||||||
jit_config_files=("$jit_ini")
|
jit_config_files=("$jit_ini")
|
||||||
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
||||||
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
|
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}"
|
||||||
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
|
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version in semver format.
|
# Function to get PHP version in semver format.
|
||||||
|
|||||||
@@ -203,16 +203,20 @@ Function Install-PSPackage() {
|
|||||||
$cmdlet
|
$cmdlet
|
||||||
)
|
)
|
||||||
$module_path = "$bin_dir\$psm1_path.psm1"
|
$module_path = "$bin_dir\$psm1_path.psm1"
|
||||||
|
$imported = $false
|
||||||
|
try {
|
||||||
if(-not (Test-Path $module_path -PathType Leaf)) {
|
if(-not (Test-Path $module_path -PathType Leaf)) {
|
||||||
$zip_file = "$bin_dir\$package.zip"
|
$zip_file = "$bin_dir\$package.zip"
|
||||||
Get-File -Url $url -OutFile $zip_file
|
Get-File -Url $url -OutFile $zip_file
|
||||||
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force -ErrorAction Stop
|
||||||
}
|
}
|
||||||
Import-Module $module_path
|
Import-Module $module_path -ErrorAction Stop
|
||||||
if($null -eq (Get-Command $cmdlet -ErrorAction SilentlyContinue)) {
|
$imported = $null -ne (Get-Command $cmdlet -ErrorAction SilentlyContinue)
|
||||||
Install-Module -Name $package -Force
|
} catch { }
|
||||||
} else {
|
if($imported) {
|
||||||
Add-ToProfile $current_profile "$package-search" "Import-Module $module_path"
|
Add-ToProfile $current_profile "$package-search" "Import-Module $module_path"
|
||||||
|
} else {
|
||||||
|
Install-Module -Name $package -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +360,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
$ext_dir = "$php_dir\ext"
|
$ext_dir = "$php_dir\ext"
|
||||||
Get-CleanPSProfile >$null 2>&1
|
Get-CleanPSProfile
|
||||||
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
New-Item $bin_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $bin_dir
|
Add-Path -PathItem $bin_dir
|
||||||
if($version -lt 5.6) {
|
if($version -lt 5.6) {
|
||||||
@@ -369,12 +373,12 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
}
|
}
|
||||||
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
New-Item $php_dir -Type Directory -Force > $null 2>&1
|
||||||
Add-Path -PathItem $php_dir
|
Add-Path -PathItem $php_dir
|
||||||
setx PHPROOT $php_dir >$null 2>&1
|
setx PHPROOT $php_dir
|
||||||
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
Add-Env -EnvName RUNNER_TOOL_CACHE -EnvValue $env:TEMP
|
||||||
} else {
|
} else {
|
||||||
$current_profile = "$PSHOME\Profile.ps1"
|
$current_profile = "$PSHOME\Profile.ps1"
|
||||||
if(-not(Test-Path -LiteralPath $current_profile)) {
|
if(-not(Test-Path -LiteralPath $current_profile)) {
|
||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force
|
||||||
}
|
}
|
||||||
Add-Path -PathItem $bin_dir -Force
|
Add-Path -PathItem $bin_dir -Force
|
||||||
}
|
}
|
||||||
@@ -383,9 +387,9 @@ $src = Join-Path -Path $PSScriptRoot -ChildPath \..
|
|||||||
. $src\scripts\tools\add_tools.ps1
|
. $src\scripts\tools\add_tools.ps1
|
||||||
. $src\scripts\extensions\add_extensions.ps1
|
. $src\scripts\extensions\add_extensions.ps1
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@@ -414,7 +418,7 @@ if($version -eq 'pre') {
|
|||||||
}
|
}
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($version -match $nightly_versions) {
|
if ($version -match $nightly_versions) {
|
||||||
@@ -427,7 +431,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
} catch { }
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir
|
||||||
$status = "Updated to"
|
$status = "Updated to"
|
||||||
} else {
|
} else {
|
||||||
$status = "Found"
|
$status = "Found"
|
||||||
@@ -445,7 +449,7 @@ if($installed.MajorMinorVersion -ne $version) {
|
|||||||
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ }
|
||||||
} elseif($version -lt "8.5") {
|
} elseif($version -lt "8.5") {
|
||||||
$enable_extensions += ('opcache')
|
$enable_extensions += ('opcache')
|
||||||
}
|
}
|
||||||
|
|||||||
45
src/tools.ts
45
src/tools.ts
@@ -95,6 +95,42 @@ interface DeployerManifestEntry {
|
|||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function skipGitHubAuthForComposerVersion(version: string): boolean {
|
||||||
|
if (!/^\d+\.\d+\.\d+(?:-[\w-]+)?$/.test(version)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return fs
|
||||||
|
.readFileSync(
|
||||||
|
path.join(__dirname, '../src/configs/composer-gh-auth-no-op'),
|
||||||
|
'utf8'
|
||||||
|
)
|
||||||
|
.trim()
|
||||||
|
.split(/\r?\n/)
|
||||||
|
.some(range => {
|
||||||
|
const [min, max] = range.trim().split(/\s+/);
|
||||||
|
return (
|
||||||
|
cv.compareVersions(version, min) >= 0 &&
|
||||||
|
cv.compareVersions(version, max) < 0
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cleanComposerAuthJson(): void {
|
||||||
|
try {
|
||||||
|
const auth_json = process.env['COMPOSER_AUTH_JSON'] || '';
|
||||||
|
if (!auth_json.includes('github-oauth')) return;
|
||||||
|
const auth = JSON.parse(auth_json);
|
||||||
|
delete auth['github-oauth'];
|
||||||
|
if (!Object.keys(auth).length) {
|
||||||
|
delete process.env['COMPOSER_AUTH_JSON'];
|
||||||
|
} else {
|
||||||
|
process.env['COMPOSER_AUTH_JSON'] = JSON.stringify(auth);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get version in semver format.
|
* Function to get version in semver format.
|
||||||
*
|
*
|
||||||
@@ -383,6 +419,7 @@ export async function addComposer(data: ToolData): Promise<string> {
|
|||||||
const version_source_url = `${getcomposer}/download/${channel}/composer.phar`;
|
const version_source_url = `${getcomposer}/download/${channel}/composer.phar`;
|
||||||
let cache_url = `${releases_url},${spc_url},${cds_url}`;
|
let cache_url = `${releases_url},${spc_url},${cds_url}`;
|
||||||
let source_url = `${getcomposer}/composer.phar`;
|
let source_url = `${getcomposer}/composer.phar`;
|
||||||
|
let skip_composer_github_auth = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^snapshot$/.test(channel):
|
case /^snapshot$/.test(channel):
|
||||||
source_url = is_lts ? lts_url : source_url;
|
source_url = is_lts ? lts_url : source_url;
|
||||||
@@ -393,7 +430,11 @@ export async function addComposer(data: ToolData): Promise<string> {
|
|||||||
case /^1$/.test(channel):
|
case /^1$/.test(channel):
|
||||||
source_url = channel_source_url;
|
source_url = channel_source_url;
|
||||||
break;
|
break;
|
||||||
case /^\d+\.\d+\.\d+[\w-]*$/.test(data.version):
|
case /^\d+\.\d+\.\d+(?:-[\w-]+)?$/.test(data.version):
|
||||||
|
if (skipGitHubAuthForComposerVersion(data.version)) {
|
||||||
|
cleanComposerAuthJson();
|
||||||
|
skip_composer_github_auth = ' true';
|
||||||
|
}
|
||||||
cache_url = `${github}/${data.repository}/releases/download/${data.version}/composer.phar`;
|
cache_url = `${github}/${data.repository}/releases/download/${data.version}/composer.phar`;
|
||||||
source_url = version_source_url;
|
source_url = version_source_url;
|
||||||
break;
|
break;
|
||||||
@@ -402,7 +443,7 @@ export async function addComposer(data: ToolData): Promise<string> {
|
|||||||
}
|
}
|
||||||
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
||||||
data.url = use_cache ? `${cache_url},${source_url}` : source_url;
|
data.url = use_cache ? `${cache_url},${source_url}` : source_url;
|
||||||
data.version_parameter = data.version;
|
data.version_parameter = data.version + skip_composer_github_auth;
|
||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,11 +224,11 @@ export async function extensionArray(
|
|||||||
.split(',')
|
.split(',')
|
||||||
|
|
||||||
.map(function (extension: string) {
|
.map(function (extension: string) {
|
||||||
|
extension = extension.trim().replace(/^\\\s*/, '');
|
||||||
if (/.+-.+\/.+@.+/.test(extension)) {
|
if (/.+-.+\/.+@.+/.test(extension)) {
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^(:)?(php[-_]|none|zend )|(-[^-]*)-/, '$1$3');
|
.replace(/^(:)?(php[-_]|none|zend )|(-[^-]*)-/, '$1$3');
|
||||||
})
|
})
|
||||||
@@ -284,10 +284,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
|
|||||||
export async function suppressOutput(os: string): Promise<string> {
|
export async function suppressOutput(os: string): Promise<string> {
|
||||||
switch (os) {
|
switch (os) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log('Platform ' + os + ' is not supported', os, 'error');
|
return await log('Platform ' + os + ' is not supported', os, 'error');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user