cache-extensions 1.1.1 → 1.7.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.
Files changed (72) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +154 -133
  3. package/lib/cache.d.ts +2 -0
  4. package/lib/cache.js +59 -0
  5. package/lib/cache.js.map +1 -0
  6. package/lib/utils.d.ts +3 -0
  7. package/lib/utils.js +44 -0
  8. package/lib/utils.js.map +1 -0
  9. package/package.json +66 -54
  10. package/src/cache.ts +44 -11
  11. package/src/lists/bionic-libs +768 -737
  12. package/src/lists/darwin-deps +1 -0
  13. package/src/lists/darwin-extensions +18 -0
  14. package/src/lists/focal-libs +788 -753
  15. package/src/lists/linux-deps +4 -0
  16. package/src/scripts/cache.sh +124 -0
  17. package/src/scripts/darwin.sh +189 -0
  18. package/src/scripts/linux.sh +117 -0
  19. package/src/utils.ts +30 -23
  20. package/.eslintrc.json +0 -23
  21. package/.github/CODE_OF_CONDUCT.md +0 -76
  22. package/.github/CONTRIBUTING.md +0 -63
  23. package/.github/FUNDING.yml +0 -5
  24. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  25. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  26. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  27. package/.github/workflows/workflow.yml +0 -31
  28. package/.idea/cache-extensions.iml +0 -8
  29. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  30. package/.idea/misc.xml +0 -6
  31. package/.idea/modules.xml +0 -8
  32. package/.idea/vcs.xml +0 -6
  33. package/.idea/workspace.xml +0 -217
  34. package/.prettierrc.json +0 -12
  35. package/__tests__/cache.test.ts +0 -60
  36. package/__tests__/utils.test.ts +0 -25
  37. package/action.yml +0 -19
  38. package/dist/index.js +0 -1701
  39. package/jest.config.js +0 -12
  40. package/src/extensions.sh +0 -96
  41. package/src/lists/bionic-php5.3-extensions +0 -68
  42. package/src/lists/bionic-php5.4-extensions +0 -72
  43. package/src/lists/bionic-php5.5-extensions +0 -72
  44. package/src/lists/bionic-php5.6-extensions +0 -66
  45. package/src/lists/bionic-php7.0-extensions +0 -63
  46. package/src/lists/bionic-php7.1-extensions +0 -90
  47. package/src/lists/bionic-php7.2-extensions +0 -90
  48. package/src/lists/bionic-php7.3-extensions +0 -90
  49. package/src/lists/bionic-php7.4-extensions +0 -88
  50. package/src/lists/bionic-php8.0-extensions +0 -69
  51. package/src/lists/focal-php5.3-extensions +0 -64
  52. package/src/lists/focal-php5.4-extensions +0 -71
  53. package/src/lists/focal-php5.5-extensions +0 -71
  54. package/src/lists/focal-php5.6-extensions +0 -65
  55. package/src/lists/focal-php7.0-extensions +0 -62
  56. package/src/lists/focal-php7.1-extensions +0 -62
  57. package/src/lists/focal-php7.2-extensions +0 -63
  58. package/src/lists/focal-php7.3-extensions +0 -63
  59. package/src/lists/focal-php7.4-extensions +0 -54
  60. package/src/lists/focal-php8.0-extensions +0 -68
  61. package/src/lists/xenial-libs +0 -728
  62. package/src/lists/xenial-php5.3-extensions +0 -67
  63. package/src/lists/xenial-php5.4-extensions +0 -71
  64. package/src/lists/xenial-php5.5-extensions +0 -71
  65. package/src/lists/xenial-php5.6-extensions +0 -95
  66. package/src/lists/xenial-php7.0-extensions +0 -90
  67. package/src/lists/xenial-php7.1-extensions +0 -90
  68. package/src/lists/xenial-php7.2-extensions +0 -90
  69. package/src/lists/xenial-php7.3-extensions +0 -90
  70. package/src/lists/xenial-php7.4-extensions +0 -88
  71. package/src/lists/xenial-php8.0-extensions +0 -69
  72. package/tsconfig.json +0 -63
