mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-20 07:08:56 +08:00
Compare commits
616 Commits
v2.2.0-rc.
...
release/v3
Author | SHA1 | Date | |
---|---|---|---|
|
3b1b3b9a21 | ||
|
d4bd442194 | ||
|
4587492cf1 | ||
|
ef85c4ed42 | ||
|
7e08fe288b | ||
|
4a8703fa34 | ||
|
4a39eedb8c | ||
|
272883a7ba | ||
|
2a8bfcf231 | ||
|
e1ada08a9a | ||
|
a8e3e5e2b4 | ||
|
2be01ca1c6 | ||
|
a00827eebb | ||
|
ad80850e98 | ||
|
bd6d0a74d4 | ||
|
1b6cac1f97 | ||
|
90d7c1a069 | ||
|
4062866f05 | ||
|
83a95864e5 | ||
|
60c43cb563 | ||
|
75b3db10df | ||
|
f1361c71c2 | ||
|
49ade81b5d | ||
|
79fa674432 | ||
|
46878035be | ||
|
42452daeb5 | ||
|
346645706f | ||
|
5516b39940 | ||
|
7099569988 | ||
|
610728fa8c | ||
|
a835cbb991 | ||
|
ee4d92bb22 | ||
|
173b6ae553 | ||
|
a01f794d92 | ||
|
369fcc54d8 | ||
|
6523a87c8f | ||
|
11693a1169 | ||
|
0e6b90783e | ||
|
932abbbe13 | ||
|
1a18d0b2d3 | ||
|
7af89832c5 | ||
|
b5ebb0cc96 | ||
|
3a75647ad4 | ||
|
4dda5928c7 | ||
|
6c7537229b | ||
|
650620f9f9 | ||
|
d4e24dfc10 | ||
|
7c57ba1136 | ||
|
32bab5b15a | ||
|
270f30ba56 | ||
|
c00a847f3f | ||
|
e2aa3f332c | ||
|
ff5d63e9dc | ||
|
4faac45dc8 | ||
|
45ed60450e | ||
|
72abd931ce | ||
|
a4107da76d | ||
|
d16a3f4093 | ||
|
333078158e | ||
|
34a07dced0 | ||
|
24e9e9dc6b | ||
|
bc72ac9e9d | ||
|
c791d32284 | ||
|
ceb0c736c1 | ||
|
3f2ca32cb0 | ||
|
5d2dd0dea4 | ||
|
e865911745 | ||
|
0538e78c32 | ||
|
a4dabb3a70 | ||
|
51b7a82e8e | ||
|
92cb3fe7e8 | ||
|
e843ea4565 | ||
|
14b4921945 | ||
|
9c7269b85b | ||
|
a7b743845f | ||
|
e6566cde89 | ||
|
89f8dcd819 | ||
|
93050d1483 | ||
|
df38ec05e0 | ||
|
b3f092e821 | ||
|
63ce84df08 | ||
|
57f3f23714 | ||
|
38785d7d62 | ||
|
a738af78ea | ||
|
ae24bf6608 | ||
|
334a4b8d4d | ||
|
009bd36b91 | ||
|
9d6738618d | ||
|
f053e6b7e7 | ||
|
c821b7c4f1 | ||
|
982da8e78c | ||
|
a0fc8606d2 | ||
|
a1980784de | ||
|
89e46180c6 | ||
|
f95e9c7459 | ||
|
8cbcb9948b | ||
|
a71aff6a12 | ||
|
77699bae74 | ||
|
dc5927259f | ||
|
4f0075d967 | ||
|
e1f9864a52 | ||
|
76d5a9b475 | ||
|
39d8c6d06e | ||
|
0280eb7de5 | ||
|
87a9a15658 | ||
|
375481748b | ||
|
beff1c573c | ||
|
21a3ebb55f | ||
|
a5be560235 | ||
|
9bca466e27 | ||
|
f757bcfd86 | ||
|
8b6c211905 | ||
|
8db1c7621b | ||
|
6eaacfc06c | ||
|
750905c0ed | ||
|
d5fbcc8361 | ||
|
0e761ca2b4 | ||
|
6b7c087721 | ||
|
0bfe00a136 | ||
|
62cce3c597 | ||
|
842c587ad8 | ||
|
4241e05054 | ||
|
bfa3c0508e | ||
|
c3bdce8205 | ||
|
f92e7c3428 | ||
|
d1b726d8c1 | ||
|
6fcc109efa | ||
|
fde5b4fcde | ||
|
324fbdc804 | ||
|
5658338fb0 | ||
|
87ccc98a2a | ||
|
4441c9f9bf | ||
|
b5126f31db | ||
|
d8615ccc8b | ||
|
444c20baf7 | ||
|
aea76e1766 | ||
|
103e3a7ba7 | ||
|
73e3fc21c7 | ||
|
b063df05a4 | ||
|
5e3952da92 | ||
|
ed940a329a | ||
|
3bfe3a4658 | ||
|
8f08e41675 | ||
|
ef76a971e2 | ||
|
98d77952ea | ||
|
3122f2c659 | ||
|
53c4cf6c4c | ||
|
f2d7085b02 | ||
|
9124f04a83 | ||
|
c304f927c4 | ||
|
e3426b1f20 | ||
|
d79398df06 | ||
|
b9cd1d9e69 | ||
|
d4db33d499 | ||
|
05acc776e8 | ||
|
33c9bfac14 | ||
|
97d9c134b7 | ||
|
a617adb316 | ||
|
b156d58cac | ||
|
b946c060aa | ||
|
96bed685e4 | ||
|
800e5e1e62 | ||
|
ff3f4cfbf8 | ||
|
a07019c726 | ||
|
b17d107b8c | ||
|
12dcfaa735 | ||
|
9fb6114fb4 | ||
|
50d07aa0e5 | ||
|
3d49588efc | ||
|
68e1dcdea4 | ||
|
8cade330d4 | ||
|
124cb765ee | ||
|
243af859f8 | ||
|
dc5f59ec6e | ||
|
c87c55823d | ||
|
cfdcfc37ed | ||
|
193108951e | ||
|
f9b4995b32 | ||
|
4283247a19 | ||
|
337198a5e3 | ||
|
e3028deccc | ||
|
cb1fda6460 | ||
|
19e2bdf3c0 | ||
|
891451e1fc | ||
|
03f0ac2c51 | ||
|
999ba18af8 | ||
|
43f8f93391 | ||
|
e8d1617724 | ||
|
a4cf152f48 | ||
|
a8aac055e2 | ||
|
7241fa5d56 | ||
|
9e58f8b1de | ||
|
632e888003 | ||
|
ced6859e9c | ||
|
0904709a46 | ||
|
1b94073332 | ||
|
4821f54162 | ||
|
2dbad1ea2d | ||
|
915a66c096 | ||
|
8e5c8782a3 | ||
|
9f977db2d8 | ||
|
fa27d06744 | ||
|
a0fdbb009a | ||
|
f59a6d4310 | ||
|
b69de5f2a9 | ||
|
3c11eee5f9 | ||
|
4301451b53 | ||
|
295170c2ce | ||
|
ce999babab | ||
|
ce35ffa374 | ||
|
ad97b0f09e | ||
|
29c79cfd95 | ||
|
bd57605957 | ||
|
f464d5c9e5 | ||
|
cef72ff9e4 | ||
|
7a67f395d2 | ||
|
bc190ca89a | ||
|
f01b48d89d | ||
|
1e71bceb3f | ||
|
9a4d99b236 | ||
|
33f9bc031c | ||
|
437bff62b6 | ||
|
c0186c5832 | ||
|
ee7ca6ac9b | ||
|
063cc1c708 | ||
|
820b228f28 | ||
|
d0ffeaa089 | ||
|
4c9c435d2f | ||
|
a6ad1901be | ||
|
d7761f188f | ||
|
92c37aaab7 | ||
|
1a6aca96f3 | ||
|
90c9cfa90d | ||
|
35af09efd8 | ||
|
00309f16a9 | ||
|
3273b6ada1 | ||
|
f807993b34 | ||
|
bde650d6f1 | ||
|
40b6781dcd | ||
|
626d937994 | ||
|
6c3f1eadfe | ||
|
8e02c8272a | ||
|
f63cb02cfc | ||
|
198484d871 | ||
|
fce96e0d6a | ||
|
75a86cfe02 | ||
|
be413309fa | ||
|
1b2daf5833 | ||
|
4388b1f9e5 | ||
|
07023d3e3e | ||
|
c94d573317 | ||
|
680037c65b | ||
|
2bf6bc3646 | ||
|
631021bf98 | ||
|
d1c4012c0d | ||
|
c097126a28 | ||
|
b4a540a61f | ||
|
c9a87440e3 | ||
|
d23c38fad3 | ||
|
a810b86311 | ||
|
7e48093f71 | ||
|
12681a2972 | ||
|
a8aa75965b | ||
|
a580d9bd57 | ||
|
a13870c94e | ||
|
55d241b8a2 | ||
|
9cf99034d2 | ||
|
6778644d75 | ||
|
749f47bda3 | ||
|
eb126d771e | ||
|
5056fa9d50 | ||
|
8a0051ffb2 | ||
|
4f87177da0 | ||
|
ff62946998 | ||
|
2eddd207d6 | ||
|
887e0bda35 | ||
|
dac0b87334 | ||
|
a8f0f0d523 | ||
|
951bc8ab16 | ||
|
c0e9e4809f | ||
|
c5df77b4dd | ||
|
f04973c111 | ||
|
2287707267 | ||
|
530c579a03 | ||
|
f65e80839b | ||
|
fed795f38c | ||
|
a63ae37710 | ||
|
6095a76664 | ||
|
96015f1e52 | ||
|
4a570433d8 | ||
|
601a5d4aa4 | ||
|
6df3b5baf5 | ||
|
96374ed57d | ||
|
59d37bdb61 | ||
|
5abf330283 | ||
|
86ee4f1f60 | ||
|
e0391a3985 | ||
|
09af07ef76 | ||
|
b47aad4750 | ||
|
758ee5a303 | ||
|
50f436c485 | ||
|
32863c1a40 | ||
|
b744d1079a | ||
|
bff802913e | ||
|
cacfec068e | ||
|
935e8941dd | ||
|
cfc50b189a | ||
|
7e68f96bb3 | ||
|
e444647395 | ||
|
970a1475f1 | ||
|
d9106fb21d | ||
|
6f59210bbe | ||
|
a8cfaf666b | ||
|
c82ad7fca4 | ||
|
e70e4c5e6b | ||
|
2bc6cca4b8 | ||
|
38bf8d67e6 | ||
|
1c56ebc005 | ||
|
7b3886699e | ||
|
c7ca785b85 | ||
|
dbca794d9a | ||
|
cbd0ff0688 | ||
|
1e6c29c1af | ||
|
d518883ba8 | ||
|
b3d342ca6a | ||
|
f7e0e454da | ||
|
60499ea6fd | ||
|
e4ca0fdab0 | ||
|
9adc0d5566 | ||
|
b1d3b7d6a0 | ||
|
43879ebea6 | ||
|
a64e4c087d | ||
|
3952b17b6f | ||
|
cb48b1f38e | ||
|
68ef9a8880 | ||
|
980f056e16 | ||
|
57f5c44cc6 | ||
|
e34d59c741 | ||
|
3d966761cf | ||
|
1b220aef6b | ||
|
a40cc892c0 | ||
|
7a088f07a3 | ||
|
ce77f6daf4 | ||
|
ba25077191 | ||
|
ea2e601207 | ||
|
4ebaed58ba | ||
|
9884d8f3dc | ||
|
2e30e4cc65 | ||
|
2fcb85ffb5 | ||
|
617a29d5b5 | ||
|
0ea8b0085d | ||
|
084bf86b45 | ||
|
a1c0141aa8 | ||
|
19307c73ca | ||
|
12054785f0 | ||
|
5d67aff3ea | ||
|
c2abdfc02b | ||
|
4d24cb28d8 | ||
|
9db683d515 | ||
|
45abe419bb | ||
|
d9799478b8 | ||
|
579b14502b | ||
|
a0cffe83e1 | ||
|
add2af0efd | ||
|
1fcc75d614 | ||
|
5df685c7b2 | ||
|
ee7cbb6fb4 | ||
|
1d2e9eb287 | ||
|
2df8f7bc66 | ||
|
3fbe033aaa | ||
|
0842a550d1 | ||
|
3b959539de | ||
|
c267ad1fcb | ||
|
fab7664a6a | ||
|
a5b34e05de | ||
|
a4b5212a9d | ||
|
ad59e53998 | ||
|
c224a16628 | ||
|
ec783957f3 | ||
|
6b08b7d2b5 | ||
|
fd32ae9081 | ||
|
8545e5aed7 | ||
|
d92395703c | ||
|
af916fa394 | ||
|
3d9f1fdd28 | ||
|
387c8bc97a | ||
|
31c4390f56 | ||
|
05b706c1e7 | ||
|
b9a8697f71 | ||
|
394498f89f | ||
|
c295a4096e | ||
|
74a56b60ce | ||
|
aeb3e0fcd7 | ||
|
8a17724c3e | ||
|
76ed799d26 | ||
|
dd8493d4f2 | ||
|
66061a0409 | ||
|
1a66a38284 | ||
|
bf471096d3 | ||
|
e8a7e1402f | ||
|
0e3ce37aac | ||
|
8d2472536e | ||
|
832889a6eb | ||
|
61f7cb1f75 | ||
|
e440eaf750 | ||
|
570f67893a | ||
|
402732a560 | ||
|
a6f860c57c | ||
|
657d21ac23 | ||
|
688380a438 | ||
|
cce16c4e36 | ||
|
b50380a07d | ||
|
aa2854e6ea | ||
|
471bcda20a | ||
|
91306f47ea | ||
|
65c865a172 | ||
|
1761dcff13 | ||
|
356abb47e7 | ||
|
fc9e8feb61 | ||
|
0e4b100458 | ||
|
82bc72e1e7 | ||
|
8be955ee80 | ||
|
531cc21aeb | ||
|
164712adb1 | ||
|
535b494721 | ||
|
d6110ecac2 | ||
|
cc60593845 | ||
|
fb549a8417 | ||
|
c64fe31590 | ||
|
6e56b59601 | ||
|
c77676cc69 | ||
|
f39ea084f9 | ||
|
27a2f232f6 | ||
|
b4c3d51488 | ||
|
99ec710825 | ||
|
d427a379a8 | ||
|
ed5f3e6998 | ||
|
11c5fa73ac | ||
|
3e3c80e9b4 | ||
|
25ec178747 | ||
|
3cc0a8f6bb | ||
|
915123c493 | ||
|
ef638c00fd | ||
|
05257c7a5f | ||
|
c1a6f51e61 | ||
|
865815e1b6 | ||
|
eb22e65b5b | ||
|
8a386f6915 | ||
|
84bc83e639 | ||
|
cd579d970f | ||
|
f0ec7fb780 | ||
|
bf2a15ee94 | ||
|
c85b5e1be7 | ||
|
330980897f | ||
|
9411346324 | ||
|
8f9b7c7d7f | ||
|
8df5664474 | ||
|
25e9b4d3f6 | ||
|
b49446f8e1 | ||
|
cbebff71e9 | ||
|
e4e8267f88 | ||
|
1e61c9a322 | ||
|
1a981dbaeb | ||
|
58e9059de1 | ||
|
a62a2e6297 | ||
|
daa635c20c | ||
|
9ee08ff30d | ||
|
f4ef189a47 | ||
|
8e9c25766c | ||
|
8ca744f938 | ||
|
f1b090783c | ||
|
8624823510 | ||
|
203397ae27 | ||
|
2aee3e724e | ||
|
a1707fcc88 | ||
|
b173558d72 | ||
|
d1ddcc2b6a | ||
|
1f2d557283 | ||
|
544b84f77b | ||
|
23d17c1372 | ||
|
ba3953a01d | ||
|
02e50e0dcd | ||
|
cd48d2d9f1 | ||
|
a81a96bcb6 | ||
|
7a5430f22f | ||
|
6b46ca579b | ||
|
933706c9f3 | ||
|
f524932f69 | ||
|
115127d4c2 | ||
|
115f70f942 | ||
|
1c23b66302 | ||
|
7a714ca5cb | ||
|
f559e1b425 | ||
|
5c38a9cbe9 | ||
|
ede6deb03b | ||
|
e3c7fbbbf0 | ||
|
a5bedc5d4f | ||
|
97590ddc37 | ||
|
41839de420 | ||
|
ad8dc7ef6a | ||
|
35da154adf | ||
|
3e0e3a6dea | ||
|
25d3ae13f9 | ||
|
5db8d22748 | ||
|
86acd2a1fd | ||
|
3f1275846c | ||
|
ef1e109eb6 | ||
|
5c54c52839 | ||
|
89ea1bd733 | ||
|
444dfef7d6 | ||
|
957e1cc621 | ||
|
731c4e9bf4 | ||
|
6700f3a162 | ||
|
1691ab51b6 | ||
|
27f9f12663 | ||
|
474cf85207 | ||
|
37c9711406 | ||
|
cd3cedc781 | ||
|
e54bfe60d4 | ||
|
d70ff19b06 | ||
|
45417006b1 | ||
|
925e60d017 | ||
|
47a028a7f5 | ||
|
7df347a3ca | ||
|
d742f2f6db | ||
|
e4c0d1d512 | ||
|
64a1064eca | ||
|
bc57473979 | ||
|
11ea84dec5 | ||
|
5a614fb332 | ||
|
d3a8ea948b | ||
|
fba23f26a1 | ||
|
683f9d4247 | ||
|
f87d5a33c9 | ||
|
42014fb4fa | ||
|
2da06d5689 | ||
|
792a93a5e3 | ||
|
86da5e6c4e | ||
|
6daf446e27 | ||
|
8a8f74b15c | ||
|
15453523bd | ||
|
b1b0eab63d | ||
|
f580ce7b99 | ||
|
2a7ffc9c95 | ||
|
ff6b0e0388 | ||
|
71e1e1b52b | ||
|
02b67b8bfe | ||
|
5ce69a34b6 | ||
|
e7f3e4d839 | ||
|
7645d3e274 | ||
|
be13141ec7 | ||
|
db33711f5a | ||
|
84dee23dd9 | ||
|
a603ab7405 | ||
|
bc41b8f654 | ||
|
32923891b5 | ||
|
fecf3693b5 | ||
|
6965e8ed4c | ||
|
884bca012f | ||
|
7f46dbd76f | ||
|
ea4554d4d2 | ||
|
d8b58e3519 | ||
|
4cb86e9712 | ||
|
eaed5520c4 | ||
|
ec939a8c10 | ||
|
6594e9d359 | ||
|
52e6e7d89f | ||
|
2bf1894aa3 | ||
|
795895fc71 | ||
|
98376690f1 | ||
|
67421db6bd | ||
|
ce3874fec9 | ||
|
67f42d16a1 | ||
|
56036f8577 | ||
|
1903bd4674 | ||
|
df4c1902a6 | ||
|
132237ba05 | ||
|
2335d51128 | ||
|
2f7e5c0d4b | ||
|
2248b3f239 | ||
|
7d8a9a65e5 | ||
|
bc39e4abaa | ||
|
26cd1c9794 | ||
|
5ccc7fa6a6 | ||
|
badf18c0a6 | ||
|
1ee84620f9 | ||
|
f1c1269910 | ||
|
c09f41c4bd | ||
|
829c7a236d | ||
|
c1ed8b1925 | ||
|
3d091fa7a8 | ||
|
a8d44c9749 | ||
|
6125b490f2 | ||
|
f75a77b009 | ||
|
3510b43886 | ||
|
61ba2ad220 | ||
|
4b449e5b54 | ||
|
b8f0ecc408 | ||
|
c2bd86551b | ||
|
92087b6bb6 | ||
|
9355458b6c | ||
|
4ec1021d58 | ||
|
f3e4903860 | ||
|
c5d80a628f | ||
|
ee54c1fd71 | ||
|
f33d84950e | ||
|
d20c5c0356 | ||
|
c207cf448f | ||
|
a534572737 | ||
|
acf6027bd2 | ||
|
f6ab09b0bf | ||
|
55ddd21594 | ||
|
33ed11e54c | ||
|
93c31ca3b5 | ||
|
7a15005377 | ||
|
e88ed3e650 |
@@ -1,3 +0,0 @@
|
|||||||
dist/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
@@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
|
||||||
"extends": ["plugin:github/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"import/no-namespace": "off",
|
|
||||||
"i18n-text/no-en": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"sort-imports": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/array-type": "error",
|
|
||||||
"@typescript-eslint/await-thenable": "error",
|
|
||||||
"camelcase": "off",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
|
||||||
"@typescript-eslint/require-array-sort-compare": ["error", {"ignoreStringArrays": true}],
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"semi": "off",
|
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
|
||||||
"@typescript-eslint/unbound-method": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
16
.github/actions/build-dist/action.yml
vendored
16
.github/actions/build-dist/action.yml
vendored
@@ -1,16 +0,0 @@
|
|||||||
name: 'Build and upload distribution'
|
|
||||||
# Builds the action distribution an uploads as an artifact for later download
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Build distribution
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run all
|
|
||||||
- name: Upload distribution
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
|
|
12
.github/actions/download-dist/action.yml
vendored
12
.github/actions/download-dist/action.yml
vendored
@@ -1,12 +0,0 @@
|
|||||||
name: 'Download dist'
|
|
||||||
# Downloads a 'dist' directory artifact that was uploaded in an earlier step
|
|
||||||
# We control this with an environment variable to allow for easier global configuration.
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Download dist
|
|
||||||
if: ${{ env.DOWNLOAD_DIST == 'true' }}
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@@ -6,13 +6,15 @@ registries:
|
|||||||
username: dummy # Required by dependabot
|
username: dummy # Required by dependabot
|
||||||
password: dummy # Required by dependabot
|
password: dummy # Required by dependabot
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "github-actions"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "weekly"
|
||||||
open-pull-requests-limit: 10
|
groups:
|
||||||
ignore:
|
github-actions:
|
||||||
- dependency-name: "@types/node"
|
patterns:
|
||||||
|
- "*"
|
||||||
|
|
||||||
- package-ecosystem: "gradle"
|
- package-ecosystem: "gradle"
|
||||||
directory: ".github/workflow-samples/gradle-plugin"
|
directory: ".github/workflow-samples/gradle-plugin"
|
||||||
registries:
|
registries:
|
||||||
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
|
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
41
.github/workflow-samples/gradle-plugin/gradlew
vendored
41
.github/workflow-samples/gradle-plugin/gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@@ -29,7 +29,7 @@ testing {
|
|||||||
functionalTest(JvmTestSuite) {
|
functionalTest(JvmTestSuite) {
|
||||||
dependencies {
|
dependencies {
|
||||||
// functionalTest test suite depends on the production code in tests
|
// functionalTest test suite depends on the production code in tests
|
||||||
implementation project
|
implementation(project(':plugin'))
|
||||||
}
|
}
|
||||||
|
|
||||||
targets {
|
targets {
|
||||||
|
@@ -11,8 +11,8 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("test").configure {
|
tasks.named("test").configure {
|
||||||
// Echo an output value so we can detect configuration-cache usage
|
// Write marker file so we can detect if task was configured
|
||||||
println "::set-output name=task_configured::yes"
|
file("task-configured.txt").text = "true"
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
if (System.properties.verifyCachedBuild) {
|
if (System.properties.verifyCachedBuild) {
|
||||||
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
|
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
41
.github/workflow-samples/groovy-dsl/gradlew
vendored
41
.github/workflow-samples/groovy-dsl/gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
15
.github/workflow-samples/groovy-dsl/gradlew.bat
vendored
15
.github/workflow-samples/groovy-dsl/gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.10.1"
|
id "com.gradle.enterprise" version "3.16.2"
|
||||||
|
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.12.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
|
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
41
.github/workflow-samples/java-toolchain/gradlew
vendored
41
.github/workflow-samples/java-toolchain/gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@@ -1 +1,5 @@
|
|||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = 'basic'
|
rootProject.name = 'basic'
|
||||||
|
@@ -8,9 +8,9 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.apache.commons:commons-math3:3.6.1")
|
api("org.apache.commons:commons-math3:3.6.1")
|
||||||
implementation("com.google.guava:guava:31.1-jre")
|
implementation("com.google.guava:guava:33.0.0-jre")
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
@@ -18,8 +18,8 @@ tasks.test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("test").configure {
|
tasks.named("test").configure {
|
||||||
// Echo an output value so we can detect configuration-cache usage
|
// Write marker file so we can detect if task was configured
|
||||||
println("::set-output name=task_configured::yes")
|
file("task-configured.txt").writeText("true")
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
if (System.getProperties().containsKey("verifyCachedBuild")) {
|
if (System.getProperties().containsKey("verifyCachedBuild")) {
|
||||||
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
|
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
41
.github/workflow-samples/kotlin-dsl/gradlew
vendored
41
.github/workflow-samples/kotlin-dsl/gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
15
.github/workflow-samples/kotlin-dsl/gradlew.bat
vendored
15
.github/workflow-samples/kotlin-dsl/gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.gradle.enterprise") version "3.10.1"
|
id("com.gradle.enterprise") version "3.16.2"
|
||||||
|
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.12.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
1
.github/workflow-samples/no-ge/build.gradle
vendored
Normal file
1
.github/workflow-samples/no-ge/build.gradle
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// Required to keep dependabot happy
|
1
.github/workflow-samples/no-ge/settings.gradle
vendored
Normal file
1
.github/workflow-samples/no-ge/settings.gradle
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'no-ge'
|
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.build-scan" version "3.10.1"
|
id "com.gradle.build-scan" version "3.16.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.10.1"
|
id "com.gradle.enterprise" version "3.16.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
70
.github/workflows/ci-codeql.yml
vendored
70
.github/workflows/ci-codeql.yml
vendored
@@ -1,70 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: CI-codeql
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ main ]
|
|
||||||
schedule:
|
|
||||||
- cron: '25 23 * * 2'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'javascript' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
34
.github/workflows/ci-full-check.yml
vendored
34
.github/workflows/ci-full-check.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
name: CI-full-check
|
name: CI-full-check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- assigned
|
- assigned
|
||||||
@@ -8,9 +9,10 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- release/**
|
||||||
paths:
|
paths:
|
||||||
- '.github/workflows/**'
|
- '.github/**'
|
||||||
- 'dist/**'
|
- 'action.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
action-inputs:
|
action-inputs:
|
||||||
@@ -19,7 +21,19 @@ jobs:
|
|||||||
cache-key-prefix: ${{github.run_number}}-
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
caching-config:
|
caching-config:
|
||||||
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
|
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
dependency-graph:
|
||||||
|
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
dependency-graph-failures:
|
||||||
|
uses: ./.github/workflows/integ-test-dependency-graph-failures.yml
|
||||||
with:
|
with:
|
||||||
cache-key-prefix: ${{github.run_number}}-
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
@@ -33,6 +47,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache-key-prefix: ${{github.run_number}}-
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
develocity-injection:
|
||||||
|
uses: ./.github/workflows/integ-test-inject-develocity.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
secrets:
|
||||||
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||||
|
|
||||||
provision-gradle-versions:
|
provision-gradle-versions:
|
||||||
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||||
with:
|
with:
|
||||||
@@ -42,6 +63,8 @@ jobs:
|
|||||||
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
with:
|
with:
|
||||||
cache-key-prefix: ${{github.run_number}}-
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
|
||||||
restore-custom-gradle-home:
|
restore-custom-gradle-home:
|
||||||
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
@@ -72,3 +95,8 @@ jobs:
|
|||||||
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||||
with:
|
with:
|
||||||
cache-key-prefix: ${{github.run_number}}-
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
toolchain-detection:
|
||||||
|
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
21
.github/workflows/ci-init-script-check.yml
vendored
21
.github/workflows/ci-init-script-check.yml
vendored
@@ -1,21 +0,0 @@
|
|||||||
name: CI-init-script-check
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-init-scripts:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup Java
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: 8
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: gradle/gradle-build-action@v2 # Use a released version to avoid breakages
|
|
||||||
- name: Run integration tests
|
|
||||||
working-directory: test/test-init-scripts
|
|
||||||
run: ./gradlew check
|
|
67
.github/workflows/ci-quick-check.yml
vendored
67
.github/workflows/ci-quick-check.yml
vendored
@@ -1,96 +1,91 @@
|
|||||||
name: CI-quick-check
|
name: CI-quick-check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches-ignore: main
|
branches-ignore:
|
||||||
|
- main
|
||||||
|
- release/**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-distribution:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Build and upload distribution
|
|
||||||
uses: ./.github/actions/build-dist
|
|
||||||
|
|
||||||
action-inputs:
|
action-inputs:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-action-inputs.yml
|
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
caching-config:
|
caching-config:
|
||||||
needs: build-distribution
|
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||||
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
|
||||||
|
dependency-graph:
|
||||||
|
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
|
||||||
|
dependency-graph-failures:
|
||||||
|
uses: ./.github/workflows/integ-test-dependency-graph-failures.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
execution-with-caching:
|
execution-with-caching:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
execution:
|
execution:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-execution.yml
|
uses: ./.github/workflows/integ-test-execution.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
develocity-injection:
|
||||||
|
uses: ./.github/workflows/integ-test-inject-develocity.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
secrets:
|
||||||
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||||
|
|
||||||
provision-gradle-versions:
|
provision-gradle-versions:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
restore-configuration-cache:
|
restore-configuration-cache:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
secrets:
|
||||||
|
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
|
||||||
restore-containerized-gradle-home:
|
restore-containerized-gradle-home:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||||
with:
|
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
restore-custom-gradle-home:
|
restore-custom-gradle-home:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
with:
|
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
restore-gradle-home:
|
restore-gradle-home:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
restore-java-toolchain:
|
restore-java-toolchain:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
sample-kotlin-dsl:
|
sample-kotlin-dsl:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
|
||||||
sample-gradle-plugin:
|
sample-gradle-plugin:
|
||||||
needs: build-distribution
|
|
||||||
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||||
with:
|
with:
|
||||||
runner-os: '["ubuntu-latest"]'
|
runner-os: '["ubuntu-latest"]'
|
||||||
download-dist: true
|
|
||||||
|
toolchain-detection:
|
||||||
|
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
40
.github/workflows/ci-verify-outputs.yml
vendored
40
.github/workflows/ci-verify-outputs.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
name: CI-verify-outputs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- assigned
|
|
||||||
- review_requested
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- '.github/workflows/**'
|
|
||||||
- 'dist/**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run all
|
|
||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
|
||||||
run: |
|
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
|
||||||
git diff
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
id: diff
|
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
6
.github/workflows/demo-failure-cases.yml
vendored
6
.github/workflows/demo-failure-cases.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Test build failure
|
- name: Test build failure
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Test wrapper missing
|
- name: Test wrapper missing
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Test bad config value
|
- name: Test bad config value
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
51
.github/workflows/demo-job-summary.yml
vendored
51
.github/workflows/demo-job-summary.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Demo Job Summary for Gradle builds
|
name: Demo Job Summary, for Gradle builds
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -8,24 +8,22 @@ env:
|
|||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-gradle-builds:
|
many-gradle-builds:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Build distribution
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build kotlin-dsl project
|
- name: Build kotlin-dsl project
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assemble
|
||||||
- name: Build kotlin-dsl project without build scan
|
- name: Build kotlin-dsl project without Build Scan®
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew check --no-scan
|
run: ./gradlew assemble check --no-scan
|
||||||
|
- name: Build kotlin-dsl project with Build Scan® publish failure
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew check -Dgradle.enterprise.url=https://not.valid.server
|
||||||
- name: Build groovy-dsl project
|
- name: Build groovy-dsl project
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assemble
|
||||||
@@ -38,3 +36,36 @@ jobs:
|
|||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew not-a-real-task
|
run: ./gradlew not-a-real-task
|
||||||
|
|
||||||
|
successful-builds-with-no-summary:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
add-job-summary: on-failure
|
||||||
|
- name: Build kotlin-dsl project
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew assemble
|
||||||
|
- name: Build kotlin-dsl project without Build Scan®
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew assemble check --no-scan
|
||||||
|
|
||||||
|
pre-existing-gradle-home:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Pre-create Gradle User Home
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ~/.gradle
|
||||||
|
mkdir ~/.gradle/caches
|
||||||
|
touch ~/.gradle/caches/dummy.txt
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
- name: Run build
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew assemble
|
||||||
|
50
.github/workflows/demo-pr-build-scan-comment.yml
vendored
50
.github/workflows/demo-pr-build-scan-comment.yml
vendored
@@ -1,27 +1,51 @@
|
|||||||
name: Demo adding build scan comment to PR
|
name: Demo adding Build Scan® comment to PR
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [assigned, review_requested]
|
types: [assigned, review_requested]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gradle:
|
successful-build-with-always-comment:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout project sources
|
- name: Checkout project sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
add-job-summary-as-pr-comment: always
|
||||||
- name: Run build with Gradle wrapper
|
- name: Run build with Gradle wrapper
|
||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew build --scan
|
run: ./gradlew build --scan
|
||||||
- name: "Add build scan URL as PR comment"
|
|
||||||
uses: actions/github-script@v6
|
successful-build-with-comment-on-failure:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout project sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
add-job-summary-as-pr-comment: on-failure
|
||||||
script: |
|
- name: Run build with Gradle wrapper
|
||||||
github.rest.issues.createComment({
|
id: gradle
|
||||||
issue_number: context.issue.number,
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
owner: context.repo.owner,
|
run: ./gradlew build --scan
|
||||||
repo: context.repo.repo,
|
|
||||||
body: 'PR ready for review: ${{ steps.gradle.outputs.build-scan-url }}'
|
failing-build-with-comment-on-failure:
|
||||||
})
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout project sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
add-job-summary-as-pr-comment: on-failure
|
||||||
|
- name: Run build with Gradle wrapper
|
||||||
|
id: gradle
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew no-a-real-task --scan
|
||||||
|
continue-on-error: true
|
||||||
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Invoke with multi-line arguments
|
- name: Invoke with multi-line arguments
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
name: Test action inputs for caching
|
name: Test caching configuration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -38,7 +32,8 @@ jobs:
|
|||||||
enterprise
|
enterprise
|
||||||
# Exclude build-cache from main cache entry
|
# Exclude build-cache from main cache entry
|
||||||
gradle-home-cache-excludes: |
|
gradle-home-cache-excludes: |
|
||||||
caches/build-cache-1
|
caches/build-cache-*
|
||||||
|
caches/*/executionHistory
|
||||||
- name: Build using Gradle wrapper
|
- name: Build using Gradle wrapper
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test
|
run: ./gradlew test
|
||||||
@@ -52,9 +47,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -63,7 +56,8 @@ jobs:
|
|||||||
caches
|
caches
|
||||||
enterprise
|
enterprise
|
||||||
gradle-home-cache-excludes: |
|
gradle-home-cache-excludes: |
|
||||||
caches/build-cache-1
|
caches/build-cache-*
|
||||||
|
caches/*/executionHistory
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
- name: Execute Gradle build with --offline
|
- name: Execute Gradle build with --offline
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
@@ -77,9 +71,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -88,21 +80,19 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url is captured
|
- name: Check Build Scan url is captured
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
||||||
cache-disabled-pre-existing-gradle-home:
|
cache-disabled-pre-existing-gradle-home:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Create dummy Gradle User Home
|
- name: Create dummy Gradle User Home
|
||||||
run: mkdir -p ~/.gradle/caches
|
run: mkdir -p ~/.gradle/caches
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
@@ -111,12 +101,12 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url is captured
|
- name: Check Build Scan url is captured
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
# Test seed the cache with cache-write-only and verify with cache-read-only
|
# Test seed the cache with cache-write-only and verify with cache-read-only
|
||||||
seed-build-write-only:
|
seed-build-write-only:
|
||||||
@@ -128,9 +118,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -149,9 +137,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
91
.github/workflows/integ-test-dependency-graph-failures.yml
vendored
Normal file
91
.github/workflows/integ-test-dependency-graph-failures.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
name: Test dependency graph
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unsupported-gradle-version-warning:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: 7.0.1
|
||||||
|
dependency-graph: generate
|
||||||
|
dependency-graph-continue-on-failure: true
|
||||||
|
- name: Run with unsupported Gradle version
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
if gradle help | grep -q 'warning::Dependency Graph is not supported for Gradle 7.0.1. No dependency snapshot will be generated.';
|
||||||
|
then
|
||||||
|
echo "Got the expected warning"
|
||||||
|
else
|
||||||
|
echo "Did not get the expected warning"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
unsupported-gradle-version-failure:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: 7.0.1
|
||||||
|
dependency-graph: generate
|
||||||
|
dependency-graph-continue-on-failure: false
|
||||||
|
- name: Run with unsupported Gradle version
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
if gradle help; then
|
||||||
|
echo "Expected build to fail with Gradle 7.0.1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
insufficient-permissions-warning:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-submit
|
||||||
|
dependency-graph-continue-on-failure: true
|
||||||
|
- name: Run with insufficient permissions
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew help
|
||||||
|
# This test is primarily for demonstration: it's unclear how to check for warnings emitted in the post-action
|
||||||
|
|
||||||
|
SHOULD_FAIL-insufficient-permissions-failure:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
continue-on-error: true
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-submit
|
||||||
|
dependency-graph-continue-on-failure: false
|
||||||
|
- name: Run with insufficient permissions
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew help
|
||||||
|
# This test is primarily for demonstration: it's unclear how to check for a failure in the post-action
|
134
.github/workflows/integ-test-dependency-graph.yml
vendored
Normal file
134
.github/workflows/integ-test-dependency-graph.yml
vendored
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
name: Test dependency graph
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
groovy-generate:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-upload
|
||||||
|
- name: Run gradle build
|
||||||
|
run: ./gradlew build
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
|
||||||
|
kotlin-generate:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-submit
|
||||||
|
- name: Run gradle build
|
||||||
|
run: ./gradlew build
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
|
||||||
|
submit:
|
||||||
|
needs: [groovy-generate]
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Submit dependency graphs
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: download-and-submit
|
||||||
|
|
||||||
|
multiple-builds:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-submit
|
||||||
|
- id: gradle-assemble
|
||||||
|
run: ./gradlew assemble
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- id: gradle-build
|
||||||
|
run: ./gradlew build
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- id: gradle-build-again
|
||||||
|
run: ./gradlew build
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- name: Check generated dependency graphs
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "gradle-assemble report file: ${{ steps.gradle-assemble.outputs.dependency-graph-file }}"
|
||||||
|
echo "gradle-build report file: ${{ steps.gradle-build.outputs.dependency-graph-file }}"
|
||||||
|
echo "gradle-build-again report file: ${{ steps.gradle-build-again.outputs.dependency-graph-file }}"
|
||||||
|
ls -l dependency-graph-reports
|
||||||
|
if [ ! -e "${{ steps.gradle-assemble.outputs.dependency-graph-file }}" ]; then
|
||||||
|
echo "Did not find gradle-assemble dependency graph file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -e "${{ steps.gradle-build.outputs.dependency-graph-file }}" ]; then
|
||||||
|
echo "Did not find gradle-build dependency graph files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -e "${{ steps.gradle-build-again.outputs.dependency-graph-file }}" ]; then
|
||||||
|
echo "Did not find gradle-build-again dependency graph files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
config-cache:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle for dependency-graph generate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dependency-graph: generate-and-submit
|
||||||
|
- id: config-cache-store
|
||||||
|
run: ./gradlew assemble --configuration-cache
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- name: Check and delete generated dependency graph
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -e "${{ steps.config-cache-store.outputs.dependency-graph-file }}" ]; then
|
||||||
|
echo "Did not find config-cache-store dependency graph files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm ${{ steps.config-cache-store.outputs.dependency-graph-file }}
|
||||||
|
- id: config-cache-reuse
|
||||||
|
run: ./gradlew assemble --configuration-cache
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- name: Check no dependency graph is generated
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||||
|
echo "Expected no dependency graph files to be generated"
|
||||||
|
ls -l dependency-graph-reports
|
||||||
|
exit 1
|
||||||
|
fi
|
85
.github/workflows/integ-test-detect-java-toolchains.yml
vendored
Normal file
85
.github/workflows/integ-test-detect-java-toolchains.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
name: Test detect java toolchains
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: detect-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Test that pre-installed runner JDKs are detected
|
||||||
|
pre-installed-toolchains:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
- name: List detected toolchains
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
gradle --info javaToolchains > output.txt
|
||||||
|
cat output.txt
|
||||||
|
- name: Verify detected toolchains
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
grep -q 'Eclipse Temurin JDK 1.8' output.txt || (echo "::error::Did not detect preinstalled JDK 1.8" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 11' output.txt || (echo "::error::Did not detect preinstalled JDK 11" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 17' output.txt || (echo "::error::Did not detect preinstalled JDK 17" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1)
|
||||||
|
|
||||||
|
# Test that JDKs provisioned by setup-java are detected
|
||||||
|
setup-java-installed-toolchain:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Java 20
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '20'
|
||||||
|
- name: Setup Java 16
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '16'
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
- name: List detected toolchains
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
gradle --info javaToolchains > output.txt
|
||||||
|
cat output.txt
|
||||||
|
- name: Verify setup JDKs are detected
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
grep -q 'Eclipse Temurin JDK 16' output.txt || (echo "::error::Did not detect setup-java installed JDK 16" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 20' output.txt || (echo "::error::Did not detect setup-java installed JDK 20" && exit 1)
|
||||||
|
- name: Verify pre-installed toolchains are detected
|
||||||
|
shell: bash
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: |
|
||||||
|
grep -q 'Eclipse Temurin JDK 1.8' output.txt || (echo "::error::Did not detect preinstalled JDK 1.8" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 11' output.txt || (echo "::error::Did not detect preinstalled JDK 11" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 17' output.txt || (echo "::error::Did not detect preinstalled JDK 17" && exit 1)
|
||||||
|
grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1)
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Execute Gradle build
|
- name: Execute Gradle build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -44,9 +38,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Execute Gradle build
|
- name: Execute Gradle build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
28
.github/workflows/integ-test-execution.yml
vendored
28
.github/workflows/integ-test-execution.yml
vendored
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -30,9 +26,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Test use defined Gradle version
|
- name: Test use defined Gradle version
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -46,17 +40,11 @@ jobs:
|
|||||||
gradle-version: release-candidate
|
gradle-version: release-candidate
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper
|
build-root-directory: .github/workflow-samples/no-wrapper
|
||||||
arguments: help
|
arguments: help
|
||||||
- name: Test use defined Gradle executable
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
gradle-executable: .github/workflow-samples/groovy-dsl/gradlew${{ matrix.script-suffix }}
|
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper
|
|
||||||
arguments: help -DgradleVersionCheck=7.4.2
|
|
||||||
|
|
||||||
gradle-versions:
|
gradle-versions:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3, 3.5.1]
|
gradle: [7.5.1, 6.9.2, 5.6.4, 4.10.3, 3.5.1]
|
||||||
os: ${{fromJSON(inputs.runner-os)}}
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- gradle: 5.6.4
|
- gradle: 5.6.4
|
||||||
@@ -68,11 +56,9 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 8
|
java-version: 8
|
||||||
@@ -84,11 +70,11 @@ jobs:
|
|||||||
gradle-version: ${{matrix.gradle}}
|
gradle-version: ${{matrix.gradle}}
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
||||||
- name: Check build scan url
|
- name: Check Build Scan url
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
|
||||||
|
89
.github/workflows/integ-test-inject-develocity.yml
vendored
Normal file
89
.github/workflows/integ-test-inject-develocity.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: Test develocity injection
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
secrets:
|
||||||
|
DEVELOCITY_ACCESS_KEY:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
inject-develocity:
|
||||||
|
env:
|
||||||
|
DEVELOCITY_INJECTION_ENABLED: true
|
||||||
|
DEVELOCITY_URL: https://ge.solutions-team.gradle.com
|
||||||
|
DEVELOCITY_PLUGIN_VERSION: 3.16.2
|
||||||
|
DEVELOCITY_CCUD_PLUGIN_VERSION: 1.12.1
|
||||||
|
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} # This env var has not (yet) been renamed/aliased in GE plugin 3.16.2
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 8
|
||||||
|
- name: Setup Gradle
|
||||||
|
id: setup-gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
gradle-version: ${{ matrix.gradle }}
|
||||||
|
- name: Run Gradle build
|
||||||
|
id: gradle
|
||||||
|
working-directory: .github/workflow-samples/no-ge
|
||||||
|
run: gradle help
|
||||||
|
- name: Check Build Scan url
|
||||||
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
build-scan-publish:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 8
|
||||||
|
- name: Setup Gradle
|
||||||
|
id: setup-gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
gradle-version: ${{ matrix.gradle }}
|
||||||
|
build-scan-publish: true
|
||||||
|
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
|
||||||
|
build-scan-terms-of-service-agree: "yes"
|
||||||
|
- name: Run Gradle build
|
||||||
|
id: gradle
|
||||||
|
working-directory: .github/workflow-samples/no-ge
|
||||||
|
run: gradle help
|
||||||
|
- name: Check Build Scan url
|
||||||
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -30,9 +26,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle with v6.9
|
- name: Setup Gradle with v6.9
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -55,6 +49,17 @@ jobs:
|
|||||||
- name: Test use release-candidate
|
- name: Test use release-candidate
|
||||||
working-directory: .github/workflow-samples/no-wrapper
|
working-directory: .github/workflow-samples/no-wrapper
|
||||||
run: gradle help
|
run: gradle help
|
||||||
|
- name: Setup Gradle with current
|
||||||
|
id: gradle-current
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: current
|
||||||
|
- name: Check current version output parameter
|
||||||
|
if: ${{ !startsWith(steps.gradle-current.outputs.gradle-version , '8.') }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"')
|
||||||
|
|
||||||
gradle-versions:
|
gradle-versions:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -71,28 +76,33 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 8
|
java-version: 8
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
|
id: setup-gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
gradle-version: ${{ matrix.gradle }}
|
gradle-version: ${{ matrix.gradle }}
|
||||||
|
- name: Check output parameter
|
||||||
|
if: ${{ steps.setup-gradle.outputs.gradle-version != matrix.gradle }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.setup-gradle.outputs.gradle-version }}"')
|
||||||
- name: Run Gradle build
|
- name: Run Gradle build
|
||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url
|
- name: Check Build Scan url
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,12 +8,11 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
secrets:
|
||||||
type: boolean
|
GRADLE_ENCRYPTION_KEY:
|
||||||
default: false
|
required: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -27,16 +26,21 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Groovy build with configuration-cache enabled
|
- name: Groovy build with configuration-cache enabled
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
verify-build-groovy:
|
verify-build-groovy:
|
||||||
env:
|
env:
|
||||||
@@ -48,23 +52,30 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Groovy build with configuration-cache enabled
|
- name: Groovy build with configuration-cache enabled
|
||||||
id: execute
|
id: execute
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: gradle test --configuration-cache
|
||||||
- name: Check that configuration-cache was used
|
- name: Check that configuration-cache was used
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
uses: actions/github-script@v7
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
const fs = require('fs')
|
||||||
|
if (fs.existsSync('.github/workflow-samples/groovy-dsl/task-configured.txt')) {
|
||||||
|
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||||
|
}
|
||||||
|
|
||||||
# Check that the build can run when no extracted cache entries are restored
|
# Check that the build can run when no extracted cache entries are restored
|
||||||
gradle-user-home-not-fully-restored:
|
gradle-user-home-not-fully-restored:
|
||||||
@@ -77,18 +88,23 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
||||||
with:
|
with:
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Check execute Gradle build with configuration cache enabled (but not restored)
|
- name: Check execute Gradle build with configuration cache enabled (but not restored)
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
seed-build-kotlin:
|
seed-build-kotlin:
|
||||||
env:
|
env:
|
||||||
@@ -99,16 +115,21 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Execute 'help' with configuration-cache enabled
|
- name: Execute 'help' with configuration-cache enabled
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew help --configuration-cache
|
run: gradle help --configuration-cache
|
||||||
|
|
||||||
modify-build-kotlin:
|
modify-build-kotlin:
|
||||||
env:
|
env:
|
||||||
@@ -120,16 +141,21 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Execute 'test' with configuration-cache enabled
|
- name: Execute 'test' with configuration-cache enabled
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
# Test restore configuration-cache from the third build invocation
|
# Test restore configuration-cache from the third build invocation
|
||||||
verify-build-kotlin:
|
verify-build-kotlin:
|
||||||
@@ -142,21 +168,28 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
- name: Setup Java to ensure consistency
|
||||||
uses: ./.github/actions/download-dist
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
- name: Execute 'test' again with configuration-cache enabled
|
- name: Execute 'test' again with configuration-cache enabled
|
||||||
id: execute
|
id: execute
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: gradle test --configuration-cache
|
||||||
- name: Check that configuration-cache was used
|
- name: Check that configuration-cache was used
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
uses: actions/github-script@v7
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
const fs = require('fs')
|
||||||
|
if (fs.existsSync('.github/workflow-samples/kotlin-dsl/task-configured.txt')) {
|
||||||
|
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -5,12 +5,8 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
cache-key-prefix:
|
cache-key-prefix:
|
||||||
type: string
|
type: string
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -20,11 +16,9 @@ jobs:
|
|||||||
container: fedora:latest
|
container: fedora:latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
@@ -43,11 +37,9 @@ jobs:
|
|||||||
container: fedora:latest
|
container: fedora:latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
@@ -5,12 +5,8 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
cache-key-prefix:
|
cache-key-prefix:
|
||||||
type: string
|
type: string
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -23,9 +19,7 @@ jobs:
|
|||||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -44,9 +38,7 @@ jobs:
|
|||||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -65,9 +57,7 @@ jobs:
|
|||||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-gradle-home-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
@@ -26,9 +22,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -46,9 +40,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -66,9 +58,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -86,9 +76,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
@@ -99,3 +87,38 @@ jobs:
|
|||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test
|
run: ./gradlew test
|
||||||
|
|
||||||
|
# Test that a pre-existing gradle-user-home can be overwritten by the restored cache
|
||||||
|
pre-existing-gradle-home:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Pre-create Gradle User Home
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.gradle/caches
|
||||||
|
touch ~/.gradle/gradle.properties
|
||||||
|
touch ~/.gradle/caches/dummy.txt
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
cache-overwrite-existing: true
|
||||||
|
- name: Check that pre-existing content still exists
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -e ~/.gradle/caches/dummy.txt ]; then
|
||||||
|
echo "::error ::Should find dummy.txt after cache restore"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -e ~/.gradle/gradle.properties ]; then
|
||||||
|
echo "::error ::Should find gradle.properties after cache restore"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Execute Gradle build with --offline
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test --offline
|
||||||
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -45,9 +39,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -44,9 +38,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@@ -8,12 +8,8 @@ on:
|
|||||||
runner-os:
|
runner-os:
|
||||||
type: string
|
type: string
|
||||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
download-dist:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
@@ -25,9 +21,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -44,9 +38,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Download distribution if required
|
|
||||||
uses: ./.github/actions/download-dist
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
28
.github/workflows/purge-old-workflow-runs.yml
vendored
28
.github/workflows/purge-old-workflow-runs.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
name: Purge old workflow runs
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
days:
|
|
||||||
description: 'Purge runs older than days'
|
|
||||||
required: true
|
|
||||||
default: 30
|
|
||||||
minimum_runs:
|
|
||||||
description: 'The minimum runs to keep for each workflow.'
|
|
||||||
required: true
|
|
||||||
default: 6
|
|
||||||
delete_workflow_pattern:
|
|
||||||
description: 'The name of the workflow. if not set then it will target all workflows.'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
del_runs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Purge workflow runs
|
|
||||||
uses: Mattraks/delete-workflow-runs@v2
|
|
||||||
with:
|
|
||||||
token: ${{ github.token }}
|
|
||||||
repository: ${{ github.repository }}
|
|
||||||
retain_days: ${{ github.event.inputs.days }}
|
|
||||||
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
|
|
||||||
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -102,5 +102,3 @@ __tests__/runner/*
|
|||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
# ASDF tool configuration
|
|
||||||
.tool-versions
|
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
dist/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 120,
|
|
||||||
"tabWidth": 4,
|
|
||||||
"useTabs": false,
|
|
||||||
"semi": false,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "none",
|
|
||||||
"bracketSpacing": false,
|
|
||||||
"arrowParens": "avoid",
|
|
||||||
"parser": "typescript"
|
|
||||||
}
|
|
2
LICENSE
2
LICENSE
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 GitHub, Inc. and contributors
|
Copyright (c) 2023 Gradle Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
623
README.md
623
README.md
@@ -1,13 +1,45 @@
|
|||||||
|
> [!IMPORTANT]
|
||||||
|
> As of `v3` this action has been superceded by `gradle/actions/setup-gradle`.
|
||||||
|
> Any workflow that uses `gradle/gradle-build-action@v3` will transparently delegate to `gradle/actions/setup-gradle@v3`.
|
||||||
|
>
|
||||||
|
> Users are encouraged to update their workflows, replacing:
|
||||||
|
> ```
|
||||||
|
> uses: gradle/gradle-build-action@v3
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> with
|
||||||
|
> ```
|
||||||
|
> uses: gradle/actions/setup-gradle@v3
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> See the [setup-gradle documentation](https://github.com/gradle/actions/tree/main/setup-gradle) for up-to-date documentation for `gradle/actons/setup-gradle`.
|
||||||
|
|
||||||
# Execute Gradle builds in GitHub Actions workflows
|
# Execute Gradle builds in GitHub Actions workflows
|
||||||
|
|
||||||
This GitHub Action can be used to configure Gradle and optionally execute a Gradle build on any platform supported by GitHub Actions.
|
This GitHub Action can be used to configure Gradle and optionally execute a Gradle build on any platform supported by GitHub Actions.
|
||||||
|
|
||||||
|
## Why use the `gradle-build-action`?
|
||||||
|
|
||||||
|
It is possible to directly invoke Gradle in your workflow, and the `actions/setup-java@v4` action provides a simple way to cache Gradle dependencies.
|
||||||
|
|
||||||
|
However, the `gradle-build-action` offers a number of advantages over this approach:
|
||||||
|
|
||||||
|
- Easily [configure your workflow to use a specific version of Gradle](#choose-a-specific-gradle-version) using the `gradle-version` parameter. Gradle distributions are automatically downloaded and cached.
|
||||||
|
- More sophisticated and more efficient caching of Gradle User Home between invocations, compared to `setup-java` and most custom configurations using `actions/cache`. [More details below](#caching-build-state-between-jobs).
|
||||||
|
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
||||||
|
- [Generate and Submit a GitHub Dependency Graph](#github-dependency-graph-support) for your project, enabling Dependabot security alerts.
|
||||||
|
- [Automatic capture of Build Scan® links](#build-reporting) from the build, making these easier to locate for workflow run.
|
||||||
|
|
||||||
|
The `gradle-build-action` is designed to provide these benefits with minimal configuration.
|
||||||
|
These features work both when Gradle is executed via the `gradle-build-action` and for any Gradle execution in subsequent steps.
|
||||||
|
|
||||||
## Use the action to setup Gradle
|
## Use the action to setup Gradle
|
||||||
|
|
||||||
If you have an existing workflow invoking Gradle, you can add an initial "Setup Gradle" Step to benefit from caching,
|
The recommended way to use the `gradle-build-action` is in an initial "Setup Gradle" step, with subsequent steps invoking Gradle directly with a `run` step. This makes the action minimally invasive, and allows a workflow to configure and execute a Gradle execution in any way.
|
||||||
build-scan capture and other features of the gradle-build-action.
|
|
||||||
|
The `gradle-build-action` works by configuring environment variables and by adding a set of Gradle init-scripts to the Gradle User Home. These will apply to all Gradle executions on the runner, no matter how Gradle is invoked.
|
||||||
|
This means that if you have an existing workflow that executes Gradle with a `run` step, you can add an initial "Setup Gradle" Step to benefit from caching, build-scan capture and other features of the gradle-build-action.
|
||||||
|
|
||||||
All subsequent Gradle invocations will benefit from this initial setup, via `init` scripts added to the Gradle User Home.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Run Gradle on PRs
|
name: Run Gradle on PRs
|
||||||
@@ -19,42 +51,26 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v3
|
||||||
|
|
||||||
- name: Execute Gradle build
|
- name: Execute Gradle build
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Why use the `gradle-build-action`?
|
## Choose a specific Gradle version
|
||||||
|
|
||||||
It is possible to directly invoke Gradle in your workflow, and the `actions/setup-java@v3` action provides a simple way to cache Gradle dependencies.
|
|
||||||
|
|
||||||
However, the `gradle-build-action` offers a number of advantages over this approach:
|
|
||||||
|
|
||||||
- Easily [run the build with different versions of Gradle](#download-install-and-use-a-specific-gradle-version) using the `gradle-version` parameter. Gradle distributions are automatically downloaded and cached.
|
|
||||||
- More sophisticated and more efficient caching of Gradle User Home between invocations, compared to `setup-java` and most custom configurations using `actions/cache`. [More details below](#caching).
|
|
||||||
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
|
||||||
- [Automatic capture of build scan links](#build-scans) from the build, making these easier to locate for workflow run.
|
|
||||||
|
|
||||||
The `gradle-build-action` is designed to provide these benefits with minimal configuration.
|
|
||||||
These features work both when Gradle is executed via the `gradle-build-action` and for any Gradle execution in subsequent steps.
|
|
||||||
|
|
||||||
When using `gradle-build-action` we recommend that you _not_ use `actions/cache` or `actions/setup-java@v3` to explicitly cache the Gradle User Home. Doing so may interfere with the caching provided by this action.
|
|
||||||
|
|
||||||
## Use a specific Gradle version
|
|
||||||
|
|
||||||
The `gradle-build-action` can download and install a specified Gradle version, adding this installed version to the PATH.
|
The `gradle-build-action` can download and install a specified Gradle version, adding this installed version to the PATH.
|
||||||
Downloaded Gradle versions are stored in the GitHub Actions cache, to avoid requiring downloading again later.
|
Downloaded Gradle versions are stored in the GitHub Actions cache, to avoid requiring downloading again later.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: gradle/gradle-build-action@v2
|
- uses: gradle/gradle-build-action@v3
|
||||||
with:
|
with:
|
||||||
gradle-version: 6.5
|
gradle-version: 6.5
|
||||||
```
|
```
|
||||||
@@ -73,6 +89,8 @@ Moreover, you can use the following aliases:
|
|||||||
|
|
||||||
This can be handy to automatically verify your build works with the latest release candidate of Gradle:
|
This can be handy to automatically verify your build works with the latest release candidate of Gradle:
|
||||||
|
|
||||||
|
The actual Gradle version used is available as an action output: `gradle-version`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Test latest Gradle RC
|
name: Test latest Gradle RC
|
||||||
on:
|
on:
|
||||||
@@ -82,179 +100,121 @@ jobs:
|
|||||||
gradle-rc:
|
gradle-rc:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
|
distribution: temurin
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- uses: gradle/gradle-build-action@v2
|
- uses: gradle/gradle-build-action@v3
|
||||||
|
id: setup-gradle
|
||||||
with:
|
with:
|
||||||
gradle-version: release-candidate
|
gradle-version: release-candidate
|
||||||
- run: gradle build --dry-run # just test build configuration
|
- run: gradle build --dry-run # just test build configuration
|
||||||
|
- run: echo "The release-candidate version was ${{ steps.setup-gradle.outputs.gradle-version }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Gradle Execution
|
## Caching build state between Jobs
|
||||||
|
|
||||||
If the action is configured with an `arguments` input, then Gradle will execute a Gradle build with the arguments provided.
|
The `gradle-build-action` will use the GitHub Actions cache to save and restore reusable state that may be speed up a subsequent build invocation. This includes most content that is downloaded from the internet as part of a build, as well as expensive to create content like compiled build scripts, transformed Jar files, etc.
|
||||||
|
|
||||||
If no `arguments` are provided, the action will not execute Gradle, but will still cache Gradle state and configure build-scan capture for all subsequent Gradle executions.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Run Gradle on PRs
|
|
||||||
on: pull_request
|
|
||||||
jobs:
|
|
||||||
gradle:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: 11
|
|
||||||
|
|
||||||
- name: Setup and execute Gradle 'test' task
|
|
||||||
uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Multiple Gradle executions in the same Job
|
|
||||||
|
|
||||||
It is possible to configure multiple Gradle executions to run sequentially in the same job.
|
|
||||||
The initial Action step will perform the Gradle setup.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: assemble
|
|
||||||
- uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: check
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gradle command-line arguments
|
|
||||||
|
|
||||||
The `arguments` input can be used to pass arbitrary arguments to the `gradle` command line.
|
|
||||||
Arguments can be supplied in a single line, or as a multi-line input.
|
|
||||||
|
|
||||||
Here are some valid examples:
|
|
||||||
```yaml
|
|
||||||
arguments: build
|
|
||||||
arguments: check --scan
|
|
||||||
arguments: some arbitrary tasks
|
|
||||||
arguments: build -PgradleProperty=foo
|
|
||||||
arguments: |
|
|
||||||
build
|
|
||||||
--scan
|
|
||||||
-PgradleProperty=foo
|
|
||||||
-DsystemProperty=bar
|
|
||||||
```
|
|
||||||
|
|
||||||
If you need to pass environment variables, use the GitHub Actions workflow syntax:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: gradle/gradle-build-action@v2
|
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
with:
|
|
||||||
arguments: build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gradle build located in a subdirectory
|
|
||||||
|
|
||||||
By default, the action will execute Gradle in the root directory of your project.
|
|
||||||
Use the `build-root-directory` input to target a Gradle build in a subdirectory.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: build
|
|
||||||
build-root-directory: some/subdirectory
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using a specific Gradle executable
|
|
||||||
|
|
||||||
The action will first look for a Gradle wrapper script in the root directory of your project.
|
|
||||||
If not found, `gradle` will be executed from the PATH.
|
|
||||||
Use the `gradle-executable` input to execute using a specific Gradle installation.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: gradle/gradle-build-action@v2
|
|
||||||
with:
|
|
||||||
arguments: build
|
|
||||||
gradle-executable: /path/to/installed/gradle
|
|
||||||
```
|
|
||||||
|
|
||||||
This mechanism can also be used to target a Gradle wrapper script that is located in a non-default location.
|
|
||||||
|
|
||||||
## Caching
|
|
||||||
|
|
||||||
By default, this action aims to cache any and all reusable state that may be speed up a subsequent build invocation.
|
|
||||||
|
|
||||||
The state that is cached includes:
|
The state that is cached includes:
|
||||||
- Any distributions downloaded to satisfy a `gradle-version` parameter ;
|
- Any distributions downloaded to satisfy a `gradle-version` parameter ;
|
||||||
- A subset of the Gradle User Home directory, including downloaded dependencies, wrapper distributions, and the local build cache ;
|
- A subset of the Gradle User Home directory, including downloaded dependencies, wrapper distributions, and the local build cache ;
|
||||||
- Any [configuration-cache](https://docs.gradle.org/nightly/userguide/configuration_cache.html) data stored in the project `.gradle` directory. (Only supported for Gradle 7 or higher.)
|
|
||||||
|
|
||||||
To reduce the space required for caching, this action makes a best effort to reduce duplication in cache entries.
|
To reduce the space required for caching, this action makes a best effort to reduce duplication in cache entries.
|
||||||
|
|
||||||
|
State will be restored from the cache during the first `gradle-build-action` step for any workflow job, and cache entries will be written back to the cache at the end of the job, after all Gradle executions have completed.
|
||||||
|
|
||||||
|
### Disabling caching
|
||||||
|
|
||||||
Caching is enabled by default. You can disable caching for the action as follows:
|
Caching is enabled by default. You can disable caching for the action as follows:
|
||||||
```yaml
|
```yaml
|
||||||
cache-disabled: true
|
cache-disabled: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cache keys
|
### Using the cache read-only
|
||||||
|
|
||||||
Distributions downloaded to satisfy a `gradle-version` parameter are stored outside of Gradle User Home and cached separately. The cache key is unique to the downloaded distribution and will not change over time.
|
By default, the `gradle-build-action` will only write to the cache from Jobs on the default (`main`/`master`) branch.
|
||||||
|
Jobs on other branches will read entries from the cache but will not write updated entries.
|
||||||
|
See [Optimizing cache effectiveness](#select-which-branches-should-write-to-the-cache) for a more detailed explanation.
|
||||||
|
|
||||||
The state of the Gradle User Home and configuration-cache are highly dependent on the Gradle execution, so the cache key is composed of the current commit hash and the GitHub actions job id.
|
In some circumstances it makes sense to change this default, and to configure a workflow Job to read existing cache entries but not to write changes back.
|
||||||
As such, the cache key is likely to change on each subsequent run of GitHub actions.
|
|
||||||
This allows the most recent state to always be available in the GitHub actions cache.
|
|
||||||
|
|
||||||
To reduce duplication between cache entries, certain artifacts are cached independently based on their identity.
|
You can configure read-only caching for the `gradle-build-action` as follows:
|
||||||
Artifacts that are cached independently include downloaded dependencies, downloaded wrapper distributions and generated Gradle API jars.
|
|
||||||
For example, this means that all jobs executing a particular version of the Gradle wrapper will share common entries for wrapper distributions and for generated Gradle API jars.
|
|
||||||
|
|
||||||
### Using the caches read-only
|
|
||||||
|
|
||||||
In some circumstances, it makes sense for a Gradle invocation to read any existing cache entries but not to write changes back.
|
|
||||||
For example, you may want to write cache entries for builds on your `main` branch, but not for any PR build invocations.
|
|
||||||
|
|
||||||
You can enable read-only caching for any of the caches as follows:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Only write to the cache for builds on the 'main' branch.
|
cache-read-only: true
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also configure read-only caching only for certain branches:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Only write to the cache for builds on the 'main' and 'release' branches. (Default is 'main' only.)
|
||||||
# Builds on other branches will only read existing entries from the cache.
|
# Builds on other branches will only read existing entries from the cache.
|
||||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/release' }}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Gradle User Home cache tuning
|
### Using the cache write-only
|
||||||
|
|
||||||
As well as any wrapper distributions, the action will attempt to save and restore the `caches` and `notifications` directories from Gradle User Home.
|
In certain circumstances it may be desirable to start with a clean Gradle User Home state, but to save that state at the end of a workflow Job:
|
||||||
|
|
||||||
The contents to be cached can be fine tuned by including and excluding certain paths with Gradle User Home.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Cache downloaded JDKs in addition to the default directories.
|
cache-write-only: true
|
||||||
gradle-home-cache-includes: |
|
|
||||||
caches
|
|
||||||
notifications
|
|
||||||
jdks
|
|
||||||
# Exclude the local build-cache from the directories cached.
|
|
||||||
gradle-home-cache-excludes: |
|
|
||||||
caches/build-cache-1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can specify any number of fixed paths or patterns to include or exclude.
|
### Overwriting an existing Gradle User Home
|
||||||
File pattern support is documented at https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#patterns-to-match-file-paths.
|
|
||||||
|
When the action detects that the Gradle User Home caches directory already exists (`~/.gradle/caches`), then by default it will not overwrite the existing content of this directory.
|
||||||
|
This can occur when a prior action initializes this directory, or when using a self-hosted runner that retains this directory between uses.
|
||||||
|
|
||||||
|
In this case the Job Summary will display a message like:
|
||||||
|
> Caching for gradle-build-action was disabled due to pre-existing Gradle User Home
|
||||||
|
|
||||||
|
If you want override the default and have the `gradle-build-action` caches overwrite existing content in the Gradle User Home, you can set the `cache-overwrite-existing` parameter to 'true':
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cache-overwrite-existing: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Saving configuration-cache data
|
||||||
|
|
||||||
|
When Gradle is executed with the [configuration-cache](https://docs.gradle.org/current/userguide/configuration_cache.html) enabled, the configuration-cache data is stored
|
||||||
|
in the project directory, at `<project-dir>/.gradle/configuration-cache`. Due to the way the configuration-cache works, [this file may contain stored credentials and other
|
||||||
|
secrets](https://docs.gradle.org/release-nightly/userguide/configuration_cache.html#config_cache:secrets), and this data needs to be encrypted in order to be safely stored in the GitHub Actions cache.
|
||||||
|
|
||||||
|
In order to benefit from configuration caching in your GitHub Actions workflow, you must:
|
||||||
|
- Execute your build with Gradle 8.6 or newer. This can be achieved directly, or via the Gradle Wrapper.
|
||||||
|
- Enable the configuration cache for your build.
|
||||||
|
- Generate a [valid Gradle encryption key](https://docs.gradle.org/8.6-rc-1/userguide/configuration_cache.html#config_cache:secrets:configuring_encryption_key) and save it as a [GitHub Actions secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
|
||||||
|
- Provide the secret key via the `cache-encryption-key` action parameter.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
gradle-with-configuration-cache:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: gradle/gradle-build-action@v3
|
||||||
|
with:
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
|
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
|
||||||
|
- run: gradle build --configuration-cache
|
||||||
|
```
|
||||||
|
|
||||||
|
### Incompatibility with other caching mechanisms
|
||||||
|
|
||||||
|
When using `gradle-build-action` we recommend that you avoid using other mechanisms to save and restore the Gradle User Home.
|
||||||
|
|
||||||
|
Specifically:
|
||||||
|
- Avoid using `actions/cache` configured to cache the Gradle User Home, [as described in this example](https://github.com/actions/cache/blob/main/examples.md#java---gradle).
|
||||||
|
- Avoid using `actions/setup-java` with the `cache: gradle` option, [as described here](https://github.com/actions/setup-java#caching-gradle-dependencies).
|
||||||
|
|
||||||
|
Using either of these mechanisms may interfere with the caching provided by this action. If you choose to use a different mechanism to save and restore the Gradle User Home, you should disable the caching provided by this action, as described above.
|
||||||
|
|
||||||
### Cache debugging and analysis
|
### Cache debugging and analysis
|
||||||
|
|
||||||
Gradle User Home state will be restored from the cache during the first `gradle-build-action` step for any workflow job.
|
A report of all cache entries restored and saved is printed to the Job Summary when saving the cache entries.
|
||||||
This state will be saved back to the cache at the end of the job, after all Gradle executions have completed.
|
This report can provide valuable insight into how much cache space is being used.
|
||||||
A report of all cache entries restored and saved is printed to the action log when saving the cache entries.
|
|
||||||
This report can provide valuable insignt into how much cache space is being used.
|
|
||||||
|
|
||||||
It is possible to enable additional debug logging for cache operations. You do via the `GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED` environment variable:
|
It is possible to enable additional debug logging for cache operations. You do via the `GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED` environment variable:
|
||||||
|
|
||||||
@@ -265,33 +225,219 @@ env:
|
|||||||
|
|
||||||
Note that this setting will also prevent certain cache operations from running in parallel, further assisting with debugging.
|
Note that this setting will also prevent certain cache operations from running in parallel, further assisting with debugging.
|
||||||
|
|
||||||
### Optimizing cache effectiveness
|
## How Gradle User Home caching works
|
||||||
|
|
||||||
Cache storage space for GitHub actions is limited, and writing new cache entries can trigger the deletion of exising entries.
|
### Properties of the GitHub Actions cache
|
||||||
|
|
||||||
|
The GitHub Actions cache has some properties that present problems for efficient caching of the Gradle User Home.
|
||||||
|
- Immutable entries: once a cache entry is written for a key, it cannot be overwritten or changed.
|
||||||
|
- Branch scope: cache entries written for a Git branch are not visible from actions running against different branches. Entries written for the default branch are visible to all. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
|
||||||
|
- Restore keys: if no exact match is found, a set of partial keys can be provided that will match by cache key prefix. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||||
|
|
||||||
|
Each of these properties has influenced the design and implementation of the caching in `gradle-build-action`, as described below.
|
||||||
|
|
||||||
|
### Which content is cached
|
||||||
|
|
||||||
|
Using experiments and observations, we have attempted to identify which Gradle User Home content is worth saving and restoring between build invocations. We considered both the respective size of the content and the impact this content has on build times. As well as the obvious candidates like downloaded dependencies, we saw that compiled build scripts, transformed Jar files and other content can also have a significant impact.
|
||||||
|
|
||||||
|
In the end, we opted to save and restore as much content as is practical, including:
|
||||||
|
- `caches/<version>/generated-gradle-jars`: These files are generated on first use of a particular Gradle version, and are expensive to recreate
|
||||||
|
- `caches/<version>/kotlin-dsl` and `caches/<version>/scripts`: These are the compiled build scripts. The Kotlin ones in particular can benefit from caching.
|
||||||
|
- `caches/modules-2`: The downloaded dependencies
|
||||||
|
- `caches/transforms-3`: The results of artifact transforms
|
||||||
|
- `caches/jars-9`: Jar files that have been processed/instrumented by Gradle
|
||||||
|
- `caches/build-cache-1`: The local build cache
|
||||||
|
|
||||||
|
In certain cases a particular section of Gradle User Home will be too large to make caching effective. In these cases, particular subdirectories can be excluded from caching. See [Exclude content from Gradle User Home cache](#exclude-content-from-gradle-user-home-cache).
|
||||||
|
|
||||||
|
### Cache keys
|
||||||
|
|
||||||
|
The actual content of the Gradle User Home after a build is the result of many factors, including:
|
||||||
|
- Core Gradle build files (`settings.gradle[.kts]`, `build.gradle[.kts]`, `gradle.properties`)
|
||||||
|
- Associated Gradle configuration files (`gradle-wrapper.properties`, `dependencies.toml`, etc)
|
||||||
|
- The entire content of `buildSrc` or any included builds that provide plugins.
|
||||||
|
- The entire content of the repository, in the case of the local build cache.
|
||||||
|
- The actual build command that was invoked, including system properties and environment variables.
|
||||||
|
|
||||||
|
For this reason, it's very difficult to create a cache key that will deterministically map to a saved Gradle User Home state. So instead of trying to reliably hash all of these inputs to generate a cache key, the Gradle User Home cache key is based on the currently executing Job and the current commit hash for the repository.
|
||||||
|
|
||||||
|
The Gradle User Home cache key is composed of:
|
||||||
|
- The current operating system (`RUNNER_OS`)
|
||||||
|
- The Job id
|
||||||
|
- A hash of the Job matrix parameters and the workflow name
|
||||||
|
- The git SHA for the latest commit
|
||||||
|
|
||||||
|
Specifically, the cache key is: `${cache-protocol}-gradle|${runner-os}|${job-id}[${hash-of-job-matrix-and-workflow-name}]-${git-sha}`
|
||||||
|
|
||||||
|
As such, the cache key is likely to change on each subsequent run of GitHub actions.
|
||||||
|
This allows the most recent state to always be available in the GitHub actions cache.
|
||||||
|
|
||||||
|
### Finding a matching cache entry
|
||||||
|
|
||||||
|
In most cases, no exact match will exist for the cache key. Instead, the Gradle User Home will be restored for the closest matching cache entry, using a set of "restore keys". The entries will be matched with the following precedence:
|
||||||
|
- An exact match on OS, job id, workflow name, matrix and Git SHA
|
||||||
|
- The most recent entry saved for the same OS, job id, workflow name and matrix values
|
||||||
|
- The most recent entry saved for the same OS and job id
|
||||||
|
- The most recent entry saved for the same OS
|
||||||
|
|
||||||
|
Due to branch scoping of cache entries, the above match will be first performed for entries from the same branch, and then for the default ('main') branch.
|
||||||
|
|
||||||
|
After the Job is complete, the current Gradle User Home state will be collected and written as a new cache entry with the complete cache key. Old entries will be expunged from the GitHub Actions cache on a least-recently-used basis.
|
||||||
|
|
||||||
|
Note that while effective, this mechanism is not inherently efficient. It requires the entire Gradle User Home directory to be stored separately for each branch, for every OS+Job+Matrix combination. In addition, a new cache entry to be written on every GitHub Actions run.
|
||||||
|
|
||||||
|
This inefficiency is effectively mitigated by [Deduplication of Gradle User Home cache entries](#deduplication-of-gradle-user-home-cache-entries), and can be further optimized for a workflow using the techniques described in [Optimizing cache effectiveness](#optimizing-cache-effectiveness).
|
||||||
|
|
||||||
|
### Deduplication of Gradle User Home cache entries
|
||||||
|
|
||||||
|
To reduce duplication between cache entries, certain artifacts in Gradle User Home are extracted and cached independently based on their identity. This allows each Gradle User Home cache entry to be relatively small, sharing common elements between them without duplication.
|
||||||
|
|
||||||
|
Artifacts that are cached independently include:
|
||||||
|
- Downloaded dependencies
|
||||||
|
- Downloaded wrapper distributions
|
||||||
|
- Generated Gradle API jars
|
||||||
|
- Downloaded Java Toolchains
|
||||||
|
|
||||||
|
For example, this means that all jobs executing a particular version of the Gradle wrapper will share a single common entry for this wrapper distribution and one for each of the generated Gradle API jars.
|
||||||
|
|
||||||
|
### Stopping the Gradle daemon
|
||||||
|
|
||||||
|
By default, the action will stop all running Gradle daemons in the post-action step, prior to saving the Gradle User Home state.
|
||||||
|
This allows for any Gradle User Home cleanup to occur, and avoid file-locking issues on Windows.
|
||||||
|
|
||||||
|
If caching is disabled or the cache is in read-only mode, the daemon will not be stopped and will continue running after the job is completed.
|
||||||
|
|
||||||
|
## Optimizing cache effectiveness
|
||||||
|
|
||||||
|
Cache storage space for GitHub actions is limited, and writing new cache entries can trigger the deletion of existing entries.
|
||||||
Eviction of shared cache entries can reduce cache effectiveness, slowing down your `gradle-build-action` steps.
|
Eviction of shared cache entries can reduce cache effectiveness, slowing down your `gradle-build-action` steps.
|
||||||
|
|
||||||
There are a number of actions you can take if your cache use is less effective due to entry eviction.
|
There are a number of actions you can take if your cache use is less effective due to entry eviction.
|
||||||
|
|
||||||
#### Only write to the cache from the default branch
|
At the end of a Job, the `gradle-build-action` will write a summary of the Gradle builds executed, together with a detailed report of the cache entries that were read and written during the Job. This report can provide valuable insights that may help to determine the right way to optimize the cache usage for your workflow.
|
||||||
|
|
||||||
GitHub cache entries are not shared between builds on different branches. This means that identical cache entries will be stored separately for different branches.
|
### Select which jobs should write to the cache
|
||||||
The exception to the is cache entries for the default (`master`/`main`) branch can be read by actions invoked for other branches.
|
|
||||||
|
|
||||||
An easy way to reduce cache usage when you run builds on many different branches is to only permit your default branch to write to the cache,
|
Consider a workflow that first runs a Job "compile-and-unit-test" to compile the code and run some basic unit tests, which is followed by a matrix of parallel "integration-test" jobs that each run a set of integration tests for the repository. Each "integration test" Job requires all of the dependencies required by "compile-and-unit-test", and possibly one or 2 additional dependencies.
|
||||||
with all other branch builds using `cache-read-only`. See [Using the caches read-only](#using-the-caches-read-only) for more details.
|
|
||||||
|
|
||||||
Similarly, you could use `cache-read-only` for certain jobs in the workflow, and instead have these jobs reuse the cache content from upstream jobs.
|
By default, a new cache entry will be written on completion of each integration test job. If no additional dependencies were downloaded then this cache entry will share the "dependencies" entry with the "compile-and-unit-test" job, but if a single dependency was downloaded then an entire new "dependencies" entry would be written. (The `gradle-build-action` does not _yet_ support a layered cache that could do this more efficiently). If each of these "integration-test" entries with their different "dependencies" entries is too large, then it could result in other important entries being evicted from the GitHub Actions cache.
|
||||||
|
|
||||||
#### Exclude content from Gradle User Home cache
|
There are some techniques that can be used to avoid/mitigate this issue:
|
||||||
|
- Configure the "integration-test" jobs with `cache-read-only: true`, meaning that the Job will use the entry written by the "compile-and-unit-test" job. This will avoid the overhead of cache entries for each of these jobs, at the expense of re-downloading any additional dependencies required by "integration-test".
|
||||||
|
- Add an additional step to the "compile-and-unit-test" job which downloads all dependencies required by the integration-test jobs but does not execute the tests. This will allow the "dependencies" entry for "compile-and-unit-test" to be shared among all cache entries for "integration-test". The resulting "integration-test" entries should be much smaller, reducing the potential for eviction.
|
||||||
|
- Combine the above 2 techniques, so that no cache entry is written by "integration-test" jobs, but all required dependencies are already present from the restored "compile-and-unit-test" entry.
|
||||||
|
|
||||||
|
### Select which branches should write to the cache
|
||||||
|
|
||||||
|
GitHub cache entries are not shared between builds on different branches.
|
||||||
|
Workflow runs can restore caches created in either the current branch or the default branch (usually main).
|
||||||
|
This means that each branch will have it's own Gradle User Home cache scope, and will not benefit from cache entries written for other (non-default) branches.
|
||||||
|
|
||||||
|
By default, the `gradle-build-action` will only _write_ to the cache for builds run on the default (`master`/`main`) branch.
|
||||||
|
Jobs run on other branches will only read from the cache. In most cases, this is the desired behavior.
|
||||||
|
This is because Jobs run on other branches will benefit from the cache Gradle User Home from `main`,
|
||||||
|
without writing private cache entries that which could lead to evicting these shared entries.
|
||||||
|
|
||||||
|
If you have other long-lived development branches that would benefit from writing to the cache,
|
||||||
|
you can configure this by disabling the `cache-read-only` action parameter for these branches.
|
||||||
|
See [Using the cache read-only](#using-the-cache-read-only) for more details.
|
||||||
|
|
||||||
|
Note there are some cases where writing cache entries is typically unhelpful (these are disabled by default):
|
||||||
|
- For `pull_request` triggered runs, the cache scope is limited to the merge ref (`refs/pull/.../merge`) and can only be restored by re-runs of the same pull request.
|
||||||
|
- For `merge_group` triggered runs, the cache scope is limited to a temporary branch with a special prefix created to validate pull request changes, and won't be available on subsequent Merge Queue executions.
|
||||||
|
|
||||||
|
|
||||||
|
### Exclude content from Gradle User Home cache
|
||||||
|
|
||||||
|
As well as any wrapper distributions, the action will attempt to save and restore the `caches` and `notifications` directories from Gradle User Home.
|
||||||
|
|
||||||
Each build is different, and some builds produce more Gradle User Home content than others.
|
Each build is different, and some builds produce more Gradle User Home content than others.
|
||||||
[Cache debugging ](#cache-debugging-and-analysis) can provide insight into which cache entries are the largest,
|
[Cache debugging ](#cache-debugging-and-analysis) can provide insight into which cache entries are the largest,
|
||||||
and you can selectively [exclude content using `gradle-home-cache-exclude`](#gradle-user-home-cache-tuning).
|
and the contents to be cached can be fine tuned by including and excluding certain paths within Gradle User Home.
|
||||||
|
|
||||||
## Saving build outputs
|
```yaml
|
||||||
|
# Cache downloaded JDKs in addition to the default directories.
|
||||||
|
gradle-home-cache-includes: |
|
||||||
|
caches
|
||||||
|
notifications
|
||||||
|
jdks
|
||||||
|
# Exclude the local build-cache and keyrings from the directories cached.
|
||||||
|
gradle-home-cache-excludes: |
|
||||||
|
caches/build-cache-1
|
||||||
|
caches/keyrings
|
||||||
|
```
|
||||||
|
|
||||||
By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build,
|
You can specify any number of fixed paths or patterns to include or exclude.
|
||||||
but any output files generated by the build will not be saved.
|
File pattern support is documented at https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#patterns-to-match-file-paths.
|
||||||
|
|
||||||
|
### Remove unused files from Gradle User Home before saving to cache
|
||||||
|
|
||||||
|
The Gradle User Home directory has a tendency to grow over time. When you switch to a new Gradle wrapper version or upgrade a dependency version
|
||||||
|
the old files are not automatically and immediately removed. While this can make sense in a local environment, in a GitHub Actions environment
|
||||||
|
it can lead to ever-larger Gradle User Home cache entries being saved and restored.
|
||||||
|
|
||||||
|
In order to avoid this situation, the `gradle-build-action` supports the `gradle-home-cache-cleanup` parameter.
|
||||||
|
When enabled, this feature will attempt to delete any files in the Gradle User Home that were not used by Gradle during the GitHub Actions workflow,
|
||||||
|
prior to saving the Gradle User Home to the GitHub Actions cache.
|
||||||
|
|
||||||
|
Gradle Home cache cleanup is considered experimental and is disabled by default. You can enable this feature for the action as follows:
|
||||||
|
```yaml
|
||||||
|
gradle-home-cache-cleanup: true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build reporting
|
||||||
|
|
||||||
|
The `gradle-build-action` collects information about any Gradle executions that occur in a workflow, including the root project,
|
||||||
|
requested tasks, build outcome and any Build Scan link generated. Details of cache entries read and written are also collected.
|
||||||
|
These details are compiled into a Job Summary, which is visible in the GitHub Actions UI.
|
||||||
|
|
||||||
|
Generation of a Job Summary is enabled by default for all Jobs using the `gradle-build-action`. This feature can be configured
|
||||||
|
so that a Job Summary is never generated, or so that a Job Summary is only generated on build failure:
|
||||||
|
```yaml
|
||||||
|
add-job-summary: 'on-failure' # Valid values are 'always' (default), 'never', and 'on-failure'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Job Summary as a Pull Request comment
|
||||||
|
|
||||||
|
It is sometimes more convenient to view the results of a GitHub Actions Job directly from the Pull Request that triggered
|
||||||
|
the Job. For this purpose you can configure the action so that Job Summary data is added as a Pull Request comment.
|
||||||
|
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-gradle-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout project sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/gradle-build-action@v3
|
||||||
|
with:
|
||||||
|
add-job-summary-as-pr-comment: on-failure # Valid values are 'never' (default), 'always', and 'on-failure'
|
||||||
|
- run: ./gradlew build --scan
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that in order to add a Pull Request comment, the workflow must be configured with the `pull-requests: write` permission.
|
||||||
|
|
||||||
|
|
||||||
|
### Build Scan® link as Step output
|
||||||
|
|
||||||
|
As well as reporting all [Build Scan](https://gradle.com/build-scans/) links in the Job Summary,
|
||||||
|
the `gradle-build-action` action makes this link available an an output of any Step that executes Gradle.
|
||||||
|
|
||||||
|
The output name is `build-scan-url`. You can then use the build scan link in subsequent actions of your workflow.
|
||||||
|
|
||||||
|
### Saving arbitrary build outputs
|
||||||
|
|
||||||
|
By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan
|
||||||
|
links for your build, but any output files generated by the build will not be saved.
|
||||||
|
|
||||||
To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action.
|
To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action.
|
||||||
For example:
|
For example:
|
||||||
@@ -302,51 +448,122 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout project sources
|
- name: Checkout project sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v3
|
||||||
- name: Run build with Gradle wrapper
|
- name: Run build with Gradle wrapper
|
||||||
run: ./gradlew build --scan
|
run: ./gradlew build --scan
|
||||||
- name: Upload build reports
|
- name: Upload build reports
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: build-reports
|
name: build-reports
|
||||||
path: build/reports/
|
path: build/reports/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build scans
|
### Use of custom init-scripts in Gradle User Home
|
||||||
|
|
||||||
If your build publishes a [build scan](https://gradle.com/build-scans/) the `gradle-build-action` action will:
|
Note that the action collects information about Gradle invocations via an [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script)
|
||||||
- Add a notice with the link to the GitHub Actions user interface
|
located at `USER_HOME/.gradle/init.d/gradle-build-action.build-result-capture.init.gradle`.
|
||||||
- For each step that executes Gradle, adds the link to the published build scan as a Step output named `build-scan-url`.
|
|
||||||
|
|
||||||
You can then use that link in subsequent actions of your workflow. For example:
|
If you are adding any custom init scripts to the `USER_HOME/.gradle/init.d` directory, it may be necessary to ensure these files are applied prior to `gradle-build-action.build-result-capture.init.gradle`.
|
||||||
|
Since Gradle applies init scripts in alphabetical order, one way to ensure this is via file naming.
|
||||||
|
|
||||||
|
## Support for GitHub Enterprise Server (GHES)
|
||||||
|
|
||||||
|
You can use the `gradle-build-action` on GitHub Enterprise Server, and benefit from the improved integration with Gradle. Depending on the version of GHES you are running, certain features may be limited:
|
||||||
|
- Build Scan links are captured and displayed in the GitHub Actions UI
|
||||||
|
- Easily run your build with different versions of Gradle
|
||||||
|
- Save/restore of Gradle User Home (requires GHES v3.5+ : GitHub Actions cache was introduced in GHES 3.5)
|
||||||
|
- Support for GitHub Actions Job Summary (requires GHES 3.6+ : GitHub Actions Job Summary support was introduced in GHES 3.6). In earlier versions of GHES the build-results summary and caching report will be written to the workflow log, as part of the post-action step.
|
||||||
|
|
||||||
|
# GitHub Dependency Graph support
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The simplest (and recommended) way to generate a dependency graph is via a separate workflow
|
||||||
|
> using `gradle/actions/dependency-submission`. This action will attempt to detect all dependencies used by your build
|
||||||
|
> without building and testing the project itself.
|
||||||
|
>
|
||||||
|
> See the [dependency-submission documentation](https://github.com/gradle/actions/blob/main/dependency-submission/README.md) for up-to-date documentation.
|
||||||
|
|
||||||
|
For documentation on directly generating a dependency graph from a Gradle execution, see the
|
||||||
|
[setup-gradle docs](https://github.com/gradle/actions/blob/main/setup-gradle/README.md#github-dependency-graph-support) on this topic.
|
||||||
|
|
||||||
|
# Develocity plugin injection
|
||||||
|
|
||||||
|
The `gradle-build-action` provides support for injecting and configuring the Develocity Gradle plugin into any Gradle build, without any modification to the project sources.
|
||||||
|
This is achieved via an init-script installed into Gradle User Home, which is enabled and parameterized via environment variables.
|
||||||
|
|
||||||
|
The same auto-injection behavior is available for the Common Custom User Data Gradle plugin, which enriches any build scans published with additional useful information.
|
||||||
|
|
||||||
|
## Enabling Develocity injection
|
||||||
|
|
||||||
|
In order to enable Develocity injection for your build, you must provide the required configuration via environment variables.
|
||||||
|
|
||||||
|
Here's a minimal example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# .github/workflows/gradle-build-pr.yml
|
name: Run build with Develocity injection
|
||||||
name: Run Gradle on PRs
|
|
||||||
on: pull_request
|
env:
|
||||||
|
DEVELOCITY_INJECTION_ENABLED: true
|
||||||
|
DEVELOCITY_URL: https://develocity.your-server.com
|
||||||
|
DEVELOCITY_PLUGIN_VERSION: 3.16.2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gradle:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout project sources
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v3
|
||||||
- name: Run build with Gradle wrapper
|
- name: Run a Gradle build with Develocity injection enabled
|
||||||
id: gradle
|
run: ./gradlew build
|
||||||
run: ./gradlew build --scan
|
|
||||||
- name: "Add build scan URL as PR comment"
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
if: github.event_name == 'pull_request' && failure()
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
script: |
|
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: '❌ ${{ github.workflow }} failed: ${{ steps.gradle.outputs.build-scan-url }}'
|
|
||||||
})
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This configuration will automatically apply `v3.16.2` of the [Develocity Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/), and publish build scans to https://develocity.your-server.com.
|
||||||
|
|
||||||
|
This example assumes that the `develocity.your-server.com` server allows anonymous publishing of build scans.
|
||||||
|
In the likely scenario that your Develocity server requires authentication, you will also need to configure an addition environment variable
|
||||||
|
with a valid [Develocity access key](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable).
|
||||||
|
|
||||||
|
## Configuring Develocity injection
|
||||||
|
|
||||||
|
The `init-script` supports a number of additional configuration parameters that you may fine useful. All configuration options (required and optional) are detailed below:
|
||||||
|
|
||||||
|
| Variable | Required | Description |
|
||||||
|
|-----------------------------------| --- | --- |
|
||||||
|
| DEVELOCITY_INJECTION_ENABLED | :white_check_mark: | enables Develocity injection |
|
||||||
|
| DEVELOCITY_URL | :white_check_mark: | the URL of the Develocity server |
|
||||||
|
| DEVELOCITY_ALLOW_UNTRUSTED_SERVER | | allow communication with an untrusted server; set to _true_ if your Develocity instance is using a self-signed certificate |
|
||||||
|
| DEVELOCITY_ENFORCE_URL | | enforce the configured Develocity URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Develocity URL |
|
||||||
|
| DEVELOCITY_PLUGIN_VERSION | :white_check_mark: | the version of the [Develocity Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/) to apply |
|
||||||
|
| DEVELOCITY_CCUD_PLUGIN_VERSION | | the version of the [Common Custom User Data Gradle plugin](https://github.com/gradle/common-custom-user-data-gradle-plugin) to apply, if any |
|
||||||
|
| GRADLE_PLUGIN_REPOSITORY_URL | | the URL of the repository to use when resolving the Develocity and CCUD plugins; the Gradle Plugin Portal is used by default |
|
||||||
|
|
||||||
|
## Publishing to scans.gradle.com
|
||||||
|
|
||||||
|
Develocity injection is designed to enable publishing of build scans to a Develocity instance,
|
||||||
|
but is also useful for publishing to the public Build Scans instance (https://scans.gradle.com).
|
||||||
|
|
||||||
|
To publish to https://scans.gradle.com, you must specify in your workflow that you accept the [Gradle Terms of Service](https://gradle.com/terms-of-service).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Run build and publish Build Scan
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle to publish build scans
|
||||||
|
uses: gradle/gradle-build-action@v3
|
||||||
|
with:
|
||||||
|
build-scan-publish: true
|
||||||
|
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
|
||||||
|
build-scan-terms-of-service-agree: "yes"
|
||||||
|
|
||||||
|
- name: Run a Gradle build - a build scan will be published automatically
|
||||||
|
run: ./gradlew build
|
||||||
|
```
|
||||||
|
|
||||||
|
@@ -1,95 +0,0 @@
|
|||||||
import {CacheEntryListener, CacheListener} from '../src/cache-reporting'
|
|
||||||
|
|
||||||
describe('caching report', () => {
|
|
||||||
describe('reports not fully restored', () => {
|
|
||||||
it('with one requested entry report', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
report.entry('foo').markRequested('1', ['2'])
|
|
||||||
report.entry('bar').markRequested('3').markRestored('4', 500)
|
|
||||||
expect(report.fullyRestored).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('reports fully restored', () => {
|
|
||||||
it('when empty', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
expect(report.fullyRestored).toBe(true)
|
|
||||||
})
|
|
||||||
it('with empty entry reports', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
report.entry('foo')
|
|
||||||
report.entry('bar')
|
|
||||||
expect(report.fullyRestored).toBe(true)
|
|
||||||
})
|
|
||||||
it('with restored entry report', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
report.entry('bar').markRequested('3').markRestored('4', 300)
|
|
||||||
expect(report.fullyRestored).toBe(true)
|
|
||||||
})
|
|
||||||
it('with multiple restored entry reportss', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
report.entry('foo').markRestored('4', 3300)
|
|
||||||
report.entry('bar').markRequested('3').markRestored('4', 333)
|
|
||||||
expect(report.fullyRestored).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
describe('can be stringified and rehydrated', () => {
|
|
||||||
it('when empty', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
|
|
||||||
const stringRep = report.stringify()
|
|
||||||
const reportClone: CacheListener = CacheListener.rehydrate(stringRep)
|
|
||||||
|
|
||||||
expect(reportClone.cacheEntries).toEqual([])
|
|
||||||
|
|
||||||
// Can call methods on rehydrated
|
|
||||||
expect(reportClone.entry('foo')).toBeInstanceOf(CacheEntryListener)
|
|
||||||
})
|
|
||||||
it('with entry reports', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
report.entry('foo')
|
|
||||||
report.entry('bar')
|
|
||||||
report.entry('baz')
|
|
||||||
|
|
||||||
const stringRep = report.stringify()
|
|
||||||
const reportClone: CacheListener = CacheListener.rehydrate(stringRep)
|
|
||||||
|
|
||||||
expect(reportClone.cacheEntries.length).toBe(3)
|
|
||||||
expect(reportClone.cacheEntries[0].entryName).toBe('foo')
|
|
||||||
expect(reportClone.cacheEntries[1].entryName).toBe('bar')
|
|
||||||
expect(reportClone.cacheEntries[2].entryName).toBe('baz')
|
|
||||||
|
|
||||||
expect(reportClone.entry('foo')).toBe(reportClone.cacheEntries[0])
|
|
||||||
})
|
|
||||||
it('with rehydrated entry report', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
const entryReport = report.entry('foo')
|
|
||||||
entryReport.markRequested('1', ['2', '3'])
|
|
||||||
entryReport.markSaved('4', 100)
|
|
||||||
|
|
||||||
const stringRep = report.stringify()
|
|
||||||
const reportClone: CacheListener = CacheListener.rehydrate(stringRep)
|
|
||||||
const entryClone = reportClone.entry('foo')
|
|
||||||
|
|
||||||
expect(entryClone.requestedKey).toBe('1')
|
|
||||||
expect(entryClone.requestedRestoreKeys).toEqual(['2', '3'])
|
|
||||||
expect(entryClone.savedKey).toBe('4')
|
|
||||||
})
|
|
||||||
it('with live entry report', async () => {
|
|
||||||
const report = new CacheListener()
|
|
||||||
const entryReport = report.entry('foo')
|
|
||||||
entryReport.markRequested('1', ['2', '3'])
|
|
||||||
|
|
||||||
const stringRep = report.stringify()
|
|
||||||
const reportClone: CacheListener = CacheListener.rehydrate(stringRep)
|
|
||||||
const entryClone = reportClone.entry('foo')
|
|
||||||
|
|
||||||
// Check type and call method on rehydrated entry report
|
|
||||||
expect(entryClone).toBeInstanceOf(CacheEntryListener)
|
|
||||||
entryClone.markSaved('4', 100)
|
|
||||||
|
|
||||||
expect(entryClone.requestedKey).toBe('1')
|
|
||||||
expect(entryClone.requestedRestoreKeys).toEqual(['2', '3'])
|
|
||||||
expect(entryClone.savedKey).toBe('4')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
@@ -1,20 +0,0 @@
|
|||||||
import * as cacheUtils from '../src/cache-utils'
|
|
||||||
|
|
||||||
describe('cacheUtils-utils', () => {
|
|
||||||
describe('can hash', () => {
|
|
||||||
it('a string', async () => {
|
|
||||||
const hash = cacheUtils.hashStrings(['foo'])
|
|
||||||
expect(hash).toBe('acbd18db4cc2f85cedef654fccc4a4d8')
|
|
||||||
})
|
|
||||||
it('multiple strings', async () => {
|
|
||||||
const hash = cacheUtils.hashStrings(['foo', 'bar', 'baz'])
|
|
||||||
expect(hash).toBe('6df23dc03f9b54cc38a0fc1483df6e21')
|
|
||||||
})
|
|
||||||
it('normalized filenames', async () => {
|
|
||||||
const fileNames = ['/foo/bar/baz.zip', '../boo.html']
|
|
||||||
const posixHash = cacheUtils.hashFileNames(fileNames)
|
|
||||||
const windowsHash = cacheUtils.hashFileNames(fileNames)
|
|
||||||
expect(posixHash).toBe(windowsHash)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
@@ -1,5 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
@@ -1,6 +0,0 @@
|
|||||||
#
|
|
||||||
# https://help.github.com/articles/dealing-with-line-endings/
|
|
||||||
#
|
|
||||||
# These are explicitly windows files and should use crlf
|
|
||||||
*.bat text eol=crlf
|
|
||||||
|
|
5
__tests__/data/crypto-utils-test/.gitignore
vendored
5
__tests__/data/crypto-utils-test/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
# Ignore Gradle project-specific cache directory
|
|
||||||
.gradle
|
|
||||||
|
|
||||||
# Ignore Gradle build output directory
|
|
||||||
build
|
|
@@ -1,11 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'java'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testImplementation('junit:junit:4.12')
|
|
||||||
}
|
|
Binary file not shown.
@@ -1,5 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
185
__tests__/data/crypto-utils-test/gradlew
vendored
185
__tests__/data/crypto-utils-test/gradlew
vendored
@@ -1,185 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## Gradle start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=`save "$@"`
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
104
__tests__/data/crypto-utils-test/gradlew.bat
vendored
104
__tests__/data/crypto-utils-test/gradlew.bat
vendored
@@ -1,104 +0,0 @@
|
|||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
@@ -1,10 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*
|
|
||||||
* The settings file is used to specify which projects to include in your build.
|
|
||||||
*
|
|
||||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
|
||||||
* in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
rootProject.name = 'basic'
|
|
@@ -1,10 +0,0 @@
|
|||||||
package basic;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class BasicTest {
|
|
||||||
@Test
|
|
||||||
public void test() {
|
|
||||||
assert true;
|
|
||||||
}
|
|
||||||
}
|
|
119
action.yml
119
action.yml
@@ -1,11 +1,11 @@
|
|||||||
name: "Gradle Build Action"
|
name: "Gradle Build Action"
|
||||||
description: 'Configures Gradle for use in GitHub actions, caching useful state in the GitHub actions cache'
|
description: 'Configures Gradle for GitHub actions, caching state and generating a dependency graph via Dependency Submission.'
|
||||||
|
|
||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
gradle-version:
|
gradle-version:
|
||||||
description: Gradle version to use
|
description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
cache-disabled:
|
cache-disabled:
|
||||||
@@ -18,7 +18,7 @@ inputs:
|
|||||||
When 'true', existing entries will be read from the cache but no entries will be written.
|
When 'true', existing entries will be read from the cache but no entries will be written.
|
||||||
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
||||||
required: false
|
required: false
|
||||||
default: ${{ github.ref_name != github.event.repository.default_branch }}
|
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
|
||||||
|
|
||||||
cache-write-only:
|
cache-write-only:
|
||||||
description: |
|
description: |
|
||||||
@@ -27,6 +27,18 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
|
cache-overwrite-existing:
|
||||||
|
description: When 'true', a pre-existing Gradle User Home will not prevent the cache from being restored.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
|
cache-encryption-key:
|
||||||
|
description: |
|
||||||
|
A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps.
|
||||||
|
A suitable key can be generated with `openssl rand -base64 16`.
|
||||||
|
Configuration-cache data will not be saved/restored without an encryption key being provided.
|
||||||
|
required: false
|
||||||
|
|
||||||
gradle-home-cache-includes:
|
gradle-home-cache-includes:
|
||||||
description: Paths within Gradle User Home to cache.
|
description: Paths within Gradle User Home to cache.
|
||||||
required: false
|
required: false
|
||||||
@@ -41,22 +53,66 @@ inputs:
|
|||||||
# gradle-home-cache-excludes: |
|
# gradle-home-cache-excludes: |
|
||||||
# caches/build-cache-1
|
# caches/build-cache-1
|
||||||
|
|
||||||
|
gradle-home-cache-cleanup:
|
||||||
|
description: When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
|
add-job-summary:
|
||||||
|
description: Specifies when a Job Summary should be inluded in the action results. Valid values are 'never', 'always' (default), and 'on-failure'.
|
||||||
|
required: false
|
||||||
|
default: 'always'
|
||||||
|
|
||||||
|
add-job-summary-as-pr-comment:
|
||||||
|
description: Specifies when each Job Summary should be added as a PR comment. Valid values are 'never' (default), 'always', and 'on-failure'. No action will be taken if the workflow was not triggered from a pull request.
|
||||||
|
required: false
|
||||||
|
default: 'never'
|
||||||
|
|
||||||
|
dependency-graph:
|
||||||
|
description: Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how. Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-and-upload', 'download-and-submit' and 'clear'.
|
||||||
|
required: false
|
||||||
|
default: 'disabled'
|
||||||
|
|
||||||
|
dependency-graph-continue-on-failure:
|
||||||
|
description: When 'false' a failure to generate or submit a dependency graph will fail the Step or Job. When 'true' a warning will be emitted but no failure will result.
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
|
||||||
|
artifact-retention-days:
|
||||||
|
description: Specifies the number of days to retain any artifacts generated by the action. If not set, the default retention settings for the repository will apply.
|
||||||
|
required: false
|
||||||
|
|
||||||
|
build-scan-publish:
|
||||||
|
description: |
|
||||||
|
Set to 'true' to automatically publish build results as a Build Scan on scans.gradle.com.
|
||||||
|
For publication to succeed without user input, you must also provide values for `build-scan-terms-of-service-url` and 'build-scan-terms-of-service-agree'.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
|
build-scan-terms-of-service-url:
|
||||||
|
description: The URL to the Build Scan® terms of service. This input must be set to 'https://gradle.com/terms-of-service'.
|
||||||
|
required: false
|
||||||
|
|
||||||
|
build-scan-terms-of-service-agree:
|
||||||
|
description: Indicate that you agree to the Build Scan® terms of service. This input value must be "yes".
|
||||||
|
required: false
|
||||||
|
|
||||||
|
# DEPRECATED ACTION INPUTS
|
||||||
arguments:
|
arguments:
|
||||||
description: Gradle command line arguments (supports multi-line input)
|
description: Gradle command line arguments (supports multi-line input)
|
||||||
required: false
|
required: false
|
||||||
|
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. See https://github.com/gradle/gradle-build-action?tab=readme-ov-file#use-the-action-to-setup-gradle.
|
||||||
|
|
||||||
build-root-directory:
|
build-root-directory:
|
||||||
description: Path to the root directory of the build
|
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
|
||||||
required: false
|
|
||||||
|
|
||||||
gradle-executable:
|
|
||||||
description: Path to the Gradle executable
|
|
||||||
required: false
|
required: false
|
||||||
|
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. See https://github.com/gradle/gradle-build-action?tab=readme-ov-file#use-the-action-to-setup-gradle.
|
||||||
|
|
||||||
generate-job-summary:
|
generate-job-summary:
|
||||||
description: When 'false', no Job Summary will be generated for the Job.
|
description: When 'false', no Job Summary will be generated for the Job.
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
deprecation-message: Superceded by the new 'add-job-summary' and 'add-job-summary-as-pr-comment' parameters.
|
||||||
|
|
||||||
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
||||||
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
||||||
@@ -66,19 +122,58 @@ inputs:
|
|||||||
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
|
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
workflow-job-context:
|
workflow-job-context:
|
||||||
description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
|
description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
|
||||||
required: false
|
required: false
|
||||||
default: ${{ toJSON(matrix) }}
|
default: ${{ toJSON(matrix) }}
|
||||||
|
|
||||||
|
github-token:
|
||||||
|
description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
|
||||||
|
default: ${{ github.token }}
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
build-scan-url:
|
build-scan-url:
|
||||||
description: Link to the build scan if any
|
description: Link to the Build Scan® generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||||
|
value: ${{ steps.setup-gradle.outputs.build-scan-url }}
|
||||||
|
dependency-graph-file:
|
||||||
|
description: Path to the GitHub Dependency Graph snapshot file generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||||
|
value: ${{ steps.setup-gradle.outputs.dependency-graph-file }}
|
||||||
|
gradle-version:
|
||||||
|
description: Version of Gradle that was setup by the action
|
||||||
|
value: ${{ steps.setup-gradle.outputs.gradle-version }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: "composite"
|
||||||
main: 'dist/main/index.js'
|
steps:
|
||||||
post: 'dist/post/index.js'
|
- name: Setup Gradle
|
||||||
|
id: setup-gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v3.0.0
|
||||||
|
with:
|
||||||
|
gradle-version: ${{ inputs.gradle-version }}
|
||||||
|
cache-disabled: ${{ inputs.cache-disabled }}
|
||||||
|
cache-read-only: ${{ inputs.cache-read-only }}
|
||||||
|
cache-write-only: ${{ inputs.cache-write-only }}
|
||||||
|
cache-overwrite-existing: ${{ inputs.cache-overwrite-existing }}
|
||||||
|
cache-encryption-key: ${{ inputs.cache-encryption-key }}
|
||||||
|
gradle-home-cache-includes: ${{ inputs.gradle-home-cache-includes }}
|
||||||
|
gradle-home-cache-excludes: ${{ inputs.gradle-home-cache-excludes }}
|
||||||
|
gradle-home-cache-cleanup: ${{ inputs.gradle-home-cache-cleanup }}
|
||||||
|
add-job-summary: ${{ inputs.add-job-summary }}
|
||||||
|
add-job-summary-as-pr-comment: ${{ inputs.add-job-summary-as-pr-comment }}
|
||||||
|
dependency-graph: ${{ inputs.dependency-graph }}
|
||||||
|
dependency-graph-continue-on-failure: ${{ inputs.dependency-graph-continue-on-failure }}
|
||||||
|
artifact-retention-days: ${{ inputs.artifact-retention-days }}
|
||||||
|
build-scan-publish: ${{ inputs.build-scan-publish }}
|
||||||
|
build-scan-terms-of-service-url: ${{ inputs.build-scan-terms-of-service-url }}
|
||||||
|
build-scan-terms-of-service-agree: ${{ inputs.build-scan-terms-of-service-agree }}
|
||||||
|
arguments: ${{ inputs.arguments }}
|
||||||
|
build-root-directory: ${{ inputs.build-root-directory }}
|
||||||
|
generate-job-summary: ${{ inputs.generate-job-summary }}
|
||||||
|
gradle-home-cache-strict-match: ${{ inputs.gradle-home-cache-strict-match }}
|
||||||
|
workflow-job-context: ${{ inputs.workflow-job-context }}
|
||||||
|
github-token: ${{ inputs.github-token }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'box'
|
icon: 'box'
|
||||||
|
66714
dist/main/index.js
vendored
66714
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/main/index.js.map
vendored
1
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
1
dist/main/sourcemap-register.js
vendored
1
dist/main/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
65398
dist/post/index.js
vendored
65398
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/post/index.js.map
vendored
1
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
1
dist/post/sourcemap-register.js
vendored
1
dist/post/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,10 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
moduleFileExtensions: ['js', 'ts', 'json'],
|
|
||||||
testEnvironment: 'node',
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
verbose: true
|
|
||||||
}
|
|
12364
package-lock.json
generated
12364
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
53
package.json
53
package.json
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "gradle-build-action",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"private": true,
|
|
||||||
"description": "Execute Gradle Build",
|
|
||||||
"scripts": {
|
|
||||||
"postinstall": "patch-package",
|
|
||||||
"format": "prettier --write **/*.ts",
|
|
||||||
"format-check": "prettier --check **/*.ts",
|
|
||||||
"lint": "eslint src/**/*.ts",
|
|
||||||
"build": "ncc build src/main.ts --out dist/main --source-map && ncc build src/post.ts --out dist/post --source-map",
|
|
||||||
"test": "jest",
|
|
||||||
"check": "npm run format && npm run lint",
|
|
||||||
"all": "npm run format && npm run lint && npm run build && npm test"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gradle/gradle-build-action.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"github-actions",
|
|
||||||
"gradle"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/cache": "2.0.5",
|
|
||||||
"@actions/core": "1.8.2",
|
|
||||||
"@actions/exec": "1.1.1",
|
|
||||||
"@actions/github": "5.0.3",
|
|
||||||
"@actions/glob": "0.3.0",
|
|
||||||
"@actions/http-client": "2.0.1",
|
|
||||||
"@actions/tool-cache": "2.0.1",
|
|
||||||
"string-argv": "0.3.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/jest": "28.1.0",
|
|
||||||
"@types/node": "16.11.21",
|
|
||||||
"@types/unzipper": "0.10.5",
|
|
||||||
"@typescript-eslint/parser": "5.27.0",
|
|
||||||
"@vercel/ncc": "0.34.0",
|
|
||||||
"eslint": "8.17.0",
|
|
||||||
"eslint-plugin-github": "4.3.6",
|
|
||||||
"eslint-plugin-jest": "26.4.6",
|
|
||||||
"jest": "28.1.0",
|
|
||||||
"js-yaml": "4.1.0",
|
|
||||||
"patch-package": "6.4.7",
|
|
||||||
"prettier": "2.6.2",
|
|
||||||
"ts-jest": "28.0.4",
|
|
||||||
"typescript": "4.7.3"
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,90 +0,0 @@
|
|||||||
diff --git a/node_modules/@actions/cache/lib/cache.d.ts b/node_modules/@actions/cache/lib/cache.d.ts
|
|
||||||
index 16b20f7..aea77ba 100644
|
|
||||||
--- a/node_modules/@actions/cache/lib/cache.d.ts
|
|
||||||
+++ b/node_modules/@actions/cache/lib/cache.d.ts
|
|
||||||
@@ -20,7 +20,7 @@ export declare function isFeatureAvailable(): boolean;
|
|
||||||
* @param downloadOptions cache download options
|
|
||||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
|
||||||
*/
|
|
||||||
-export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions): Promise<string | undefined>;
|
|
||||||
+export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions): Promise<CacheEntry | undefined>;
|
|
||||||
/**
|
|
||||||
* Saves a list of files with the specified key
|
|
||||||
*
|
|
||||||
@@ -29,4 +29,12 @@ export declare function restoreCache(paths: string[], primaryKey: string, restor
|
|
||||||
* @param options cache upload options
|
|
||||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
|
||||||
*/
|
|
||||||
-export declare function saveCache(paths: string[], key: string, options?: UploadOptions): Promise<number>;
|
|
||||||
+export declare function saveCache(paths: string[], key: string, options?: UploadOptions): Promise<CacheEntry>;
|
|
||||||
+
|
|
||||||
+// PATCHED: Add `CacheEntry` as return type for save/restore functions
|
|
||||||
+// This allows us to track and report on cache entry sizes.
|
|
||||||
+export declare class CacheEntry {
|
|
||||||
+ key: string;
|
|
||||||
+ size?: number;
|
|
||||||
+ constructor(key: string, size?: number);
|
|
||||||
+}
|
|
||||||
diff --git a/node_modules/@actions/cache/lib/cache.js b/node_modules/@actions/cache/lib/cache.js
|
|
||||||
index 2dd645a..a392352 100644
|
|
||||||
--- a/node_modules/@actions/cache/lib/cache.js
|
|
||||||
+++ b/node_modules/@actions/cache/lib/cache.js
|
|
||||||
@@ -93,6 +93,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
|
|
||||||
}
|
|
||||||
const archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
|
||||||
core.debug(`Archive Path: ${archivePath}`);
|
|
||||||
+ const restoredEntry = new CacheEntry(cacheEntry.cacheKey);
|
|
||||||
try {
|
|
||||||
// Download the cache from the cache entry
|
|
||||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
|
||||||
@@ -100,6 +101,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
|
|
||||||
yield tar_1.listTar(archivePath, compressionMethod);
|
|
||||||
}
|
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
||||||
+ restoredEntry.size = archiveFileSize;
|
|
||||||
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
|
||||||
yield tar_1.extractTar(archivePath, compressionMethod);
|
|
||||||
core.info('Cache restored successfully');
|
|
||||||
@@ -113,7 +115,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
|
|
||||||
core.debug(`Failed to delete archive: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- return cacheEntry.cacheKey;
|
|
||||||
+ return restoredEntry;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.restoreCache = restoreCache;
|
|
||||||
@@ -141,6 +143,7 @@ function saveCache(paths, key, options) {
|
|
||||||
const archiveFolder = yield utils.createTempDirectory();
|
|
||||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
|
||||||
core.debug(`Archive Path: ${archivePath}`);
|
|
||||||
+ const savedEntry = new CacheEntry(key);
|
|
||||||
try {
|
|
||||||
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
|
|
||||||
if (core.isDebug()) {
|
|
||||||
@@ -148,6 +151,7 @@ function saveCache(paths, key, options) {
|
|
||||||
}
|
|
||||||
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
|
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
||||||
+ savedEntry.size = archiveFileSize;
|
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
|
||||||
@@ -179,8 +183,15 @@ function saveCache(paths, key, options) {
|
|
||||||
core.debug(`Failed to delete archive: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- return cacheId;
|
|
||||||
+ return savedEntry;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.saveCache = saveCache;
|
|
||||||
+class CacheEntry {
|
|
||||||
+ constructor(key, size) {
|
|
||||||
+ this.key = key;
|
|
||||||
+ this.size = size;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+exports.CacheEntry = CacheEntry;
|
|
||||||
//# sourceMappingURL=cache.js.map
|
|
||||||
\ No newline at end of file
|
|
@@ -1 +0,0 @@
|
|||||||
- [NEW] Use Job Summary to display build scan links, instead of GHA annotations
|
|
@@ -1,215 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
import path from 'path'
|
|
||||||
import fs from 'fs'
|
|
||||||
import {CacheListener} from './cache-reporting'
|
|
||||||
import {saveCache, restoreCache, cacheDebug, isCacheDebuggingEnabled, tryDelete, generateCacheKey} from './cache-utils'
|
|
||||||
import {ConfigurationCacheEntryExtractor, GradleHomeEntryExtractor} from './cache-extract-entries'
|
|
||||||
|
|
||||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
|
||||||
|
|
||||||
export const META_FILE_DIR = '.gradle-build-action'
|
|
||||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
|
||||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
|
||||||
|
|
||||||
export class GradleStateCache {
|
|
||||||
private cacheName: string
|
|
||||||
private cacheDescription: string
|
|
||||||
|
|
||||||
protected readonly gradleUserHome: string
|
|
||||||
|
|
||||||
constructor(gradleUserHome: string) {
|
|
||||||
this.gradleUserHome = gradleUserHome
|
|
||||||
this.cacheName = 'gradle'
|
|
||||||
this.cacheDescription = 'Gradle User Home'
|
|
||||||
}
|
|
||||||
|
|
||||||
init(): void {
|
|
||||||
const actionCacheDir = path.resolve(this.gradleUserHome, '.gradle-build-action')
|
|
||||||
fs.mkdirSync(actionCacheDir, {recursive: true})
|
|
||||||
|
|
||||||
const initScriptsDir = path.resolve(this.gradleUserHome, 'init.d')
|
|
||||||
fs.mkdirSync(initScriptsDir, {recursive: true})
|
|
||||||
|
|
||||||
this.initializeGradleUserHome(this.gradleUserHome, initScriptsDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheOutputExists(): boolean {
|
|
||||||
const cachesDir = path.resolve(this.gradleUserHome, 'caches')
|
|
||||||
if (fs.existsSync(cachesDir)) {
|
|
||||||
cacheDebug(`Cache output exists at ${cachesDir}`)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores the cache entry, finding the closest match to the currently running job.
|
|
||||||
*/
|
|
||||||
async restore(listener: CacheListener): Promise<void> {
|
|
||||||
const entryListener = listener.entry(this.cacheDescription)
|
|
||||||
|
|
||||||
const cacheKey = generateCacheKey(this.cacheName)
|
|
||||||
|
|
||||||
cacheDebug(
|
|
||||||
`Requesting ${this.cacheDescription} with
|
|
||||||
key:${cacheKey.key}
|
|
||||||
restoreKeys:[${cacheKey.restoreKeys}]`
|
|
||||||
)
|
|
||||||
|
|
||||||
const cacheResult = await restoreCache(this.getCachePath(), cacheKey.key, cacheKey.restoreKeys, entryListener)
|
|
||||||
if (!cacheResult) {
|
|
||||||
core.info(`${this.cacheDescription} cache not found. Will initialize empty.`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
core.saveState(RESTORED_CACHE_KEY_KEY, cacheResult.key)
|
|
||||||
|
|
||||||
core.info(`Restored ${this.cacheDescription} from cache key: ${cacheResult.key}`)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await this.afterRestore(listener)
|
|
||||||
} catch (error) {
|
|
||||||
core.warning(`Restore ${this.cacheDescription} failed in 'afterRestore': ${error}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore any extracted cache entries after the main Gradle User Home entry is restored.
|
|
||||||
*/
|
|
||||||
async afterRestore(listener: CacheListener): Promise<void> {
|
|
||||||
await this.debugReportGradleUserHomeSize('as restored from cache')
|
|
||||||
await new GradleHomeEntryExtractor(this.gradleUserHome).restore(listener)
|
|
||||||
await new ConfigurationCacheEntryExtractor(this.gradleUserHome).restore(listener)
|
|
||||||
await this.debugReportGradleUserHomeSize('after restoring common artifacts')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the cache entry based on the current cache key unless the cache was restored with the exact key,
|
|
||||||
* in which case we cannot overwrite it.
|
|
||||||
*
|
|
||||||
* If the cache entry was restored with a partial match on a restore key, then
|
|
||||||
* it is saved with the exact key.
|
|
||||||
*/
|
|
||||||
async save(listener: CacheListener): Promise<void> {
|
|
||||||
const cacheKey = generateCacheKey(this.cacheName).key
|
|
||||||
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY)
|
|
||||||
const entryListener = listener.entry(this.cacheDescription)
|
|
||||||
|
|
||||||
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
|
||||||
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`)
|
|
||||||
entryListener.markUnchanged('cache key not changed')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await this.beforeSave(listener)
|
|
||||||
} catch (error) {
|
|
||||||
core.warning(`Save ${this.cacheDescription} failed in 'beforeSave': ${error}`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`)
|
|
||||||
const cachePath = this.getCachePath()
|
|
||||||
await saveCache(cachePath, cacheKey, entryListener)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract and save any defined extracted cache entries prior to the main Gradle User Home entry being saved.
|
|
||||||
*/
|
|
||||||
async beforeSave(listener: CacheListener): Promise<void> {
|
|
||||||
await this.debugReportGradleUserHomeSize('before saving common artifacts')
|
|
||||||
this.deleteExcludedPaths()
|
|
||||||
await Promise.all([
|
|
||||||
new GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
|
|
||||||
new ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
|
|
||||||
])
|
|
||||||
await this.debugReportGradleUserHomeSize(
|
|
||||||
"after extracting common artifacts (only 'caches' and 'notifications' will be stored)"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete any file paths that are excluded by the `gradle-home-cache-excludes` parameter.
|
|
||||||
*/
|
|
||||||
private deleteExcludedPaths(): void {
|
|
||||||
const rawPaths: string[] = core.getMultilineInput(EXCLUDE_PATHS_PARAMETER)
|
|
||||||
const resolvedPaths = rawPaths.map(x => path.resolve(this.gradleUserHome, x))
|
|
||||||
|
|
||||||
for (const p of resolvedPaths) {
|
|
||||||
cacheDebug(`Deleting excluded path: ${p}`)
|
|
||||||
tryDelete(p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the paths within Gradle User Home to cache.
|
|
||||||
* By default, this is the 'caches' and 'notifications' directories,
|
|
||||||
* but this can be overridden by the `gradle-home-cache-includes` parameter.
|
|
||||||
*/
|
|
||||||
protected getCachePath(): string[] {
|
|
||||||
const rawPaths: string[] = core.getMultilineInput(INCLUDE_PATHS_PARAMETER)
|
|
||||||
rawPaths.push(META_FILE_DIR)
|
|
||||||
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x))
|
|
||||||
cacheDebug(`Using cache paths: ${resolvedPaths}`)
|
|
||||||
return resolvedPaths
|
|
||||||
}
|
|
||||||
|
|
||||||
private resolveCachePath(rawPath: string): string {
|
|
||||||
if (rawPath.startsWith('!')) {
|
|
||||||
const resolved = this.resolveCachePath(rawPath.substring(1))
|
|
||||||
return `!${resolved}`
|
|
||||||
}
|
|
||||||
return path.resolve(this.gradleUserHome, rawPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void {
|
|
||||||
const initScriptFilenames = ['build-result-capture.init.gradle', 'build-result-capture-service.plugin.groovy']
|
|
||||||
for (const initScriptFilename of initScriptFilenames) {
|
|
||||||
const initScriptContent = this.readResourceAsString(initScriptFilename)
|
|
||||||
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
|
|
||||||
fs.writeFileSync(initScriptPath, initScriptContent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readResourceAsString(resource: string): string {
|
|
||||||
// Resolving relative to __dirname will allow node to find the resource at runtime
|
|
||||||
const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', resource)
|
|
||||||
return fs.readFileSync(absolutePath, 'utf8')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When cache debugging is enabled, this method will give a detailed report
|
|
||||||
* of the Gradle User Home contents.
|
|
||||||
*/
|
|
||||||
private async debugReportGradleUserHomeSize(label: string): Promise<void> {
|
|
||||||
if (!isCacheDebuggingEnabled()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!fs.existsSync(this.gradleUserHome)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const result = await exec.getExecOutput('du', ['-h', '-c', '-t', '5M'], {
|
|
||||||
cwd: this.gradleUserHome,
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
})
|
|
||||||
|
|
||||||
core.info(`Gradle User Home (directories >5M): ${label}`)
|
|
||||||
|
|
||||||
core.info(
|
|
||||||
result.stdout
|
|
||||||
.trimEnd()
|
|
||||||
.replace(/\t/g, ' ')
|
|
||||||
.split('\n')
|
|
||||||
.map(it => {
|
|
||||||
return ` ${it}`
|
|
||||||
})
|
|
||||||
.join('\n')
|
|
||||||
)
|
|
||||||
|
|
||||||
core.info('-----------------------')
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,395 +0,0 @@
|
|||||||
import path from 'path'
|
|
||||||
import fs from 'fs'
|
|
||||||
import * as core from '@actions/core'
|
|
||||||
import * as glob from '@actions/glob'
|
|
||||||
|
|
||||||
import {META_FILE_DIR} from './cache-base'
|
|
||||||
import {CacheEntryListener, CacheListener} from './cache-reporting'
|
|
||||||
import {
|
|
||||||
cacheDebug,
|
|
||||||
getCacheKeyPrefix,
|
|
||||||
hashFileNames,
|
|
||||||
isCacheDebuggingEnabled,
|
|
||||||
restoreCache,
|
|
||||||
saveCache,
|
|
||||||
tryDelete
|
|
||||||
} from './cache-utils'
|
|
||||||
import {loadBuildResults} from './job-summary'
|
|
||||||
|
|
||||||
const SKIP_RESTORE_VAR = 'GRADLE_BUILD_ACTION_SKIP_RESTORE'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the result of attempting to load or store an extracted cache entry.
|
|
||||||
* An undefined cacheKey indicates that the operation did not succeed.
|
|
||||||
* The collected results are then used to populate the `cache-metadata.json` file for later use.
|
|
||||||
*/
|
|
||||||
class ExtractedCacheEntry {
|
|
||||||
artifactType: string
|
|
||||||
pattern: string
|
|
||||||
cacheKey: string | undefined
|
|
||||||
|
|
||||||
constructor(artifactType: string, pattern: string, cacheKey: string | undefined) {
|
|
||||||
this.artifactType = artifactType
|
|
||||||
this.pattern = pattern
|
|
||||||
this.cacheKey = cacheKey
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Representation of all of the extracted cache entries for this Gradle User Home.
|
|
||||||
* This object is persisted to JSON file in the Gradle User Home directory for storing,
|
|
||||||
* and subsequently used to restore the Gradle User Home.
|
|
||||||
*/
|
|
||||||
class ExtractedCacheEntryMetadata {
|
|
||||||
entries: ExtractedCacheEntry[] = []
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The specification for a type of extracted cache entry.
|
|
||||||
*/
|
|
||||||
class ExtractedCacheEntryDefinition {
|
|
||||||
artifactType: string
|
|
||||||
pattern: string
|
|
||||||
bundle: boolean
|
|
||||||
uniqueFileNames = true
|
|
||||||
|
|
||||||
constructor(artifactType: string, pattern: string, bundle: boolean) {
|
|
||||||
this.artifactType = artifactType
|
|
||||||
this.pattern = pattern
|
|
||||||
this.bundle = bundle
|
|
||||||
}
|
|
||||||
|
|
||||||
withNonUniqueFileNames(): ExtractedCacheEntryDefinition {
|
|
||||||
this.uniqueFileNames = false
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Caches and restores the entire Gradle User Home directory, extracting entries containing common artifacts
|
|
||||||
* for more efficient storage.
|
|
||||||
*/
|
|
||||||
abstract class AbstractEntryExtractor {
|
|
||||||
protected readonly gradleUserHome: string
|
|
||||||
private extractorName: string
|
|
||||||
|
|
||||||
constructor(gradleUserHome: string, extractorName: string) {
|
|
||||||
this.gradleUserHome = gradleUserHome
|
|
||||||
this.extractorName = extractorName
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores any artifacts that were cached separately, based on the information in the `cache-metadata.json` file.
|
|
||||||
* Each extracted cache entry is restored in parallel, except when debugging is enabled.
|
|
||||||
*/
|
|
||||||
async restore(listener: CacheListener): Promise<void> {
|
|
||||||
const previouslyExtractedCacheEntries = this.loadExtractedCacheEntries()
|
|
||||||
|
|
||||||
const processes: Promise<ExtractedCacheEntry>[] = []
|
|
||||||
|
|
||||||
for (const cacheEntry of previouslyExtractedCacheEntries) {
|
|
||||||
const artifactType = cacheEntry.artifactType
|
|
||||||
const entryListener = listener.entry(cacheEntry.pattern)
|
|
||||||
|
|
||||||
// Handle case where the extracted-cache-entry definitions have been changed
|
|
||||||
const skipRestore = process.env[SKIP_RESTORE_VAR] || ''
|
|
||||||
if (skipRestore.includes(artifactType)) {
|
|
||||||
core.info(`Not restoring extracted cache entry for ${artifactType}`)
|
|
||||||
entryListener.markRequested('SKIP_RESTORE')
|
|
||||||
} else {
|
|
||||||
processes.push(
|
|
||||||
this.awaitForDebugging(
|
|
||||||
this.restoreExtractedCacheEntry(
|
|
||||||
artifactType,
|
|
||||||
cacheEntry.cacheKey!,
|
|
||||||
cacheEntry.pattern,
|
|
||||||
entryListener
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.saveMetadataForCacheResults(await Promise.all(processes))
|
|
||||||
}
|
|
||||||
|
|
||||||
private async restoreExtractedCacheEntry(
|
|
||||||
artifactType: string,
|
|
||||||
cacheKey: string,
|
|
||||||
pattern: string,
|
|
||||||
listener: CacheEntryListener
|
|
||||||
): Promise<ExtractedCacheEntry> {
|
|
||||||
const restoredEntry = await restoreCache([pattern], cacheKey, [], listener)
|
|
||||||
if (restoredEntry) {
|
|
||||||
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern}`)
|
|
||||||
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
|
|
||||||
} else {
|
|
||||||
core.info(`Did not restore ${artifactType} with key ${cacheKey} to ${pattern}`)
|
|
||||||
return new ExtractedCacheEntry(artifactType, pattern, undefined)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves any artifacts that are configured to be cached separately, based on the extracted cache entry definitions.
|
|
||||||
* Each entry is extracted and saved in parallel, except when debugging is enabled.
|
|
||||||
*/
|
|
||||||
async extract(listener: CacheListener): Promise<void> {
|
|
||||||
// Load the cache entry definitions (from config) and the previously restored entries (from persisted metadata file)
|
|
||||||
const cacheEntryDefinitions = this.getExtractedCacheEntryDefinitions()
|
|
||||||
cacheDebug(
|
|
||||||
`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(cacheEntryDefinitions, null, 2)}`
|
|
||||||
)
|
|
||||||
|
|
||||||
const previouslyRestoredEntries = this.loadExtractedCacheEntries()
|
|
||||||
const cacheActions: Promise<ExtractedCacheEntry>[] = []
|
|
||||||
|
|
||||||
// For each cache entry definition, determine if it has already been restored, and if not, extract it
|
|
||||||
for (const cacheEntryDefinition of cacheEntryDefinitions) {
|
|
||||||
const artifactType = cacheEntryDefinition.artifactType
|
|
||||||
const pattern = cacheEntryDefinition.pattern
|
|
||||||
|
|
||||||
// Find all matching files for this cache entry definition
|
|
||||||
const globber = await glob.create(pattern, {
|
|
||||||
implicitDescendants: false,
|
|
||||||
followSymbolicLinks: false
|
|
||||||
})
|
|
||||||
const matchingFiles = await globber.glob()
|
|
||||||
|
|
||||||
if (matchingFiles.length === 0) {
|
|
||||||
cacheDebug(`No files found to cache for ${artifactType}`)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cacheEntryDefinition.bundle) {
|
|
||||||
// For an extracted "bundle", use the defined pattern and cache all matching files in a single entry.
|
|
||||||
cacheActions.push(
|
|
||||||
this.awaitForDebugging(
|
|
||||||
this.saveExtractedCacheEntry(
|
|
||||||
matchingFiles,
|
|
||||||
artifactType,
|
|
||||||
pattern,
|
|
||||||
cacheEntryDefinition.uniqueFileNames,
|
|
||||||
previouslyRestoredEntries,
|
|
||||||
listener.entry(pattern)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
// Otherwise cache each matching file in a separate entry, using the complete file path as the cache pattern.
|
|
||||||
for (const cacheFile of matchingFiles) {
|
|
||||||
cacheActions.push(
|
|
||||||
this.awaitForDebugging(
|
|
||||||
this.saveExtractedCacheEntry(
|
|
||||||
[cacheFile],
|
|
||||||
artifactType,
|
|
||||||
cacheFile,
|
|
||||||
cacheEntryDefinition.uniqueFileNames,
|
|
||||||
previouslyRestoredEntries,
|
|
||||||
listener.entry(cacheFile)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.saveMetadataForCacheResults(await Promise.all(cacheActions))
|
|
||||||
}
|
|
||||||
|
|
||||||
private async saveExtractedCacheEntry(
|
|
||||||
matchingFiles: string[],
|
|
||||||
artifactType: string,
|
|
||||||
pattern: string,
|
|
||||||
uniqueFileNames: boolean,
|
|
||||||
previouslyRestoredEntries: ExtractedCacheEntry[],
|
|
||||||
entryListener: CacheEntryListener
|
|
||||||
): Promise<ExtractedCacheEntry> {
|
|
||||||
const cacheKey = uniqueFileNames
|
|
||||||
? this.createCacheKeyFromFileNames(artifactType, matchingFiles)
|
|
||||||
: await this.createCacheKeyFromFileContents(artifactType, pattern)
|
|
||||||
const previouslyRestoredKey = previouslyRestoredEntries.find(
|
|
||||||
x => x.artifactType === artifactType && x.pattern === pattern
|
|
||||||
)?.cacheKey
|
|
||||||
|
|
||||||
if (previouslyRestoredKey === cacheKey) {
|
|
||||||
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
|
|
||||||
entryListener.markUnchanged('contents unchanged')
|
|
||||||
} else {
|
|
||||||
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
|
|
||||||
await saveCache([pattern], cacheKey, entryListener)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const file of matchingFiles) {
|
|
||||||
tryDelete(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected createCacheKeyFromFileNames(artifactType: string, files: string[]): string {
|
|
||||||
const cacheKeyPrefix = getCacheKeyPrefix()
|
|
||||||
const relativeFiles = files.map(x => path.relative(this.gradleUserHome, x))
|
|
||||||
const key = hashFileNames(relativeFiles)
|
|
||||||
|
|
||||||
cacheDebug(`Generating cache key for ${artifactType} from file names: ${relativeFiles}`)
|
|
||||||
|
|
||||||
return `${cacheKeyPrefix}${artifactType}-${key}`
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async createCacheKeyFromFileContents(artifactType: string, pattern: string): Promise<string> {
|
|
||||||
const cacheKeyPrefix = getCacheKeyPrefix()
|
|
||||||
const key = await glob.hashFiles(pattern)
|
|
||||||
|
|
||||||
cacheDebug(`Generating cache key for ${artifactType} from files matching: ${pattern}`)
|
|
||||||
|
|
||||||
return `${cacheKeyPrefix}${artifactType}-${key}`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run actions sequentially if debugging is enabled
|
|
||||||
private async awaitForDebugging(p: Promise<ExtractedCacheEntry>): Promise<ExtractedCacheEntry> {
|
|
||||||
if (isCacheDebuggingEnabled()) {
|
|
||||||
await p
|
|
||||||
}
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load information about the extracted cache entries previously restored/saved. This is loaded from the 'cache-metadata.json' file.
|
|
||||||
*/
|
|
||||||
protected loadExtractedCacheEntries(): ExtractedCacheEntry[] {
|
|
||||||
const cacheMetadataFile = this.getCacheMetadataFile()
|
|
||||||
if (!fs.existsSync(cacheMetadataFile)) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
const filedata = fs.readFileSync(cacheMetadataFile, 'utf-8')
|
|
||||||
cacheDebug(`Loaded cache metadata: ${filedata}`)
|
|
||||||
const extractedCacheEntryMetadata = JSON.parse(filedata) as ExtractedCacheEntryMetadata
|
|
||||||
return extractedCacheEntryMetadata.entries
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves information about the extracted cache entries into the 'cache-metadata.json' file.
|
|
||||||
*/
|
|
||||||
private saveMetadataForCacheResults(results: ExtractedCacheEntry[]): void {
|
|
||||||
const extractedCacheEntryMetadata = new ExtractedCacheEntryMetadata()
|
|
||||||
extractedCacheEntryMetadata.entries = results.filter(x => x.cacheKey !== undefined)
|
|
||||||
|
|
||||||
const filedata = JSON.stringify(extractedCacheEntryMetadata)
|
|
||||||
cacheDebug(`Saving cache metadata: ${filedata}`)
|
|
||||||
|
|
||||||
fs.writeFileSync(this.getCacheMetadataFile(), filedata, 'utf-8')
|
|
||||||
}
|
|
||||||
|
|
||||||
private getCacheMetadataFile(): string {
|
|
||||||
const actionMetadataDirectory = path.resolve(this.gradleUserHome, META_FILE_DIR)
|
|
||||||
fs.mkdirSync(actionMetadataDirectory, {recursive: true})
|
|
||||||
|
|
||||||
return path.resolve(actionMetadataDirectory, `${this.extractorName}-entry-metadata.json`)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
|
||||||
constructor(gradleUserHome: string) {
|
|
||||||
super(gradleUserHome, 'gradle-home')
|
|
||||||
}
|
|
||||||
|
|
||||||
async extract(listener: CacheListener): Promise<void> {
|
|
||||||
await this.deleteWrapperZips()
|
|
||||||
return super.extract(listener)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete any downloaded wrapper zip files that are not needed after extraction.
|
|
||||||
* These files are cleaned up by Gradle >= 7.5, but for older versions we remove them manually.
|
|
||||||
*/
|
|
||||||
private async deleteWrapperZips(): Promise<void> {
|
|
||||||
const wrapperZips = path.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip')
|
|
||||||
const globber = await glob.create(wrapperZips, {
|
|
||||||
implicitDescendants: false,
|
|
||||||
followSymbolicLinks: false
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const p of await globber.glob()) {
|
|
||||||
cacheDebug(`Deleting wrapper zip: ${p}`)
|
|
||||||
tryDelete(p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the extracted cache entry definitions, which determine which artifacts will be cached
|
|
||||||
* separately from the rest of the Gradle User Home cache entry.
|
|
||||||
*/
|
|
||||||
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
|
||||||
const entryDefinition = (
|
|
||||||
artifactType: string,
|
|
||||||
patterns: string[],
|
|
||||||
bundle: boolean
|
|
||||||
): ExtractedCacheEntryDefinition => {
|
|
||||||
const resolvedPatterns = patterns
|
|
||||||
.map(x => {
|
|
||||||
const isDir = x.endsWith('/')
|
|
||||||
const resolved = path.resolve(this.gradleUserHome, x)
|
|
||||||
return isDir ? `${resolved}/` : resolved // Restore trailing '/' removed by path.resolve()
|
|
||||||
})
|
|
||||||
.join('\n')
|
|
||||||
return new ExtractedCacheEntryDefinition(artifactType, resolvedPatterns, bundle)
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
|
||||||
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false), // Entire wrapper directory cached together
|
|
||||||
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
|
||||||
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
|
||||||
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
|
||||||
entryDefinition('kotlin-dsl', ['caches/*/kotlin-dsl/*/*'], true)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
|
|
||||||
constructor(gradleUserHome: string) {
|
|
||||||
super(gradleUserHome, 'configuration-cache')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the case where Gradle User Home has not been fully restored, so that the configuration-cache
|
|
||||||
* entry is not reusable.
|
|
||||||
*/
|
|
||||||
async restore(listener: CacheListener): Promise<void> {
|
|
||||||
if (listener.fullyRestored) {
|
|
||||||
return super.restore(listener)
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored')
|
|
||||||
for (const cacheEntry of this.loadExtractedCacheEntries()) {
|
|
||||||
listener.entry(cacheEntry.pattern).markRequested('NOT_RESTORED')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract cache entries for the configuration cache in each project.
|
|
||||||
*/
|
|
||||||
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
|
||||||
return this.getProjectRoots().map(projectRoot => {
|
|
||||||
const configCachePath = path.resolve(projectRoot, '.gradle/configuration-cache')
|
|
||||||
return new ExtractedCacheEntryDefinition(
|
|
||||||
'configuration-cache',
|
|
||||||
configCachePath,
|
|
||||||
true
|
|
||||||
).withNonUniqueFileNames()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For every Gradle invocation, we record the project root directory. This method returns the entire
|
|
||||||
* set of project roots, to allow saving of configuration-cache entries for each.
|
|
||||||
*/
|
|
||||||
private getProjectRoots(): string[] {
|
|
||||||
const buildResults = loadBuildResults()
|
|
||||||
const projectRootDirs = buildResults.map(x => x.rootProjectDir)
|
|
||||||
return [...new Set(projectRootDirs)] // Remove duplicates
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,200 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collects information on what entries were saved and restored during the action.
|
|
||||||
* This information is used to generate a summary of the cache usage.
|
|
||||||
*/
|
|
||||||
export class CacheListener {
|
|
||||||
cacheEntries: CacheEntryListener[] = []
|
|
||||||
isCacheReadOnly = false
|
|
||||||
isCacheWriteOnly = false
|
|
||||||
isCacheDisabled = false
|
|
||||||
|
|
||||||
get fullyRestored(): boolean {
|
|
||||||
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored())
|
|
||||||
}
|
|
||||||
|
|
||||||
get cacheStatus(): string {
|
|
||||||
if (this.isCacheDisabled) return 'disabled'
|
|
||||||
if (this.isCacheWriteOnly) return 'write-only'
|
|
||||||
if (this.isCacheReadOnly) return 'read-only'
|
|
||||||
return 'enabled'
|
|
||||||
}
|
|
||||||
|
|
||||||
entry(name: string): CacheEntryListener {
|
|
||||||
for (const entry of this.cacheEntries) {
|
|
||||||
if (entry.entryName === name) {
|
|
||||||
return entry
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const newEntry = new CacheEntryListener(name)
|
|
||||||
this.cacheEntries.push(newEntry)
|
|
||||||
return newEntry
|
|
||||||
}
|
|
||||||
|
|
||||||
stringify(): string {
|
|
||||||
return JSON.stringify(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
static rehydrate(stringRep: string): CacheListener {
|
|
||||||
if (stringRep === '') {
|
|
||||||
return new CacheListener()
|
|
||||||
}
|
|
||||||
const rehydrated: CacheListener = Object.assign(new CacheListener(), JSON.parse(stringRep))
|
|
||||||
const entries = rehydrated.cacheEntries
|
|
||||||
for (let index = 0; index < entries.length; index++) {
|
|
||||||
const rawEntry = entries[index]
|
|
||||||
entries[index] = Object.assign(new CacheEntryListener(rawEntry.entryName), rawEntry)
|
|
||||||
}
|
|
||||||
return rehydrated
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collects information on the state of a single cache entry.
|
|
||||||
*/
|
|
||||||
export class CacheEntryListener {
|
|
||||||
entryName: string
|
|
||||||
requestedKey: string | undefined
|
|
||||||
requestedRestoreKeys: string[] | undefined
|
|
||||||
restoredKey: string | undefined
|
|
||||||
restoredSize: number | undefined
|
|
||||||
|
|
||||||
savedKey: string | undefined
|
|
||||||
savedSize: number | undefined
|
|
||||||
|
|
||||||
unchanged: string | undefined
|
|
||||||
|
|
||||||
constructor(entryName: string) {
|
|
||||||
this.entryName = entryName
|
|
||||||
}
|
|
||||||
|
|
||||||
wasRequestedButNotRestored(): boolean {
|
|
||||||
return this.requestedKey !== undefined && this.restoredKey === undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
markRequested(key: string, restoreKeys: string[] = []): CacheEntryListener {
|
|
||||||
this.requestedKey = key
|
|
||||||
this.requestedRestoreKeys = restoreKeys
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
markRestored(key: string, size: number | undefined): CacheEntryListener {
|
|
||||||
this.restoredKey = key
|
|
||||||
this.restoredSize = size
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
markSaved(key: string, size: number | undefined): CacheEntryListener {
|
|
||||||
this.savedKey = key
|
|
||||||
this.savedSize = size
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
markAlreadyExists(key: string): CacheEntryListener {
|
|
||||||
this.savedKey = key
|
|
||||||
this.savedSize = 0
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
markUnchanged(message: string): CacheEntryListener {
|
|
||||||
this.unchanged = message
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function logCachingReport(listener: CacheListener): void {
|
|
||||||
const entries = listener.cacheEntries
|
|
||||||
|
|
||||||
core.summary.addRaw(
|
|
||||||
`\n<details><summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>\n`
|
|
||||||
)
|
|
||||||
|
|
||||||
core.summary.addTable([
|
|
||||||
[
|
|
||||||
{data: '', header: true},
|
|
||||||
{data: 'Count', header: true},
|
|
||||||
{data: 'Total Size (Mb)', header: true}
|
|
||||||
],
|
|
||||||
['Entries Restored', `${getCount(entries, e => e.restoredSize)}`, `${getSize(entries, e => e.restoredSize)}`],
|
|
||||||
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
|
|
||||||
])
|
|
||||||
|
|
||||||
core.summary.addHeading('Cache Entry Details', 5)
|
|
||||||
|
|
||||||
const entryDetails = listener.cacheEntries
|
|
||||||
.map(
|
|
||||||
entry =>
|
|
||||||
`Entry: ${entry.entryName}
|
|
||||||
Requested Key : ${entry.requestedKey ?? ''}
|
|
||||||
Restored Key : ${entry.restoredKey ?? ''}
|
|
||||||
Size: ${formatSize(entry.restoredSize)}
|
|
||||||
${getRestoredMessage(entry, listener.isCacheWriteOnly)}
|
|
||||||
Saved Key : ${entry.savedKey ?? ''}
|
|
||||||
Size: ${formatSize(entry.savedSize)}
|
|
||||||
${getSavedMessage(entry, listener.isCacheReadOnly)}
|
|
||||||
`
|
|
||||||
)
|
|
||||||
.join('---\n')
|
|
||||||
|
|
||||||
core.summary.addRaw(`<pre>
|
|
||||||
${entryDetails}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRestoredMessage(entry: CacheEntryListener, isCacheWriteOnly: boolean): string {
|
|
||||||
if (isCacheWriteOnly) {
|
|
||||||
return '(Entry not restored: cache is write-only)'
|
|
||||||
}
|
|
||||||
if (entry.restoredKey === undefined) {
|
|
||||||
return '(Entry not restored: no match found)'
|
|
||||||
}
|
|
||||||
if (entry.restoredKey === entry.requestedKey) {
|
|
||||||
return '(Entry restored: exact match found)'
|
|
||||||
}
|
|
||||||
return '(Entry restored: partial match found)'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSavedMessage(entry: CacheEntryListener, isCacheReadOnly: boolean): string {
|
|
||||||
if (entry.unchanged) {
|
|
||||||
return `(Entry not saved: ${entry.unchanged})`
|
|
||||||
}
|
|
||||||
if (entry.savedKey === undefined) {
|
|
||||||
if (isCacheReadOnly) {
|
|
||||||
return '(Entry not saved: cache is read-only)'
|
|
||||||
}
|
|
||||||
return '(Entry not saved: reason unknown)'
|
|
||||||
}
|
|
||||||
if (entry.savedSize === 0) {
|
|
||||||
return '(Entry not saved: entry with key already exists)'
|
|
||||||
}
|
|
||||||
return '(Entry saved)'
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCount(
|
|
||||||
cacheEntries: CacheEntryListener[],
|
|
||||||
predicate: (value: CacheEntryListener) => number | undefined
|
|
||||||
): number {
|
|
||||||
return cacheEntries.filter(e => predicate(e) !== undefined).length
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSize(
|
|
||||||
cacheEntries: CacheEntryListener[],
|
|
||||||
predicate: (value: CacheEntryListener) => number | undefined
|
|
||||||
): number {
|
|
||||||
const bytes = cacheEntries.map(e => predicate(e) ?? 0).reduce((p, v) => p + v, 0)
|
|
||||||
return Math.round(bytes / (1024 * 1024))
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatSize(bytes: number | undefined): string {
|
|
||||||
if (bytes === undefined) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
if (bytes === 0) {
|
|
||||||
return '0 (Entry already exists)'
|
|
||||||
}
|
|
||||||
return `${Math.round(bytes / (1024 * 1024))} MB (${bytes} B)`
|
|
||||||
}
|
|
@@ -1,231 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as cache from '@actions/cache'
|
|
||||||
import * as github from '@actions/github'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
|
|
||||||
import * as crypto from 'crypto'
|
|
||||||
import * as path from 'path'
|
|
||||||
import * as fs from 'fs'
|
|
||||||
|
|
||||||
import {CacheEntryListener} from './cache-reporting'
|
|
||||||
|
|
||||||
const CACHE_PROTOCOL_VERSION = 'v6-'
|
|
||||||
|
|
||||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
|
||||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
|
||||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
|
||||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
|
||||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
|
||||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
|
||||||
|
|
||||||
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
|
||||||
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT'
|
|
||||||
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB'
|
|
||||||
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE'
|
|
||||||
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION'
|
|
||||||
|
|
||||||
export function isCacheDisabled(): boolean {
|
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isCacheReadOnly(): boolean {
|
|
||||||
return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isCacheWriteOnly(): boolean {
|
|
||||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isCacheDebuggingEnabled(): boolean {
|
|
||||||
return process.env[CACHE_DEBUG_VAR] ? true : false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a key used to restore a cache entry.
|
|
||||||
* The Github Actions cache will first try for an exact match on the key.
|
|
||||||
* If that fails, it will try for a prefix match on any of the restoreKeys.
|
|
||||||
*/
|
|
||||||
export class CacheKey {
|
|
||||||
key: string
|
|
||||||
restoreKeys: string[]
|
|
||||||
|
|
||||||
constructor(key: string, restoreKeys: string[]) {
|
|
||||||
this.key = key
|
|
||||||
this.restoreKeys = restoreKeys
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a cache key specific to the current job execution.
|
|
||||||
* The key is constructed from the following inputs (with some user overrides):
|
|
||||||
* - The cache protocol version
|
|
||||||
* - The name of the cache
|
|
||||||
* - The runner operating system
|
|
||||||
* - The name of the Job being executed
|
|
||||||
* - The matrix values for the Job being executed (job context)
|
|
||||||
* - The SHA of the commit being executed
|
|
||||||
*
|
|
||||||
* Caches are restored by trying to match the these key prefixes in order:
|
|
||||||
* - The full key with SHA
|
|
||||||
* - A previous key for this Job + matrix
|
|
||||||
* - Any previous key for this Job (any matrix)
|
|
||||||
* - Any previous key for this cache on the current OS
|
|
||||||
*/
|
|
||||||
export function generateCacheKey(cacheName: string): CacheKey {
|
|
||||||
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`
|
|
||||||
|
|
||||||
// At the most general level, share caches for all executions on the same OS
|
|
||||||
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`
|
|
||||||
|
|
||||||
// Prefer caches that run this job
|
|
||||||
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`
|
|
||||||
|
|
||||||
// Prefer (even more) jobs that run this job with the same context (matrix)
|
|
||||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`
|
|
||||||
|
|
||||||
// Exact match on Git SHA
|
|
||||||
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`
|
|
||||||
|
|
||||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment])
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getCacheKeyPrefix(): string {
|
|
||||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
|
||||||
return process.env[CACHE_KEY_PREFIX_VAR] || ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheKeyEnvironment(): string {
|
|
||||||
const runnerOs = process.env['RUNNER_OS'] || ''
|
|
||||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheKeyJob(): string {
|
|
||||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
|
||||||
return process.env[CACHE_KEY_JOB_VAR] || github.context.job
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheKeyJobInstance(): string {
|
|
||||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR]
|
|
||||||
if (override) {
|
|
||||||
return override
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
|
||||||
// The only way we can obtain the `matrix` data is via the `workflow-job-context` parameter in action.yml.
|
|
||||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER)
|
|
||||||
return hashStrings([workflowJobContext])
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheKeyJobExecution(): string {
|
|
||||||
// Used to associate a cache key with a particular execution (default is bound to the git commit sha)
|
|
||||||
return process.env[CACHE_KEY_JOB_EXECUTION_VAR] || github.context.sha
|
|
||||||
}
|
|
||||||
|
|
||||||
export function hashFileNames(fileNames: string[]): string {
|
|
||||||
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function hashStrings(values: string[]): string {
|
|
||||||
const hash = crypto.createHash('md5')
|
|
||||||
for (const value of values) {
|
|
||||||
hash.update(value)
|
|
||||||
}
|
|
||||||
return hash.digest('hex')
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function restoreCache(
|
|
||||||
cachePath: string[],
|
|
||||||
cacheKey: string,
|
|
||||||
cacheRestoreKeys: string[],
|
|
||||||
listener: CacheEntryListener
|
|
||||||
): Promise<cache.CacheEntry | undefined> {
|
|
||||||
listener.markRequested(cacheKey, cacheRestoreKeys)
|
|
||||||
try {
|
|
||||||
const restoredEntry = await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys)
|
|
||||||
if (restoredEntry !== undefined) {
|
|
||||||
listener.markRestored(restoredEntry.key, restoredEntry.size)
|
|
||||||
}
|
|
||||||
return restoredEntry
|
|
||||||
} catch (error) {
|
|
||||||
handleCacheFailure(error, `Failed to restore ${cacheKey}`)
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function saveCache(cachePath: string[], cacheKey: string, listener: CacheEntryListener): Promise<void> {
|
|
||||||
try {
|
|
||||||
const savedEntry = await cache.saveCache(cachePath, cacheKey)
|
|
||||||
listener.markSaved(savedEntry.key, savedEntry.size)
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof cache.ReserveCacheError) {
|
|
||||||
listener.markAlreadyExists(cacheKey)
|
|
||||||
}
|
|
||||||
handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function cacheDebug(message: string): void {
|
|
||||||
if (isCacheDebuggingEnabled()) {
|
|
||||||
core.info(message)
|
|
||||||
} else {
|
|
||||||
core.debug(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function handleCacheFailure(error: unknown, message: string): void {
|
|
||||||
if (error instanceof cache.ValidationError) {
|
|
||||||
// Fail on cache validation errors
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
if (error instanceof cache.ReserveCacheError) {
|
|
||||||
// Reserve cache errors are expected if the artifact has been previously cached
|
|
||||||
core.info(`${message}: ${error}`)
|
|
||||||
} else {
|
|
||||||
// Warn on all other errors
|
|
||||||
core.warning(`${message}: ${error}`)
|
|
||||||
if (error instanceof Error && error.stack) {
|
|
||||||
cacheDebug(error.stack)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to delete a file or directory, waiting to allow locks to be released
|
|
||||||
*/
|
|
||||||
export async function tryDelete(file: string): Promise<void> {
|
|
||||||
const maxAttempts = 5
|
|
||||||
const stat = fs.lstatSync(file)
|
|
||||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
||||||
try {
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
fs.rmdirSync(file, {recursive: true})
|
|
||||||
} else {
|
|
||||||
fs.unlinkSync(file)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
} catch (error) {
|
|
||||||
if (attempt === maxAttempts) {
|
|
||||||
core.warning(`Failed to delete ${file}, which will impact caching.
|
|
||||||
It is likely locked by another process. Output of 'jps -ml':
|
|
||||||
${await getJavaProcesses()}`)
|
|
||||||
throw error
|
|
||||||
} else {
|
|
||||||
cacheDebug(`Attempt to delete ${file} failed. Will try again.`)
|
|
||||||
await delay(1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function delay(ms: number): Promise<void> {
|
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getJavaProcesses(): Promise<string> {
|
|
||||||
const jpsOutput = await exec.getExecOutput('jps', ['-lm'])
|
|
||||||
return jpsOutput.stdout
|
|
||||||
}
|
|
@@ -1,76 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import {isCacheDisabled, isCacheReadOnly, isCacheWriteOnly} from './cache-utils'
|
|
||||||
import {CacheListener} from './cache-reporting'
|
|
||||||
import {GradleStateCache} from './cache-base'
|
|
||||||
|
|
||||||
const CACHE_RESTORED_VAR = 'GRADLE_BUILD_ACTION_CACHE_RESTORED'
|
|
||||||
|
|
||||||
export async function restore(gradleUserHome: string, cacheListener: CacheListener): Promise<void> {
|
|
||||||
// Bypass restore cache on all but first action step in workflow.
|
|
||||||
if (process.env[CACHE_RESTORED_VAR]) {
|
|
||||||
core.info('Cache only restored on first action step.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
core.exportVariable(CACHE_RESTORED_VAR, true)
|
|
||||||
|
|
||||||
const gradleStateCache = new GradleStateCache(gradleUserHome)
|
|
||||||
|
|
||||||
if (isCacheDisabled()) {
|
|
||||||
core.info('Cache is disabled: will not restore state from previous builds.')
|
|
||||||
// Initialize the Gradle User Home even when caching is disabled.
|
|
||||||
gradleStateCache.init()
|
|
||||||
cacheListener.isCacheDisabled = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gradleStateCache.cacheOutputExists()) {
|
|
||||||
core.info('Gradle User Home already exists: will not restore from cache.')
|
|
||||||
// Initialize pre-existing Gradle User Home.
|
|
||||||
gradleStateCache.init()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
gradleStateCache.init()
|
|
||||||
// Mark the state as restored so that post-action will perform save.
|
|
||||||
core.saveState(CACHE_RESTORED_VAR, true)
|
|
||||||
|
|
||||||
if (isCacheWriteOnly()) {
|
|
||||||
core.info('Cache is write-only: will not restore from cache.')
|
|
||||||
cacheListener.isCacheWriteOnly = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await core.group('Restore Gradle state from cache', async () => {
|
|
||||||
await gradleStateCache.restore(cacheListener)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function save(gradleUserHome: string, cacheListener: CacheListener): Promise<void> {
|
|
||||||
if (!shouldSaveCaches()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isCacheReadOnly()) {
|
|
||||||
core.info('Cache is read-only: will not save state for use in subsequent builds.')
|
|
||||||
cacheListener.isCacheReadOnly = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await core.group('Caching Gradle state', async () => {
|
|
||||||
return new GradleStateCache(gradleUserHome).save(cacheListener)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function shouldSaveCaches(): boolean {
|
|
||||||
if (isCacheDisabled()) {
|
|
||||||
core.info('Cache is disabled: will not save state for later builds.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!core.getState(CACHE_RESTORED_VAR)) {
|
|
||||||
core.info('Cache will not be saved: not restored in main action step.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
import fs from 'fs'
|
|
||||||
import * as gradlew from './gradlew'
|
|
||||||
|
|
||||||
export async function executeGradleBuild(executable: string | undefined, root: string, args: string[]): Promise<void> {
|
|
||||||
// Use the provided executable, or look for a Gradle wrapper script to run
|
|
||||||
const toExecute = executable ?? gradlew.locateGradleWrapperScript(root)
|
|
||||||
verifyIsExecutableScript(toExecute)
|
|
||||||
const status: number = await exec.exec(toExecute, args, {
|
|
||||||
cwd: root,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
})
|
|
||||||
|
|
||||||
if (status !== 0) {
|
|
||||||
core.setFailed(`Gradle build failed: see console output for details`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function verifyIsExecutableScript(toExecute: string): void {
|
|
||||||
try {
|
|
||||||
fs.accessSync(toExecute, fs.constants.X_OK)
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error(`Gradle script '${toExecute}' is not executable.`)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
import * as path from 'path'
|
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
|
||||||
|
|
||||||
export function wrapperScriptFilename(): string {
|
|
||||||
return IS_WINDOWS ? 'gradlew.bat' : 'gradlew'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function installScriptFilename(): string {
|
|
||||||
return IS_WINDOWS ? 'gradle.bat' : 'gradle'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function locateGradleWrapperScript(buildRootDirectory: string): string {
|
|
||||||
validateGradleWrapper(buildRootDirectory)
|
|
||||||
return path.resolve(buildRootDirectory, wrapperScriptFilename())
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateGradleWrapper(buildRootDirectory: string): void {
|
|
||||||
const wrapperProperties = path.resolve(buildRootDirectory, 'gradle/wrapper/gradle-wrapper.properties')
|
|
||||||
if (!fs.existsSync(wrapperProperties)) {
|
|
||||||
throw new Error(
|
|
||||||
`Cannot locate a Gradle wrapper properties file at '${wrapperProperties}'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import fs from 'fs'
|
|
||||||
import path from 'path'
|
|
||||||
import {logCachingReport, CacheListener} from './cache-reporting'
|
|
||||||
|
|
||||||
export interface BuildResult {
|
|
||||||
get rootProjectName(): string
|
|
||||||
get rootProjectDir(): string
|
|
||||||
get requestedTasks(): string
|
|
||||||
get gradleVersion(): string
|
|
||||||
get gradleHomeDir(): string
|
|
||||||
get buildFailed(): boolean
|
|
||||||
get buildScanUri(): string
|
|
||||||
}
|
|
||||||
|
|
||||||
export function writeJobSummary(buildResults: BuildResult[], cacheListener: CacheListener): void {
|
|
||||||
core.info('Writing job summary')
|
|
||||||
|
|
||||||
if (buildResults.length === 0) {
|
|
||||||
core.debug('No Gradle build results found. Summary table will not be generated.')
|
|
||||||
} else {
|
|
||||||
writeSummaryTable(buildResults)
|
|
||||||
}
|
|
||||||
|
|
||||||
logCachingReport(cacheListener)
|
|
||||||
|
|
||||||
core.summary.write()
|
|
||||||
}
|
|
||||||
|
|
||||||
export function loadBuildResults(): BuildResult[] {
|
|
||||||
const buildResultsDir = path.resolve(process.env['RUNNER_TEMP']!, '.build-results')
|
|
||||||
if (!fs.existsSync(buildResultsDir)) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
return fs.readdirSync(buildResultsDir).map(file => {
|
|
||||||
// Every file in the .build-results dir should be a BuildResults JSON
|
|
||||||
const filePath = path.join(buildResultsDir, file)
|
|
||||||
const content = fs.readFileSync(filePath, 'utf8')
|
|
||||||
return JSON.parse(content) as BuildResult
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeSummaryTable(results: BuildResult[]): void {
|
|
||||||
core.summary.addHeading('Gradle Builds', 3)
|
|
||||||
core.summary.addTable([
|
|
||||||
[
|
|
||||||
{data: 'Root Project', header: true},
|
|
||||||
{data: 'Tasks', header: true},
|
|
||||||
{data: 'Gradle Version', header: true},
|
|
||||||
{data: 'Outcome', header: true}
|
|
||||||
],
|
|
||||||
...results.map(result => [
|
|
||||||
result.rootProjectName,
|
|
||||||
result.requestedTasks,
|
|
||||||
result.gradleVersion,
|
|
||||||
renderOutcome(result)
|
|
||||||
])
|
|
||||||
])
|
|
||||||
core.summary.addRaw('\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderOutcome(result: BuildResult): string {
|
|
||||||
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build'
|
|
||||||
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen'
|
|
||||||
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`
|
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`
|
|
||||||
const targetUrl = result.buildScanUri ? result.buildScanUri : '#'
|
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`
|
|
||||||
}
|
|
64
src/main.ts
64
src/main.ts
@@ -1,64 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as path from 'path'
|
|
||||||
import {parseArgsStringToArgv} from 'string-argv'
|
|
||||||
|
|
||||||
import * as setupGradle from './setup-gradle'
|
|
||||||
import * as execution from './execution'
|
|
||||||
import * as provision from './provision'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The main entry point for the action, called by Github Actions for the step.
|
|
||||||
*/
|
|
||||||
export async function run(): Promise<void> {
|
|
||||||
try {
|
|
||||||
const workspaceDirectory = process.env[`GITHUB_WORKSPACE`] || ''
|
|
||||||
const buildRootDirectory = resolveBuildRootDirectory(workspaceDirectory)
|
|
||||||
|
|
||||||
await setupGradle.setup(buildRootDirectory)
|
|
||||||
|
|
||||||
const executable = await provisionGradle(workspaceDirectory)
|
|
||||||
// executable will be undefined if using Gradle wrapper
|
|
||||||
if (executable !== undefined) {
|
|
||||||
core.addPath(path.dirname(executable))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only execute if arguments have been provided
|
|
||||||
const args: string[] = parseCommandLineArguments()
|
|
||||||
if (args.length > 0) {
|
|
||||||
await execution.executeGradleBuild(executable, buildRootDirectory, args)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
core.setFailed(String(error))
|
|
||||||
if (error instanceof Error && error.stack) {
|
|
||||||
core.info(error.stack)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
||||||
|
|
||||||
async function provisionGradle(workspaceDirectory: string): Promise<string | undefined> {
|
|
||||||
const gradleVersion = core.getInput('gradle-version')
|
|
||||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
|
||||||
return path.resolve(await provision.gradleVersion(gradleVersion))
|
|
||||||
}
|
|
||||||
|
|
||||||
const gradleExecutable = core.getInput('gradle-executable')
|
|
||||||
if (gradleExecutable !== '') {
|
|
||||||
return path.resolve(workspaceDirectory, gradleExecutable)
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveBuildRootDirectory(baseDirectory: string): string {
|
|
||||||
const buildRootDirectory = core.getInput('build-root-directory')
|
|
||||||
const resolvedBuildRootDirectory =
|
|
||||||
buildRootDirectory === '' ? path.resolve(baseDirectory) : path.resolve(baseDirectory, buildRootDirectory)
|
|
||||||
return resolvedBuildRootDirectory
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseCommandLineArguments(): string[] {
|
|
||||||
const input = core.getInput('arguments')
|
|
||||||
return parseArgsStringToArgv(input)
|
|
||||||
}
|
|
27
src/post.ts
27
src/post.ts
@@ -1,27 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as setupGradle from './setup-gradle'
|
|
||||||
|
|
||||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
|
||||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
|
||||||
// throw an uncaught exception. Instead of failing this action, just warn.
|
|
||||||
process.on('uncaughtException', e => handleFailure(e))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The post-execution entry point for the action, called by Github Actions after completing all steps for the Job.
|
|
||||||
*/
|
|
||||||
export async function run(): Promise<void> {
|
|
||||||
try {
|
|
||||||
await setupGradle.complete()
|
|
||||||
} catch (error) {
|
|
||||||
handleFailure(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleFailure(error: unknown): void {
|
|
||||||
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`)
|
|
||||||
if (error instanceof Error && error.stack) {
|
|
||||||
core.info(error.stack)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
161
src/provision.ts
161
src/provision.ts
@@ -1,161 +0,0 @@
|
|||||||
import * as fs from 'fs'
|
|
||||||
import * as os from 'os'
|
|
||||||
import * as path from 'path'
|
|
||||||
import * as httpm from '@actions/http-client'
|
|
||||||
import * as core from '@actions/core'
|
|
||||||
import * as cache from '@actions/cache'
|
|
||||||
import * as toolCache from '@actions/tool-cache'
|
|
||||||
|
|
||||||
import * as gradlew from './gradlew'
|
|
||||||
import {handleCacheFailure, isCacheDisabled, isCacheReadOnly} from './cache-utils'
|
|
||||||
|
|
||||||
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Gradle executable path
|
|
||||||
*/
|
|
||||||
export async function gradleVersion(version: string): Promise<string> {
|
|
||||||
switch (version) {
|
|
||||||
case 'current':
|
|
||||||
return gradleCurrent()
|
|
||||||
case 'rc':
|
|
||||||
core.warning(`Specifying gradle-version 'rc' has been deprecated. Use 'release-candidate' instead.`)
|
|
||||||
return gradleReleaseCandidate()
|
|
||||||
case 'release-candidate':
|
|
||||||
return gradleReleaseCandidate()
|
|
||||||
case 'nightly':
|
|
||||||
return gradleNightly()
|
|
||||||
case 'release-nightly':
|
|
||||||
return gradleReleaseNightly()
|
|
||||||
default:
|
|
||||||
return gradle(version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradleCurrent(): Promise<string> {
|
|
||||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`)
|
|
||||||
return provisionGradle(versionInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradleReleaseCandidate(): Promise<string> {
|
|
||||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-candidate`)
|
|
||||||
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
|
||||||
return provisionGradle(versionInfo)
|
|
||||||
}
|
|
||||||
core.info('No current release-candidate found, will fallback to current')
|
|
||||||
return gradleCurrent()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradleNightly(): Promise<string> {
|
|
||||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`)
|
|
||||||
return provisionGradle(versionInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradleReleaseNightly(): Promise<string> {
|
|
||||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`)
|
|
||||||
return provisionGradle(versionInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradle(version: string): Promise<string> {
|
|
||||||
const versionInfo = await findGradleVersionDeclaration(version)
|
|
||||||
if (!versionInfo) {
|
|
||||||
throw new Error(`Gradle version ${version} does not exists`)
|
|
||||||
}
|
|
||||||
return provisionGradle(versionInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function gradleVersionDeclaration(url: string): Promise<GradleVersionInfo> {
|
|
||||||
return await httpGetGradleVersion(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function findGradleVersionDeclaration(version: string): Promise<GradleVersionInfo | undefined> {
|
|
||||||
const gradleVersions = await httpGetGradleVersions(`${gradleVersionsBaseUrl}/all`)
|
|
||||||
return gradleVersions.find((entry: GradleVersionInfo) => {
|
|
||||||
return entry.version === version
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function provisionGradle(versionInfo: GradleVersionInfo): Promise<string> {
|
|
||||||
return core.group(`Provision Gradle ${versionInfo.version}`, async () => {
|
|
||||||
return locateGradleAndDownloadIfRequired(versionInfo)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function locateGradleAndDownloadIfRequired(versionInfo: GradleVersionInfo): Promise<string> {
|
|
||||||
const installsDir = path.join(os.homedir(), 'gradle-installations/installs')
|
|
||||||
const installDir = path.join(installsDir, `gradle-${versionInfo.version}`)
|
|
||||||
if (fs.existsSync(installDir)) {
|
|
||||||
core.info(`Gradle installation already exists at ${installDir}`)
|
|
||||||
return executableFrom(installDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadPath = await downloadAndCacheGradleDistribution(versionInfo)
|
|
||||||
await toolCache.extractZip(downloadPath, installsDir)
|
|
||||||
core.info(`Extracted Gradle ${versionInfo.version} to ${installDir}`)
|
|
||||||
|
|
||||||
const executable = executableFrom(installDir)
|
|
||||||
fs.chmodSync(executable, '755')
|
|
||||||
core.info(`Provisioned Gradle executable ${executable}`)
|
|
||||||
|
|
||||||
return executable
|
|
||||||
}
|
|
||||||
|
|
||||||
async function downloadAndCacheGradleDistribution(versionInfo: GradleVersionInfo): Promise<string> {
|
|
||||||
const downloadPath = path.join(os.homedir(), `gradle-installations/downloads/gradle-${versionInfo.version}-bin.zip`)
|
|
||||||
|
|
||||||
if (isCacheDisabled()) {
|
|
||||||
await downloadGradleDistribution(versionInfo, downloadPath)
|
|
||||||
return downloadPath
|
|
||||||
}
|
|
||||||
|
|
||||||
const cacheKey = `gradle-${versionInfo.version}`
|
|
||||||
try {
|
|
||||||
const restoreKey = await cache.restoreCache([downloadPath], cacheKey)
|
|
||||||
if (restoreKey) {
|
|
||||||
core.info(`Restored Gradle distribution ${cacheKey} from cache to ${downloadPath}`)
|
|
||||||
return downloadPath
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
handleCacheFailure(error, `Restore Gradle distribution ${versionInfo.version} failed`)
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`Gradle distribution ${versionInfo.version} not found in cache. Will download.`)
|
|
||||||
await downloadGradleDistribution(versionInfo, downloadPath)
|
|
||||||
|
|
||||||
if (!isCacheReadOnly()) {
|
|
||||||
try {
|
|
||||||
await cache.saveCache([downloadPath], cacheKey)
|
|
||||||
} catch (error) {
|
|
||||||
handleCacheFailure(error, `Save Gradle distribution ${versionInfo.version} failed`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return downloadPath
|
|
||||||
}
|
|
||||||
|
|
||||||
async function downloadGradleDistribution(versionInfo: GradleVersionInfo, downloadPath: string): Promise<void> {
|
|
||||||
await toolCache.downloadTool(versionInfo.downloadUrl, downloadPath)
|
|
||||||
core.info(`Downloaded ${versionInfo.downloadUrl} to ${downloadPath} (size ${fs.statSync(downloadPath).size})`)
|
|
||||||
}
|
|
||||||
|
|
||||||
function executableFrom(installDir: string): string {
|
|
||||||
return path.join(installDir, 'bin', `${gradlew.installScriptFilename()}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function httpGetGradleVersion(url: string): Promise<GradleVersionInfo> {
|
|
||||||
return JSON.parse(await httpGetString(url))
|
|
||||||
}
|
|
||||||
|
|
||||||
async function httpGetGradleVersions(url: string): Promise<GradleVersionInfo[]> {
|
|
||||||
return JSON.parse(await httpGetString(url))
|
|
||||||
}
|
|
||||||
|
|
||||||
async function httpGetString(url: string): Promise<string> {
|
|
||||||
const httpClient = new httpm.HttpClient('gradle/gradle-build-action')
|
|
||||||
const response = await httpClient.get(url)
|
|
||||||
return response.readBody()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GradleVersionInfo {
|
|
||||||
version: string
|
|
||||||
downloadUrl: string
|
|
||||||
}
|
|
@@ -1,52 +0,0 @@
|
|||||||
import org.gradle.tooling.events.*
|
|
||||||
import org.gradle.tooling.events.task.*
|
|
||||||
import org.gradle.util.GradleVersion
|
|
||||||
|
|
||||||
// Can't use settingsEvaluated since this script is applied inside a settingsEvaluated handler
|
|
||||||
// But projectsEvaluated is good enough, since the build service won't catch configuration failures anyway
|
|
||||||
projectsEvaluated {
|
|
||||||
def projectTracker = gradle.sharedServices.registerIfAbsent("gradle-build-action-buildResultsRecorder", BuildResultsRecorder, { spec ->
|
|
||||||
spec.getParameters().getRootProjectName().set(gradle.rootProject.name)
|
|
||||||
spec.getParameters().getRootProjectDir().set(gradle.rootProject.rootDir.absolutePath)
|
|
||||||
spec.getParameters().getRequestedTasks().set(gradle.startParameter.taskNames.join(" "))
|
|
||||||
spec.getParameters().getGradleHomeDir().set(gradle.gradleHomeDir.absolutePath)
|
|
||||||
spec.getParameters().getInvocationId().set(gradle.ext.invocationId)
|
|
||||||
})
|
|
||||||
|
|
||||||
gradle.services.get(BuildEventsListenerRegistry).onTaskCompletion(projectTracker)
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class BuildResultsRecorder implements BuildService<BuildResultsRecorder.Params>, OperationCompletionListener, AutoCloseable {
|
|
||||||
private boolean buildFailed = false
|
|
||||||
interface Params extends BuildServiceParameters {
|
|
||||||
Property<String> getRootProjectName()
|
|
||||||
Property<String> getRootProjectDir()
|
|
||||||
Property<String> getRequestedTasks()
|
|
||||||
Property<String> getGradleHomeDir()
|
|
||||||
Property<String> getInvocationId()
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onFinish(FinishEvent finishEvent) {
|
|
||||||
if (finishEvent instanceof TaskFinishEvent && finishEvent.result instanceof TaskFailureResult) {
|
|
||||||
buildFailed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
def buildResults = [
|
|
||||||
rootProjectName: getParameters().getRootProjectName().get(),
|
|
||||||
rootProjectDir: getParameters().getRootProjectDir().get(),
|
|
||||||
requestedTasks: getParameters().getRequestedTasks().get(),
|
|
||||||
gradleVersion: GradleVersion.current().version,
|
|
||||||
gradleHomeDir: getParameters().getGradleHomeDir().get(),
|
|
||||||
buildFailed: buildFailed,
|
|
||||||
buildScanUri: null
|
|
||||||
]
|
|
||||||
|
|
||||||
def buildResultsDir = new File(System.getenv("RUNNER_TEMP"), ".build-results")
|
|
||||||
buildResultsDir.mkdirs()
|
|
||||||
def buildResultsFile = new File(buildResultsDir, System.getenv("GITHUB_ACTION") + getParameters().getInvocationId().get() + ".json")
|
|
||||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
* Capture information for each executed Gradle build to display in the job summary.
|
|
||||||
*/
|
|
||||||
import org.gradle.util.GradleVersion
|
|
||||||
|
|
||||||
// Only run against root build. Do not run against included builds.
|
|
||||||
def isTopLevelBuild = gradle.getParent() == null
|
|
||||||
if (isTopLevelBuild) {
|
|
||||||
def version = GradleVersion.current().baseVersion
|
|
||||||
|
|
||||||
def atLeastGradle3 = version >= GradleVersion.version("3.0")
|
|
||||||
def atLeastGradle6 = version >= GradleVersion.version("6.0")
|
|
||||||
|
|
||||||
def invocationId = "-${System.currentTimeMillis()}"
|
|
||||||
|
|
||||||
if (atLeastGradle6) {
|
|
||||||
def useBuildService = version >= GradleVersion.version("6.6")
|
|
||||||
settingsEvaluated { settings ->
|
|
||||||
// The `buildScanPublished` hook is the only way to capture the build scan URI.
|
|
||||||
if (settings.pluginManager.hasPlugin("com.gradle.enterprise")) {
|
|
||||||
captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId)
|
|
||||||
}
|
|
||||||
// We also need to add hooks in case the plugin is applied but no build scan is published
|
|
||||||
if (useBuildService) {
|
|
||||||
captureUsingBuildService(settings, invocationId)
|
|
||||||
} else {
|
|
||||||
captureUsingBuildFinished(gradle, invocationId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (atLeastGradle3) {
|
|
||||||
projectsEvaluated { gradle ->
|
|
||||||
if (gradle.rootProject.pluginManager.hasPlugin("com.gradle.build-scan")) {
|
|
||||||
captureUsingBuildScanPublished(gradle.rootProject.extensions["buildScan"], gradle.rootProject, invocationId)
|
|
||||||
}
|
|
||||||
// We need to capture in buildFinished in case the plugin is applied but no build scan is published
|
|
||||||
captureUsingBuildFinished(gradle, invocationId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def captureUsingBuildScanPublished(buildScanExtension, rootProject, invocationId) {
|
|
||||||
buildScanExtension.with {
|
|
||||||
def requestedTasks = gradle.startParameter.taskNames.join(" ")
|
|
||||||
def rootProjectName = rootProject.name
|
|
||||||
def rootProjectDir = rootProject.projectDir.absolutePath
|
|
||||||
def gradleVersion = GradleVersion.current().version
|
|
||||||
def gradleHomeDir = gradle.gradleHomeDir.absolutePath
|
|
||||||
def buildFailed = false
|
|
||||||
|
|
||||||
buildFinished { result ->
|
|
||||||
buildFailed = (result.failure != null)
|
|
||||||
}
|
|
||||||
|
|
||||||
buildScanPublished { buildScan ->
|
|
||||||
|
|
||||||
def buildScanUri = buildScan.buildScanUri.toASCIIString()
|
|
||||||
def buildResults = [
|
|
||||||
rootProjectName: rootProjectName,
|
|
||||||
rootProjectDir: rootProjectDir,
|
|
||||||
requestedTasks: requestedTasks,
|
|
||||||
gradleVersion: gradleVersion,
|
|
||||||
gradleHomeDir: gradleHomeDir,
|
|
||||||
buildFailed: buildFailed,
|
|
||||||
buildScanUri: buildScanUri
|
|
||||||
]
|
|
||||||
|
|
||||||
def buildResultsDir = new File(System.getenv("RUNNER_TEMP"), ".build-results")
|
|
||||||
buildResultsDir.mkdirs()
|
|
||||||
def buildResultsFile = new File(buildResultsDir, System.getenv("GITHUB_ACTION") + invocationId + ".json")
|
|
||||||
|
|
||||||
// Overwrite any contents written by buildFinished or build service, since this result is a superset.
|
|
||||||
if (buildResultsFile.exists()) {
|
|
||||||
buildResultsFile.text = groovy.json.JsonOutput.toJson(buildResults)
|
|
||||||
} else {
|
|
||||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
|
||||||
}
|
|
||||||
|
|
||||||
println("::set-output name=build-scan-url::${buildScan.buildScanUri}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def captureUsingBuildFinished(gradle, invocationId) {
|
|
||||||
gradle.buildFinished { result ->
|
|
||||||
def buildResults = [
|
|
||||||
rootProjectName: gradle.rootProject.name,
|
|
||||||
rootProjectDir: gradle.rootProject.rootDir.absolutePath,
|
|
||||||
requestedTasks: gradle.startParameter.taskNames.join(" "),
|
|
||||||
gradleVersion: GradleVersion.current().version,
|
|
||||||
gradleHomeDir: gradle.gradleHomeDir.absolutePath,
|
|
||||||
buildFailed: result.failure != null,
|
|
||||||
buildScanUri: null
|
|
||||||
]
|
|
||||||
|
|
||||||
def buildResultsDir = new File(System.getenv("RUNNER_TEMP"), ".build-results")
|
|
||||||
buildResultsDir.mkdirs()
|
|
||||||
def buildResultsFile = new File(buildResultsDir, System.getenv("GITHUB_ACTION") + invocationId + ".json")
|
|
||||||
// Don't overwrite file generated by build-scan plugin if present (which has build-scan-uri)
|
|
||||||
if (!buildResultsFile.exists()) {
|
|
||||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def captureUsingBuildService(settings, invocationId) {
|
|
||||||
gradle.ext.invocationId = invocationId
|
|
||||||
apply from: 'build-result-capture-service.plugin.groovy'
|
|
||||||
}
|
|
@@ -1,113 +0,0 @@
|
|||||||
import * as core from '@actions/core'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as path from 'path'
|
|
||||||
import * as os from 'os'
|
|
||||||
import * as caches from './caches'
|
|
||||||
|
|
||||||
import {CacheListener} from './cache-reporting'
|
|
||||||
import {BuildResult, loadBuildResults, writeJobSummary} from './job-summary'
|
|
||||||
|
|
||||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
|
||||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
|
||||||
const CACHE_LISTENER = 'CACHE_LISTENER'
|
|
||||||
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'
|
|
||||||
|
|
||||||
function shouldGenerateJobSummary(): boolean {
|
|
||||||
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER)
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function setup(buildRootDirectory: string): Promise<void> {
|
|
||||||
const gradleUserHome = await determineGradleUserHome(buildRootDirectory)
|
|
||||||
|
|
||||||
// Bypass setup on all but first action step in workflow.
|
|
||||||
if (process.env[GRADLE_SETUP_VAR]) {
|
|
||||||
core.info('Gradle setup only performed on first gradle-build-action step in workflow.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Record setup complete: visible to all subsequent actions and prevents duplicate setup
|
|
||||||
core.exportVariable(GRADLE_SETUP_VAR, true)
|
|
||||||
// Record setup complete: visible in post-action, to control action completion
|
|
||||||
core.saveState(GRADLE_SETUP_VAR, true)
|
|
||||||
|
|
||||||
// Save the Gradle User Home for use in the post-action step.
|
|
||||||
core.saveState(GRADLE_USER_HOME, gradleUserHome)
|
|
||||||
|
|
||||||
const cacheListener = new CacheListener()
|
|
||||||
await caches.restore(gradleUserHome, cacheListener)
|
|
||||||
|
|
||||||
core.saveState(CACHE_LISTENER, cacheListener.stringify())
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function complete(): Promise<void> {
|
|
||||||
if (!core.getState(GRADLE_SETUP_VAR)) {
|
|
||||||
core.info('Gradle setup post-action only performed for first gradle-build-action step in workflow.')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const buildResults = loadBuildResults()
|
|
||||||
|
|
||||||
core.info('Stopping all Gradle daemons')
|
|
||||||
await stopAllDaemons(getUniqueGradleHomes(buildResults))
|
|
||||||
|
|
||||||
core.info('In final post-action step, saving state and writing summary')
|
|
||||||
const cacheListener: CacheListener = CacheListener.rehydrate(core.getState(CACHE_LISTENER))
|
|
||||||
|
|
||||||
const gradleUserHome = core.getState(GRADLE_USER_HOME)
|
|
||||||
await caches.save(gradleUserHome, cacheListener)
|
|
||||||
|
|
||||||
if (shouldGenerateJobSummary()) {
|
|
||||||
writeJobSummary(buildResults, cacheListener)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function determineGradleUserHome(rootDir: string): Promise<string> {
|
|
||||||
const customGradleUserHome = process.env['GRADLE_USER_HOME']
|
|
||||||
if (customGradleUserHome) {
|
|
||||||
return path.resolve(rootDir, customGradleUserHome)
|
|
||||||
}
|
|
||||||
|
|
||||||
return path.resolve(await determineUserHome(), '.gradle')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Different values can be returned by os.homedir() in Javascript and System.getProperty('user.home') in Java.
|
|
||||||
* In order to determine the correct Gradle User Home, we ask Java for the user home instead of using os.homedir().
|
|
||||||
*/
|
|
||||||
async function determineUserHome(): Promise<string> {
|
|
||||||
const output = await exec.getExecOutput('java', ['-XshowSettings:properties', '-version'], {silent: true})
|
|
||||||
const regex = /user\.home = (\S*)/i
|
|
||||||
const found = output.stderr.match(regex)
|
|
||||||
if (found == null || found.length <= 1) {
|
|
||||||
core.info('Could not determine user.home from java -version output. Using os.homedir().')
|
|
||||||
return os.homedir()
|
|
||||||
}
|
|
||||||
const userHome = found[1]
|
|
||||||
core.debug(`Determined user.home from java -version output: '${userHome}'`)
|
|
||||||
return userHome
|
|
||||||
}
|
|
||||||
|
|
||||||
function getUniqueGradleHomes(buildResults: BuildResult[]): string[] {
|
|
||||||
const gradleHomes = buildResults.map(buildResult => buildResult.gradleHomeDir)
|
|
||||||
return Array.from(new Set(gradleHomes))
|
|
||||||
}
|
|
||||||
|
|
||||||
async function stopAllDaemons(gradleHomes: string[]): Promise<void> {
|
|
||||||
const executions: Promise<number>[] = []
|
|
||||||
const args = ['--stop']
|
|
||||||
|
|
||||||
for (const gradleHome of gradleHomes) {
|
|
||||||
const executable = path.resolve(gradleHome, 'bin', 'gradle')
|
|
||||||
if (!fs.existsSync(executable)) {
|
|
||||||
core.warning(`Gradle executable not found at ${executable}. Could not stop Gradle daemons.`)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
core.info(`Stopping Gradle daemons in ${gradleHome}`)
|
|
||||||
executions.push(
|
|
||||||
exec.exec(executable, args, {
|
|
||||||
ignoreReturnCode: true
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
await Promise.all(executions)
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user