cache-extensions 1.2.0 → 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 -150
  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 -7
  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 -1766
  39. package/jest.config.js +0 -12
  40. package/src/extensions.sh +0 -96
  41. package/src/lists/bionic-php5.3-extensions +0 -72
  42. package/src/lists/bionic-php5.4-extensions +0 -76
  43. package/src/lists/bionic-php5.5-extensions +0 -76
  44. package/src/lists/bionic-php5.6-extensions +0 -68
  45. package/src/lists/bionic-php7.0-extensions +0 -65
  46. package/src/lists/bionic-php7.1-extensions +0 -94
  47. package/src/lists/bionic-php7.2-extensions +0 -94
  48. package/src/lists/bionic-php7.3-extensions +0 -94
  49. package/src/lists/bionic-php7.4-extensions +0 -92
  50. package/src/lists/bionic-php8.0-extensions +0 -72
  51. package/src/lists/focal-php5.3-extensions +0 -68
  52. package/src/lists/focal-php5.4-extensions +0 -75
  53. package/src/lists/focal-php5.5-extensions +0 -75
  54. package/src/lists/focal-php5.6-extensions +0 -67
  55. package/src/lists/focal-php7.0-extensions +0 -64
  56. package/src/lists/focal-php7.1-extensions +0 -64
  57. package/src/lists/focal-php7.2-extensions +0 -65
  58. package/src/lists/focal-php7.3-extensions +0 -65
  59. package/src/lists/focal-php7.4-extensions +0 -93
  60. package/src/lists/focal-php8.0-extensions +0 -72
  61. package/src/lists/xenial-libs +0 -728
  62. package/src/lists/xenial-php5.3-extensions +0 -71
  63. package/src/lists/xenial-php5.4-extensions +0 -75
  64. package/src/lists/xenial-php5.5-extensions +0 -75
  65. package/src/lists/xenial-php5.6-extensions +0 -99
  66. package/src/lists/xenial-php7.0-extensions +0 -94
  67. package/src/lists/xenial-php7.1-extensions +0 -94
  68. package/src/lists/xenial-php7.2-extensions +0 -94
  69. package/src/lists/xenial-php7.3-extensions +0 -94
  70. package/src/lists/xenial-php7.4-extensions +0 -92
  71. package/src/lists/xenial-php8.0-extensions +0 -73
  72. package/tsconfig.json +0 -63
package/src/cache.ts CHANGED
@@ -1,27 +1,60 @@
1
- import {exec} from '@actions/exec/lib/exec';
1
+ import {exec} from '@actions/exec';
2
+ import * as cache from '@actions/cache';
2
3
  import * as core from '@actions/core';
4
+ import * as spu from 'setup-php/lib/utils';
3
5
  import * as path from 'path';
4
6
  import * as utils from './utils';
5
7
 
8
+ /**
9
+ * Handle dependencies
10
+ *
11
+ * @param extensions
12
+ * @param version
13
+ */
14
+ export async function handleDependencies(
15
+ extensions: string,
16
+ version: string
17
+ ): Promise<void> {
18
+ if (!/^5.[3-5]$/.test(version) && /linux|darwin/.test(process.platform)) {
19
+ const cache_key: string = (await utils.getOutput('key')) + '-deps';
20
+ const cache_dir: string = path.join(
21
+ await spu.readEnv('RUNNER_TOOL_CACHE'),
22
+ 'deps'
23
+ );
24
+ const cache_hit: string | undefined = await cache.restoreCache(
25
+ [cache_dir],
26
+ cache_key,
27
+ [cache_key]
28
+ );
29
+ await exec(await utils.scriptCall('dependencies', extensions, version));
30
+ if (!cache_hit) {
31
+ await cache.saveCache([cache_dir], cache_key);
32
+ }
33
+ }
34
+ }
35
+
6
36
  /**
7
37
  * Run the script
8
38
  */
9
39
  export async function run(): Promise<void> {
10
40
  try {
11
- let version: string = await utils.getInput('php-version', true);
12
- version = version.length > 1 ? version.slice(0, 3) : version + '.0';
13
- const extensions = await utils.filterExtensions(
14
- await utils.getInput('extensions', true)
41
+ const version: string = await spu.parseVersion(
42
+ await spu.getInput('php-version', true)
15
43
  );
16
- const key: string = await utils.getInput('key', true);
17
- const script_path: string = path.join(__dirname, '../src/extensions.sh');
18
- await exec(
19
- 'bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version
44
+ const extensions: string = await utils.filterExtensions(
45
+ await spu.getInput('extensions', true)
20
46
  );
47
+ const key: string = await spu.getInput('key', true);
48
+ await exec(await utils.scriptCall('data', extensions, version, key));
49
+ await handleDependencies(extensions, version);
21
50
  } catch (error) {
22
- core.setFailed(error.message);
51
+ core.setFailed((error as Error).message);
23
52
  }
24
53
  }
25
54
 
26
55
  // call the run function
27
- run();
56
+ (async () => {
57
+ await run();
58
+ })().catch(error => {
59
+ core.setFailed(error.message);
60
+ });