package/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
-
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2020 shivammathur and contributors
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2020 shivammathur and contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  THE SOFTWARE.
package/README.md CHANGED
@@ -1,133 +1,154 @@
1
- <h1 align="center">Cache PHP extensions in GitHub Actions</h1>
2
-
3
- <p align="center">
4
- <a href="https://github.com/shivammathur/cache-extensions" title="Cache PHP extensions in GitHub Actions"><img alt="GitHub Actions status" src="https://github.com/shivammathur/cache-extensions/workflows/Main%20workflow/badge.svg"></a>
5
- <a href="https://codecov.io/gh/shivammathur/cache-extensions" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/cache-extensions/branch/master/graph/badge.svg"></a>
6
- <a href="https://github.com/shivammathur/cache-extensions/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
7
- <a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.3-8892BF.svg"></a>
8
- </p>
9
-
10
- Cache PHP extensions in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action has to be used along with [shivammathur/setup-php](https://github.com/shivammathur/setup-php "Setup PHP") and [actions/cache](https://github.com/actions/cache "Cache in GitHub Actions") GitHub Actions. It configures the environment required to cache PHP extensions. Refer to [Usage](#memo-usage "How to use this") section to see how to use this.
11
-
12
- ## Contents
13
-
14
- - [PHP Support](#tada-php-support)
15
- - [OS/Platform Support](#cloud-osplatform-support)
16
- - [Usage](#memo-usage)
17
- - [Inputs](#inputs)
18
- - [Workflow](#workflow)
19
- - [License](#scroll-license)
20
- - [Contributions](#1-contributions)
21
- - [Support this project](#sparkling_heart-support-this-project)
22
- - [Dependencies](#bookmark-dependencies)
23
-
24
- ## :tada: PHP Support
25
-
26
- |PHP Version|Stability|Release Support|
27
- |--- |--- |--- |
28
- |5.3|`Stable`|`End of life`|
29
- |5.4|`Stable`|`End of life`|
30
- |5.5|`Stable`|`End of life`|
31
- |5.6|`Stable`|`End of life`|
32
- |7.0|`Stable`|`End of life`|
33
- |7.1|`Stable`|`End of life`|
34
- |7.2|`Stable`|`Security fixes only`|
35
- |7.3|`Stable`|`Active`|
36
- |7.4|`Stable`|`Active`|
37
- |8.0|`Nightly`|`In development`|
38
-
39
- ## :cloud: OS/Platform Support
40
-
41
- |Virtual environment|YAML workflow label|
42
- |--- |--- |
43
- |Windows Server 2019|`windows-latest` or `windows-2019`|
44
- |Ubuntu 20.04|`ubuntu-20.04`|
45
- |Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
46
- |Ubuntu 16.04|`ubuntu-16.04`|
47
- |macOS Catalina 10.15|`macos-latest` or `macOS-10.15`|
48
-
49
- ## :memo: Usage
50
-
51
- ### Inputs
52
-
53
- #### `php-version` (required)
54
-
55
- - Specify the PHP version you want to setup.
56
- - Accepts a `string`. For example `'7.4'`.
57
- - See [PHP support](#tada-php-support) for supported PHP versions.
58
-
59
- #### `extensions` (required)
60
-
61
- - Specify the extensions you want to add or remove.
62
- - Accepts a `string` in csv-format. For example `mbstring, , xdebug, :opcache`.
63
- - Extensions prefixed with `:` are ignored.
64
-
65
- #### `key` (required)
66
-
67
- - Specify the key to identify the cache version.
68
- - Accepts any `string`. For example `cache-v1`.
69
- - Changing this would reset the cache.
70
-
71
- See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
72
-
73
- ### Workflow
74
- > Cache extensions in a PHP workflow
75
-
76
- ```yaml
77
- jobs:
78
- run:
79
- runs-on: ${{ matrix.operating-system }}
80
- strategy:
81
- matrix:
82
- operating-system: [ubuntu-latest, windows-latest, macos-latest]
83
- php-versions: ['7.2', '7.3', '7.4']
84
- name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
85
- env:
86
- extensions: intl, pcov
87
- key: cache-v1 # can be any string, change to clear the extension cache.
88
- steps:
89
- - name: Checkout
90
- uses: actions/checkout@v2
91
-
92
- - name: Setup cache environment
93
- id: extcache
94
- uses: shivammathur/cache-extensions@v1
95
- with:
96
- php-version: ${{ matrix.php-versions }}
97
- extensions: ${{ env.extensions }}
98
- key: ${{ env.key }}
99
-
100
- - name: Cache extensions
101
- uses: actions/cache@v2
102
- with:
103
- path: ${{ steps.extcache.outputs.dir }}
104
- key: ${{ steps.extcache.outputs.key }}
105
- restore-keys: ${{ steps.extcache.outputs.key }}
106
-
107
- - name: Setup PHP
108
- uses: shivammathur/setup-php@v2
109
- with:
110
- php-version: ${{ matrix.php-versions }}
111
- extensions: ${{ env.extensions }}
112
- ```
113
-
114
- ## :scroll: License
115
-
116
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/cache-extensions"). This project has multiple [dependencies](https://github.com/shivammathur/cache-extensions/network/dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
117
-
118
- ## :+1: Contributions
119
-
120
- Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/cache-extensions contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/cache-extensions/issues "Issues reported").
121
-
122
- ## :sparkling_heart: Support this project
123
-
124
- If this action helped you.
125
-
126
- - Sponsor the project by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
127
- - Please star the project and share it with the community.
128
- - If you blog, write about your experience of using this action.
129
- - If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")u need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
130
-
131
- ## :bookmark: Dependencies
132
-
133
- - [Node.js dependencies](https://github.com/shivammathur/setup-php/network/dependencies "Node.js dependencies")
1
+ <h1 align="center">Cache PHP extensions in GitHub Actions</h1>
2
+
3
+ <p align="center">
4
+ <a href="https://github.com/shivammathur/cache-extensions" title="Cache PHP extensions in GitHub Actions"><img alt="GitHub Actions status" src="https://github.com/shivammathur/cache-extensions/workflows/Main%20workflow/badge.svg"></a>
5
+ <a href="https://codecov.io/gh/shivammathur/cache-extensions" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/cache-extensions/branch/master/graph/badge.svg"></a>
6
+ <a href="https://github.com/shivammathur/cache-extensions/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"></a>
7
+ <a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.3%20to%208.2-777bb3.svg?logo=php&logoColor=white&labelColor=555555"></a>
8
+ </p>
9
+
10
+ Cache PHP extensions in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action has to be used along with [shivammathur/setup-php](https://github.com/shivammathur/setup-php "Setup PHP") and [actions/cache](https://github.com/actions/cache "Cache in GitHub Actions") GitHub Actions. It configures the environment required to cache PHP extensions. Refer to [Usage](#memo-usage "How to use this") section for details and example workflow.
11
+
12
+ ## Contents
13
+
14
+ - [PHP Support](#tada-php-support)
15
+ - [OS/Platform Support](#cloud-osplatform-support)
16
+ - [Usage](#memo-usage)
17
+ - [Inputs](#inputs)
18
+ - [Workflow](#workflow)
19
+ - [Thread Safe Setup](#thread-safe-setup)
20
+ - [License](#scroll-license)
21
+ - [Contributions](#1-contributions)
22
+ - [Support This Project](#sparkling_heart-support-this-project)
23
+ - [Dependencies](#package-dependencies)
24
+
25
+ ## :tada: PHP Support
26
+
27
+ |PHP Version|Stability|Release Support|
28
+ |--- |--- |--- |
29
+ |5.3|`Stable`|`End of life`|
30
+ |5.4|`Stable`|`End of life`|
31
+ |5.5|`Stable`|`End of life`|
32
+ |5.6|`Stable`|`End of life`|
33
+ |7.0|`Stable`|`End of life`|
34
+ |7.1|`Stable`|`End of life`|
35
+ |7.2|`Stable`|`End of life`|
36
+ |7.3|`Stable`|`End of life`|
37
+ |7.4|`Stable`|`Security fixes only`|
38
+ |8.0|`Stable`|`Active`|
39
+ |8.1|`Stable`|`Active`|
40
+ |8.2|`Nightly`|`In development`|
41
+
42
+ ## :cloud: OS/Platform Support
43
+
44
+ |Virtual environment|YAML workflow label|
45
+ |--- |--- |
46
+ |Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|
47
+ |Ubuntu 18.04|`ubuntu-18.04`|
48
+ |Windows Server 2022|`windows-2022`|
49
+ |Windows Server 2019|`windows-latest` or `windows-2019`|
50
+ |macOS Catalina 10.15|`macos-latest` or `macOS-10.15`|
51
+ |macOS Big Sur 11.x|`macOS-11`|
52
+
53
+ ## :memo: Usage
54
+
55
+ Use this GitHub Action when the extensions you are adding in [setup-php](https://github.com/shivammathur/setup-php "setup-php GitHub Action") are installed and take a long time to set up. If you are using extensions which have the result `Installed and enabled` in the logs like `pecl` extensions on `Ubuntu` or extensions which have custom support, it is recommended to use this action to cache your extensions.
56
+
57
+ ### Inputs
58
+
59
+ #### `php-version` (required)
60
+
61
+ - Specify the PHP version you want to set up.
62
+ - Accepts a `string`. For example `'8.1'`.
63
+ - Accepts `latest` to set up the latest stable PHP version.
64
+ - Accepts `nightly` to set up a nightly build from the master branch of PHP.
65
+ - Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
66
+ - See [PHP support](#tada-php-support) for supported PHP versions.
67
+
68
+ #### `extensions` (required)
69
+
70
+ - Specify the extensions you want to set up.
71
+ - Accepts a `string` in csv-format. For example `mbstring, xdebug, :opcache`.
72
+ - Extensions prefixed with `:` are ignored in output cache key.
73
+
74
+ #### `key` (required)
75
+
76
+ - Specify the key to identify the cache version.
77
+ - Accepts any `string`. For example `cache-v1`.
78
+ - Changing this would reset the cache.
79
+
80
+ See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
81
+
82
+ ### Workflow
83
+
84
+ > Cache extensions in a PHP workflow
85
+
86
+ ```yaml
87
+ jobs:
88
+ run:
89
+ runs-on: ${{ matrix.operating-system }}
90
+ strategy:
91
+ matrix:
92
+ operating-system: [ubuntu-latest, windows-latest, macos-latest]
93
+ php-versions: ['7.4', '8.0', '8.1']
94
+ name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
95
+ env:
96
+ extensions: intl, pcov
97
+ key: cache-v1 # can be any string, change to clear the extension cache.
98
+ steps:
99
+ - name: Checkout
100
+ uses: actions/checkout@v2
101
+
102
+ - name: Setup cache environment
103
+ id: extcache
104
+ uses: shivammathur/cache-extensions@v1
105
+ with:
106
+ php-version: ${{ matrix.php-versions }}
107
+ extensions: ${{ env.extensions }}
108
+ key: ${{ env.key }}
109
+
110
+ - name: Cache extensions
111
+ uses: actions/cache@v2
112
+ with:
113
+ path: ${{ steps.extcache.outputs.dir }}
114
+ key: ${{ steps.extcache.outputs.key }}
115
+ restore-keys: ${{ steps.extcache.outputs.key }}
116
+
117
+ - name: Setup PHP
118
+ uses: shivammathur/setup-php@v2
119
+ with:
120
+ php-version: ${{ matrix.php-versions }}
121
+ extensions: ${{ env.extensions }}
122
+ ```
123
+
124
+ ### Thread Safe Setup
125
+
126
+ If you set up both `TS` and `NTS` PHP versions on `Windows` in your workflow, please add `${{ env.phpts }}` to `key` and `restore-keys` inputs in `actions/cache` step in the above workflow to avoid a conflicting cache.
127
+
128
+ ```yaml
129
+ - name: Cache extensions
130
+ uses: actions/cache@v2
131
+ with:
132
+ path: ${{ steps.extcache.outputs.dir }}
133
+ key: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}
134
+ restore-keys: ${{ steps.extcache.outputs.key }}-${{ env.phpts }}
135
+ ```
136
+
137
+ ## :scroll: License
138
+
139
+ The code and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/cache-extensions"). This project has multiple [dependencies](https://github.com/shivammathur/cache-extensions/network/dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
140
+
141
+ ## :+1: Contributions
142
+
143
+ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/cache-extensions contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/cache-extensions/issues "Issues reported").
144
+
145
+ ## :sparkling_heart: Support This Project
146
+
147
+ If this action helped you.
148
+
149
+ - Please star the project and share it. If you blog, please share your experience of using this action.
150
+ - Please support our work by sponsoring using [GitHub sponsors](https://github.com/sponsors/shivammathur).
151
+
152
+ ## :package: Dependencies
153
+
154
+ - [Node.js dependencies](https://github.com/shivammathur/cache-extensions/network/dependencies "Node.js dependencies")
package/lib/cache.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function handleDependencies(extensions: string, version: string): Promise<void>;
2
+ export declare function run(): Promise<void>;
package/lib/cache.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.run = exports.handleDependencies = void 0;
23
+ const exec_1 = require("@actions/exec");
24
+ const cache = __importStar(require("@actions/cache"));
25
+ const core = __importStar(require("@actions/core"));
26
+ const spu = __importStar(require("setup-php/lib/utils"));
27
+ const path = __importStar(require("path"));
28
+ const utils = __importStar(require("./utils"));
29
+ async function handleDependencies(extensions, version) {
30
+ if (!/^5.[3-5]$/.test(version) && /linux|darwin/.test(process.platform)) {
31
+ const cache_key = (await utils.getOutput('key')) + '-deps';
32
+ const cache_dir = path.join(await spu.readEnv('RUNNER_TOOL_CACHE'), 'deps');
33
+ const cache_hit = await cache.restoreCache([cache_dir], cache_key, [cache_key]);
34
+ await (0, exec_1.exec)(await utils.scriptCall('dependencies', extensions, version));
35
+ if (!cache_hit) {
36
+ await cache.saveCache([cache_dir], cache_key);
37
+ }
38
+ }
39
+ }
40
+ exports.handleDependencies = handleDependencies;
41
+ async function run() {
42
+ try {
43
+ const version = await spu.parseVersion(await spu.getInput('php-version', true));
44
+ const extensions = await utils.filterExtensions(await spu.getInput('extensions', true));
45
+ const key = await spu.getInput('key', true);
46
+ await (0, exec_1.exec)(await utils.scriptCall('data', extensions, version, key));
47
+ await handleDependencies(extensions, version);
48
+ }
49
+ catch (error) {
50
+ core.setFailed(error.message);
51
+ }
52
+ }
53
+ exports.run = run;
54
+ (async () => {
55
+ await run();
56
+ })().catch(error => {
57
+ core.setFailed(error.message);
58
+ });
59
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAmC;AACnC,sDAAwC;AACxC,oDAAsC;AACtC,yDAA2C;AAC3C,2CAA6B;AAC7B,+CAAiC;AAQ1B,KAAK,UAAU,kBAAkB,CACtC,UAAkB,EAClB,OAAe;IAEf,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACvE,MAAM,SAAS,GAAW,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC;QACnE,MAAM,SAAS,GAAW,IAAI,CAAC,IAAI,CACjC,MAAM,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,EACtC,MAAM,CACP,CAAC;QACF,MAAM,SAAS,GAAuB,MAAM,KAAK,CAAC,YAAY,CAC5D,CAAC,SAAS,CAAC,EACX,SAAS,EACT,CAAC,SAAS,CAAC,CACZ,CAAC;QACF,MAAM,IAAA,WAAI,EAAC,MAAM,KAAK,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;SAC/C;KACF;AACH,CAAC;AApBD,gDAoBC;AAKM,KAAK,UAAU,GAAG;IACvB,IAAI;QACF,MAAM,OAAO,GAAW,MAAM,GAAG,CAAC,YAAY,CAC5C,MAAM,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,CACxC,CAAC;QACF,MAAM,UAAU,GAAW,MAAM,KAAK,CAAC,gBAAgB,CACrD,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CACvC,CAAC;QACF,MAAM,GAAG,GAAW,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpD,MAAM,IAAA,WAAI,EAAC,MAAM,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QACrE,MAAM,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;KAC/C;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;KAC1C;AACH,CAAC;AAdD,kBAcC;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/lib/utils.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function getOutput(output: string): Promise<string>;
2
+ export declare function filterExtensions(extension_csv: string): Promise<string>;
3
+ export declare function scriptCall(fn: string, ...args: string[]): Promise<string>;
package/lib/utils.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.scriptCall = exports.filterExtensions = exports.getOutput = void 0;
23
+ const fs = __importStar(require("fs"));
24
+ const path = __importStar(require("path"));
25
+ const spu = __importStar(require("setup-php/lib/utils"));
26
+ async function getOutput(output) {
27
+ return fs.readFileSync(path.join(await spu.readEnv('RUNNER_TEMP'), output), 'utf8');
28
+ }
29
+ exports.getOutput = getOutput;
30
+ async function filterExtensions(extension_csv) {
31
+ return JSON.stringify(extension_csv
32
+ .split(',')
33
+ .filter(extension => {
34
+ return extension.trim()[0] != ':';
35
+ })
36
+ .join(','));
37
+ }
38
+ exports.filterExtensions = filterExtensions;
39
+ async function scriptCall(fn, ...args) {
40
+ const script = path.join(__dirname, '../src/scripts/cache.sh');
41
+ return ['bash', script, fn, ...args].join(' ');
42
+ }
43
+ exports.scriptCall = scriptCall;
44
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,yDAA2C;AAKpC,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,OAAO,EAAE,CAAC,YAAY,CACpB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,EACnD,MAAM,CACP,CAAC;AACJ,CAAC;AALD,8BAKC;AAOM,KAAK,UAAU,gBAAgB,CAAC,aAAqB;IAC1D,OAAO,IAAI,CAAC,SAAS,CACnB,aAAa;SACV,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,SAAS,CAAC,EAAE;QAClB,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;IACpC,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC;AATD,4CASC;AAQM,KAAK,UAAU,UAAU,CAC9B,EAAU,EACV,GAAG,IAAc;IAEjB,MAAM,MAAM,GAAW,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAND,gCAMC"}
package/package.json CHANGED
@@ -1,54 +1,66 @@
1
- {
2
- "name": "cache-extensions",
3
- "version": "1.1.1",
4
- "private": false,
5
- "description": "Cache extensions in GitHub Actions",
6
- "main": "dist/index.js",
7
- "scripts": {
8
- "build": "tsc",
9
- "lint": "eslint **/*.ts --cache",
10
- "format": "prettier --write **/*.ts && git add .",
11
- "format-check": "prettier --check **/*.ts",
12
- "release": "ncc build src/cache.ts -o dist && git add -f dist/",
13
- "test": "jest"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/shivammathur/cache-extensions.git"
18
- },
19
- "keywords": [
20
- "actions",
21
- "php",
22
- "setup"
23
- ],
24
- "author": "shivammathur",
25
- "license": "MIT",
26
- "dependencies": {
27
- "@actions/core": "^1.2.4",
28
- "@actions/exec": "^1.0.4"
29
- },
30
- "devDependencies": {
31
- "@types/jest": "^26.0.5",
32
- "@types/node": "^14.0.23",
33
- "@typescript-eslint/eslint-plugin": "^3.6.1",
34
- "@typescript-eslint/parser": "^3.6.1",
35
- "@zeit/ncc": "^0.22.3",
36
- "eslint": "^7.4.0",
37
- "eslint-config-prettier": "^6.11.0",
38
- "eslint-plugin-import": "^2.22.0",
39
- "eslint-plugin-jest": "^23.18.0",
40
- "eslint-plugin-prettier": "^3.1.4",
41
- "husky": "^4.2.5",
42
- "jest": "^26.1.0",
43
- "jest-circus": "^26.1.0",
44
- "prettier": "^2.0.5",
45
- "ts-jest": "^26.1.3",
46
- "typescript": "^3.9.7"
47
- },
48
- "husky": {
49
- "skipCI": true,
50
- "hooks": {
51
- "pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
52
- }
53
- }
54
- }
1
+ {
2
+ "name": "cache-extensions",
3
+ "version": "1.7.0",
4
+ "private": false,
5
+ "description": "Cache PHP extensions in GitHub Actions",
6
+ "main": "lib/cache.js",
7
+ "types": "lib/cache.d.ts",
8
+ "directories": {
9
+ "lib": "lib",
10
+ "test": "__tests__",
11
+ "src": "src"
12
+ },
13
+ "files": [
14
+ "lib",
15
+ "src"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "lint": "eslint **/src/*.ts --cache --fix",
20
+ "format": "prettier --write **/src/*.ts && git add .",
21
+ "format-check": "prettier --check **/src/*.ts",
22
+ "release": "ncc build -o dist && git add -f dist/",
23
+ "test": "jest"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/shivammathur/cache-extensions.git"
28
+ },
29
+ "keywords": [
30
+ "actions",
31
+ "php",
32
+ "extension",
33
+ "cache"
34
+ ],
35
+ "author": "shivammathur",
36
+ "license": "MIT",
37
+ "dependencies": {
38
+ "@actions/cache": "^1.0.8",
39
+ "@actions/core": "^1.6.0",
40
+ "@actions/exec": "^1.1.0",
41
+ "setup-php": "2.15.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/jest": "^27.0.3",
45
+ "@types/node": "^17.0.0",
46
+ "@typescript-eslint/eslint-plugin": "^5.7.0",
47
+ "@typescript-eslint/parser": "^5.7.0",
48
+ "@vercel/ncc": "^0.33.0",
49
+ "eslint": "^8.4.1",
50
+ "eslint-config-prettier": "^8.3.0",
51
+ "eslint-plugin-import": "^2.25.3",
52
+ "eslint-plugin-jest": "^25.3.0",
53
+ "eslint-plugin-prettier": "^4.0.0",
54
+ "jest": "^27.4.5",
55
+ "jest-circus": "^27.4.5",
56
+ "prettier": "^2.5.1",
57
+ "ts-jest": "^27.1.2",
58
+ "typescript": "^4.5.4"
59
+ },
60
+ "bugs": {
61
+ "url": "https://github.com/shivammathur/cache-extensions/issues"
62
+ },
63
+ "simple-git-hooks": {
64
+ "pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
65
+ }
66
+ }