setup-php 2.34.1 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -229,7 +229,7 @@ This disables all core and third-party shared extensions and thus, can break som
229
229
 
230
230
  These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
231
231
 
232
- [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
232
+ [`backward-compatibility-check`], [`behat`], [`blackfire`], [`blackfire-player`], [`box`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-dependency-analyser`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`ecs`], [`flex`], [`grpc_php_plugin`], [`infection`], [`mago`], [`name-collision-detector`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`php-scoper`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pie`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
233
233
 
234
234
  ```yaml
235
235
  - name: Setup PHP with tools
@@ -258,19 +258,6 @@ These tools can be set up globally using the `tools` input. It accepts a string
258
258
 
259
259
  When you specify just the major version or the version in `major.minor` format, the latest patch version matching the input will be setup.
260
260
 
261
- With the exception of major versions of `composer`, if you specify only the `major` version or the version in `major.minor` format for a tool you can get rate limited by GitHub's API. To avoid this, it is recommended to provide a [`GitHub` OAuth token](https://github.com/shivammathur/setup-php#composer-github-oauth "Composer GitHub OAuth").
262
- You can do that by setting `GITHUB_TOKEN` environment variable. The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
263
-
264
- ```yaml
265
- - name: Setup PHP with tools
266
- uses: shivammathur/setup-php@v2
267
- with:
268
- php-version: '8.4'
269
- tools: php-cs-fixer:3.64, phpunit:11.4
270
- env:
271
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
272
- ```
273
-
274
261
  - The latest stable version of `composer` is set up by default. You can set up the required `composer` version by specifying the major version `v1` or `v2`, or the version in `major.minor` or `semver` format. Additionally, for composer `snapshot` and `preview` can also be specified to set up the respective releases.
275
262
 
276
263
  ```yaml
@@ -278,7 +265,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
278
265
  uses: shivammathur/setup-php@v2
279
266
  with:
280
267
  php-version: '8.4'
281
- tools: composer:v2
268
+ tools: composer:v1
282
269
  ```
283
270
 
284
271
  - If you do not use composer in your workflow, you can specify `tools: none` to skip it.
@@ -430,7 +417,7 @@ Disable coverage for these reasons:
430
417
  - The `php-version-file` input if it exists
431
418
  - A `composer.lock` file and the `platform-overrides.php` value
432
419
  - A `composer.json` file and the `config.platform.php` value
433
- - If the `composer.lock` or `composer.json` file is in a sub-directory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
420
+ - If the `composer.lock` or `composer.json` file is in a subdirectory in your repository, please specify the subdirectory path in `COMPOSER_PROJECT_DIR` env.
434
421
 
435
422
  #### `php-version-file` (optional)
436
423
 
@@ -438,7 +425,7 @@ Disable coverage for these reasons:
438
425
  - Accepts a `string`. For example `'.phpenv-version'`.
439
426
  - See [PHP support](#tada-php-support) for the supported PHP versions.
440
427
  - By default, `.php-version` file is used.
441
- - The file either have the PHP version as its content, or follow the asdf `.tool-versions` format.
428
+ - The file needs to either have the PHP version as its content or follows the asdf `.tool-versions` format.
442
429
  - If not specified and the default `.php-version` file is not found, the latest stable PHP version is set up.
443
430
 
444
431
  #### `extensions` (optional)
@@ -473,6 +460,12 @@ Disable coverage for these reasons:
473
460
  - Accepts a `string` in csv-format. For example: `phpunit, phpcs`
474
461
  - See [tools support](#wrench-tools-support) for tools supported.
475
462
 
463
+ #### `github-token` (optional)
464
+
465
+ - Specify the GitHub token to use for authentication.
466
+ - Accepts a `string`.
467
+ - By default, `GITHUB_TOKEN` secret provided by GitHub Actions is used.
468
+
476
469
  ### Outputs
477
470
 
478
471
  #### `php-version`
@@ -561,8 +554,6 @@ jobs:
561
554
  ini-values: post_max_size=256M, max_execution_time=180
562
555
  coverage: xdebug
563
556
  tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
564
- env:
565
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
566
557
  ```
567
558
 
568
559
  ### Nightly Build Setup
@@ -804,17 +795,16 @@ restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
804
795
 
805
796
  ### GitHub Composer Authentication
806
797
 
807
- If you have a number of workflows which set up multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. Also, if you specify only the major version or the version in `major.minor` format, you can hit the rate limit. To avoid this you can specify an `OAuth` token by setting `GITHUB_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
798
+ By default, setup-php uses the `GITHUB_TOKEN` secret that is generated for each workflow run. In case you want to use a Personal Access Token (PAT) instead, you can set the `github-token` input.
808
799
 
809
- The `COMPOSER_TOKEN` environment variable has been deprecated in favor of `GITHUB_TOKEN` and will be removed in the next major version.
800
+ The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecated in favor of the `github-token` input and will be removed in the next major version.
810
801
 
811
802
  ```yaml
812
803
  - name: Setup PHP
813
804
  uses: shivammathur/setup-php@v2
814
805
  with:
815
806
  php-version: '8.4'
816
- env:
817
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
807
+ github-token: ${{ secrets.YOUR_PAT_TOKEN }}
818
808
  ```
819
809
 
820
810
  ### Private Packagist Authentication
@@ -1015,19 +1005,26 @@ Many users and organisations support setup-php via [GitHub Sponsors](https://git
1015
1005
  These companies generously provide setup-php their products and services to aid in the development of this project.
1016
1006
 
1017
1007
  <p>
1018
- <a href="https://www.jetbrains.com/?from=setup-php">
1019
- <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="212" height="120">
1008
+ <a target="_blank" href="https://www.jetbrains.com/?from=setup-php">
1009
+ <img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="140" height="80">
1010
+ </a>
1011
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1012
+ <a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-light-mode-only">
1013
+ <img src="https://setup-php.com/sponsors/cloudflare.svg" alt="Cloudflare" width="240" height="80">
1014
+ </a>
1015
+ <a target="_blank" href="https://www.cloudflare.com/lp/project-alexandria/#gh-dark-mode-only">
1016
+ <img src="https://setup-php.com/sponsors/cloudflare-white.svg" alt="Cloudflare" width="240" height="80">
1020
1017
  </a>
1021
1018
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1022
- <a href="https://www.macstadium.com/opensource/members#gh-light-mode-only">
1023
- <img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="296" height="120">
1019
+ <a target="_blank" href="https://www.macstadium.com/company/opensource#gh-light-mode-only">
1020
+ <img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200" height="80">
1024
1021
  </a>
1025
- <a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only">
1026
- <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="296" height="120">
1022
+ <a target="_blank" href="https://www.macstadium.com/company/opensource#gh-dark-mode-only">
1023
+ <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200" height="80">
1027
1024
  </a>
1028
1025
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1029
- <a href="https://tidelift.com/subscription/pkg/npm-setup-php">
1030
- <img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="140" height="120">
1026
+ <a target="_blank" href="#">
1027
+ <img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="94" height="80">
1031
1028
  </a>
1032
1029
  </p>
1033
1030
 
@@ -1056,6 +1053,7 @@ These companies generously provide setup-php their products and services to aid
1056
1053
 
1057
1054
 
1058
1055
  <!-- Links to tools -->
1056
+ [`backward-compatibility-check`]: https://github.com/Roave/BackwardCompatibilityCheck
1059
1057
  [`behat`]: https://docs.behat.org/en/latest/
1060
1058
  [`blackfire`]: https://blackfire.io/docs/php/index
1061
1059
  [`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
@@ -1075,6 +1073,8 @@ These companies generously provide setup-php their products and services to aid
1075
1073
  [`flex`]: https://flex.symfony.com/
1076
1074
  [`grpc_php_plugin`]: https://grpc.io/
1077
1075
  [`infection`]: https://infection.github.io/
1076
+ [`mago`]: https://github.com/carthage-software/mago
1077
+ [`name-collision-detector`]: https://github.com/shipmonk/name-collision-detector
1078
1078
  [`parallel-lint`]: https://github.com/php-parallel-lint/PHP-Parallel-Lint
1079
1079
  [`pecl`]: https://pecl.php.net/
1080
1080
  [`phan`]: https://github.com/phan/phan/wiki
package/lib/install.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function getScript(os: string): Promise<string>;
2
+ export declare function setEnv(): Promise<void>;
2
3
  export declare function run(): Promise<void>;
package/lib/install.js CHANGED
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getScript = getScript;
40
+ exports.setEnv = setEnv;
40
41
  exports.run = run;
41
42
  const path_1 = __importDefault(require("path"));
42
43
  const fs_1 = __importDefault(require("fs"));
@@ -52,7 +53,6 @@ async function getScript(os) {
52
53
  const filename = os + (await utils.scriptExtension(os));
53
54
  const script_path = path_1.default.join(__dirname, '../src/scripts', filename);
54
55
  const run_path = script_path.replace(os, 'run');
55
- process.env['fail_fast'] = await utils.getInput('fail-fast', false);
56
56
  const extension_csv = await utils.getInput('extensions', false);
57
57
  const ini_values_csv = await utils.getInput('ini-values', false);
58
58
  const coverage_driver = await utils.getInput('coverage', false);
@@ -75,10 +75,15 @@ async function getScript(os) {
75
75
  fs_1.default.writeFileSync(run_path, script, { mode: 0o755 });
76
76
  return run_path;
77
77
  }
78
+ async function setEnv() {
79
+ process.env['fail_fast'] = await utils.getInput('fail-fast', false);
80
+ process.env['GITHUB_TOKEN'] ??= await utils.getInput('github-token', false);
81
+ }
78
82
  async function run() {
79
83
  const os = process.platform;
80
84
  const tool = await utils.scriptTool(os);
81
85
  const run_path = await getScript(os);
86
+ await setEnv();
82
87
  await (0, exec_1.exec)(tool + run_path);
83
88
  }
84
89
  (async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,8BAiCC;AAKD,kBAKC;AA1DD,gDAAwB;AACxB,4CAAoB;AAC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CAAC,CAAC;AAC9E,CAAC;AAKM,KAAK,UAAU,GAAG;IACvB,MAAM,EAAE,GAAW,OAAO,CAAC,QAAQ,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,MAAM,EAAE,CAAC;IACf,MAAM,IAAA,WAAI,EAAC,IAAI,GAAG,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAGD,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,GAAG,EAAE,CAAC;AACd,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-php",
3
- "version": "2.34.1",
3
+ "version": "2.35.0",
4
4
  "private": false,
5
5
  "description": "Setup PHP for use with GitHub Actions",
6
6
  "main": "lib/install.js",
@@ -40,27 +40,30 @@
40
40
  "compare-versions": "^6.1.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@eslint/compat": "^1.3.0",
44
- "@eslint/js": "9.28.0",
45
- "@types/jest": "^29.5.14",
46
- "@types/node": "^24.0.1",
47
- "@typescript-eslint/eslint-plugin": "^8.34.0",
48
- "@typescript-eslint/parser": "^8.34.0",
43
+ "@eslint/compat": "^1.3.1",
44
+ "@eslint/js": "9.32.0",
45
+ "@types/jest": "^30.0.0",
46
+ "@types/node": "^24.1.0",
47
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
48
+ "@typescript-eslint/parser": "^8.38.0",
49
49
  "@vercel/ncc": "^0.38.3",
50
- "eslint": "9.28.0",
51
- "eslint-config-prettier": "^10.1.5",
52
- "eslint-plugin-import": "^2.31.0",
53
- "eslint-plugin-jest": "^28.13.3",
54
- "eslint-plugin-prettier": "^5.4.1",
55
- "globals": "^16.2.0",
56
- "jest": "^30.0.0",
57
- "jest-circus": "^30.0.0",
58
- "nock": "^14.0.5",
59
- "prettier": "^3.5.3",
50
+ "eslint": "9.32.0",
51
+ "eslint-config-prettier": "^10.1.8",
52
+ "eslint-plugin-import": "^2.32.0",
53
+ "eslint-plugin-jest": "^29.0.1",
54
+ "eslint-plugin-prettier": "^5.5.3",
55
+ "globals": "^16.3.0",
56
+ "jest": "^30.0.5",
57
+ "jest-circus": "^30.0.5",
58
+ "nock": "^14.0.7",
59
+ "prettier": "^3.6.2",
60
60
  "simple-git-hooks": "^2.13.0",
61
61
  "ts-jest": "^29.4.0",
62
62
  "typescript": "^5.8.3"
63
63
  },
64
+ "overrides": {
65
+ "test-exclude": "^7.0.1"
66
+ },
64
67
  "bugs": {
65
68
  "url": "https://github.com/shivammathur/setup-php/issues"
66
69
  },
@@ -1,4 +1,9 @@
1
1
  {
2
+ "backward-compatibility-check": {
3
+ "type": "composer",
4
+ "repository": "roave/backward-compatibility-check",
5
+ "scope": "scoped"
6
+ },
2
7
  "box": {
3
8
  "type": "phar",
4
9
  "repository": "box-project/box",
@@ -45,6 +50,12 @@
45
50
  "version_prefix": "",
46
51
  "version_parameter": "-V"
47
52
  },
53
+ "easy-coding-standard": {
54
+ "type": "composer",
55
+ "alias": "ecs",
56
+ "repository": "symplify/easy-coding-standard",
57
+ "scope": "scoped"
58
+ },
48
59
  "infection": {
49
60
  "type": "phar",
50
61
  "repository": "infection/infection",
@@ -53,6 +64,11 @@
53
64
  "version_prefix": "",
54
65
  "version_parameter": "-V"
55
66
  },
67
+ "name-collision-detector": {
68
+ "type": "composer",
69
+ "repository": "shipmonk/name-collision-detector",
70
+ "scope": "scoped"
71
+ },
56
72
  "phan": {
57
73
  "type": "phar",
58
74
  "repository": "phan/phan",
@@ -233,6 +249,12 @@
233
249
  "domain": "https://github.com",
234
250
  "version_prefix": "v"
235
251
  },
252
+ "mago": {
253
+ "type": "custom-package",
254
+ "repository": "carthage-software/mago",
255
+ "domain": "https://github.com",
256
+ "version_prefix": ""
257
+ },
236
258
  "protoc": {
237
259
  "type": "custom-package",
238
260
  "repository": "protocolbuffers/protobuf",
@@ -331,11 +353,5 @@
331
353
  "extension": ".phar",
332
354
  "version_parameter": "--version",
333
355
  "version_prefix": "v"
334
- },
335
- "easy-coding-standard": {
336
- "type": "composer",
337
- "alias": "ecs",
338
- "repository": "symplify/easy-coding-standard",
339
- "scope": "scoped"
340
356
  }
341
357
  }
package/src/install.ts CHANGED
@@ -18,7 +18,6 @@ export async function getScript(os: string): Promise<string> {
18
18
  const filename = os + (await utils.scriptExtension(os));
19
19
  const script_path = path.join(__dirname, '../src/scripts', filename);
20
20
  const run_path = script_path.replace(os, 'run');
21
- process.env['fail_fast'] = await utils.getInput('fail-fast', false);
22
21
  const extension_csv: string = await utils.getInput('extensions', false);
23
22
  const ini_values_csv: string = await utils.getInput('ini-values', false);
24
23
  const coverage_driver: string = await utils.getInput('coverage', false);
@@ -48,6 +47,14 @@ export async function getScript(os: string): Promise<string> {
48
47
  return run_path;
49
48
  }
50
49
 
50
+ /**
51
+ * Function to set environment variables based on inputs.
52
+ */
53
+ export async function setEnv(): Promise<void> {
54
+ process.env['fail_fast'] = await utils.getInput('fail-fast', false);
55
+ process.env['GITHUB_TOKEN'] ??= await utils.getInput('github-token', false);
56
+ }
57
+
51
58
  /**
52
59
  * Run the script
53
60
  */
@@ -55,6 +62,7 @@ export async function run(): Promise<void> {
55
62
  const os: string = process.platform;
56
63
  const tool = await utils.scriptTool(os);
57
64
  const run_path = await getScript(os);
65
+ await setEnv();
58
66
  await exec(tool + run_path);
59
67
  }
60
68
 
@@ -216,7 +216,7 @@ add_pecl_extension() {
216
216
  add_log "${tick:?}" "$extension" "Enabled"
217
217
  else
218
218
  [ -n "$pecl_version" ] && pecl_version="-$pecl_version"
219
- pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
219
+ pecl_install "$extension$pecl_version" || ( [ "${fail_fast:?}" = "false" ] && add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1)
220
220
  extension_version="$(php -r "echo phpversion('$extension');")"
221
221
  [ -n "$extension_version" ] && extension_version="-$extension_version"
222
222
  add_extension_log "$extension$extension_version" "Installed and enabled"
@@ -7,15 +7,6 @@ add_license_log() {
7
7
  echo "$END_GROUP"
8
8
  }
9
9
 
10
- # Function to setup gcc-7 and g++-7
11
- setup_compiler() {
12
- if ! command -v gcc-7 >/dev/null || ! command -v g++-7 >/dev/null; then
13
- add_ppa ubuntu-toolchain-r/test
14
- add_packages gcc-7 g++-7 -y
15
- fi
16
- printf "gcc g++" | xargs -d ' ' -I {} sudo update-alternatives --install /usr/bin/{} {} /usr/bin/{}-7 7
17
- }
18
-
19
10
  # Function to set cubrid repo for the extension.
20
11
  set_cubrid_repo() {
21
12
  case "${ext:?}" in
@@ -1,6 +1,5 @@
1
1
  # Helper function to add gearman extension.
2
2
  add_gearman_helper() {
3
- add_ppa ondrej/pkg-gearman
4
3
  install_packages libgearman-dev
5
4
  enable_extension gearman extension
6
5
  if ! check_extension gearman; then
@@ -0,0 +1,36 @@
1
+ Function Get-MagoTag() {
2
+ $releases = 'https://github.com/carthage-software/mago/releases'
3
+ if("$mago_tag" -eq "latest") {
4
+ $mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
5
+ } else {
6
+ try {
7
+ [net.httpWebRequest] $request = [net.webRequest]::create("$releases/tag/$mago_tag")
8
+ $request.Method = "HEAD"
9
+ [net.httpWebResponse] $response = $request.getResponse()
10
+ $response.Close()
11
+ $mago_tag = "$mago_tag"
12
+ } catch {
13
+ $mago_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
14
+ }
15
+ }
16
+ return $mago_tag
17
+ }
18
+
19
+ Function Add-Mago() {
20
+ param(
21
+ [Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The mago version to be installed')]
22
+ [ValidatePattern('^latest$|^\d+\.\d+\.\d+$')]
23
+ [string] $mago_tag
24
+ )
25
+ $mago_tag = Get-MagoTag
26
+ $arch_name = 'x86_64'
27
+ if(-not([Environment]::Is64BitOperatingSystem)) {
28
+ $arch_name = 'i686'
29
+ }
30
+ $url = "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch_name-pc-windows-msvc.zip"
31
+ Get-File -Url $url -OutFile $bin_dir\mago.zip >$null 2>&1
32
+ Expand-Archive -Path $bin_dir\mago.zip -DestinationPath $bin_dir\mago -Force >$null 2>&1
33
+ Move-Item -Path $bin_dir\mago\mago-$mago_tag-$arch_name-pc-windows-msvc\mago.exe -Destination $bin_dir\mago.exe -Force
34
+ Add-ToProfile $current_profile 'mago' "New-Alias mago $bin_dir\mago.exe"
35
+ Add-Log $tick "mago" "Added mago $mago_tag"
36
+ }
@@ -0,0 +1,29 @@
1
+ get_mago_tag() {
2
+ if [ "$mago_tag" = "latest" ]; then
3
+ mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
4
+ else
5
+ status_code=$(get -v -n /tmp/mago.tmp "https://github.com/carthage-software/mago/releases/tag/$mago_tag")
6
+ if [ "$status_code" = "200" ]; then
7
+ mago_tag="$mago_tag"
8
+ else
9
+ mago_tag=$(get -s -n "" https://github.com/carthage-software/mago/releases/latest 2<&1 | grep -m 1 -Eo "tag/([0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2)
10
+ fi
11
+ fi
12
+ }
13
+
14
+ add_mago() {
15
+ mago_tag=$1
16
+ get_mago_tag
17
+ (
18
+ platform='unknown-linux-gnu'
19
+ [ "$(uname -s)" = "Darwin" ] && platform='apple-darwin'
20
+ arch="$(uname -m)"
21
+ [[ "$arch" = 'arm64' || "$arch" = 'aarch64' ]] && arch='aarch64'
22
+ [[ "$arch" = 'x86_64' || "$arch" = 'amd64' ]] && arch='x86_64'
23
+ get -q -n /tmp/mago.tar.gz "https://github.com/carthage-software/mago/releases/download/$mago_tag/mago-$mago_tag-$arch-$platform.tar.gz"
24
+ sudo tar -xzf /tmp/mago.tar.gz -C /tmp/
25
+ sudo mv /tmp/mago-$mago_tag-$arch-$platform/mago /usr/local/bin/mago
26
+ sudo chmod +x /usr/local/bin/mago
27
+ ) >/dev/null 2>&1
28
+ add_log "${tick:?}" "mago" "Added mago $mago_tag"
29
+ }
@@ -164,7 +164,7 @@ remove_list() {
164
164
  # Function to check if ubuntu ppa is up
165
165
  is_ubuntu_ppa_up() {
166
166
  ppa=${1:-ondrej/php}
167
- curl -s --connect-timeout 5 --max-time 5 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
167
+ curl -s --connect-timeout 10 --max-time 10 --head --fail "$lpc_ppa/$ppa/ubuntu/dists/$VERSION_CODENAME/Release" > /dev/null
168
168
  }
169
169
 
170
170
  # Function to add the PPA mirror.
@@ -172,8 +172,8 @@ add_ppa_sp_mirror() {
172
172
  ppa=$1
173
173
  ppa_name="$(basename "$ppa")"
174
174
  remove_list "$ppa" || true
175
- [ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
176
- add_list sp/"$ppa_name" "$sp/$ppa/ubuntu" "$sp/$ppa/ubuntu/key.gpg"
175
+ [ "${debug:?}" = "debug" ] && add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg" "$VERSION_CODENAME" "main/debug"
176
+ add_list sp/"$ppa_name" "$ppa_sp/$ppa/ubuntu" "$ppa_sp/$ppa/ubuntu/key.gpg"
177
177
  }
178
178
 
179
179
  # Function to add a PPA.
@@ -182,11 +182,13 @@ add_ppa() {
182
182
  ppa=${1:-ondrej/php}
183
183
  if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
184
184
  if is_ubuntu_ppa_up "$ppa" ; then
185
- [ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "$sp" {} \; -delete
185
+ [ "${runner:?}" = "self-hosted" ] && find "$list_dir" -type f -name 'sp*' -exec grep -qF "${sp/https:\/\/}" {} \; -delete
186
186
  [ "${debug:?}" = "debug" ] && add_list "$ppa" "$lpc_ppa/$ppa/ubuntu" "$lpc_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
187
187
  add_list "$ppa"
188
- else
188
+ elif [ "$ppa" = "ondrej/php" ]; then
189
189
  add_ppa_sp_mirror "$ppa"
190
+ else
191
+ add_log "${cross:?}" "$ppa" "PPA $ppa is not available"
190
192
  fi
191
193
  elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
192
194
  [ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
@@ -225,6 +227,7 @@ lpc_ppa='https://ppa.launchpadcontent.net'
225
227
  key_dir='/usr/share/keyrings'
226
228
  dist_info_dir='/usr/share/distro-info'
227
229
  sury='https://packages.sury.org'
230
+ ppa_sp='https://ppa.setup-php.com'
228
231
  sp='https://setup-php.com'
229
232
  sks=(
230
233
  'https://keyserver.ubuntu.com'
@@ -447,7 +447,7 @@ if($version -lt "5.5") {
447
447
  } else {
448
448
  $enable_extensions += ('opcache')
449
449
  }
450
- Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
450
+ Enable-PhpExtension -Extension ($enable_extensions | Where-Object { Test-Path $ext_dir\php_$_.dll }) -Path $php_dir
451
451
  Add-PhpCAInfo
452
452
  Add-OpenSSLConf
453
453
  Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE