mirror of
https://github.com/gradle/actions.git
synced 2026-06-06 18:29:39 +08:00
Compare commits
674 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| de51428ba5 | |||
| 8096e65e0a | |||
| 9cd70b5460 | |||
| 63bcd47c1b | |||
| 306a7e4bb2 | |||
| c34d4a9731 | |||
| 213bb63776 | |||
| 4ca4968624 | |||
| fd1882690a | |||
| 0b5047ec4d | |||
| a4a9a30e86 | |||
| 865c16699a | |||
| 52ebf2721a | |||
| aea6ddad5b | |||
| a7f880172e | |||
| e644288a42 | |||
| e234151ec9 | |||
| 44e1837ae3 | |||
| b400dc555d | |||
| 3f2d9cde44 | |||
| 6001bc9edc | |||
| 5203a0b09d | |||
| 500607bc35 | |||
| 754892d4ae | |||
| ea24a0ad75 | |||
| 748dc30fdc | |||
| e4ed35bcaf | |||
| ece69c52b2 | |||
| 14c898b500 | |||
| 00cdd4dcf9 | |||
| b02f4f1968 | |||
| 0a36ca9fb8 | |||
| fe92974cdf | |||
| 6aa41b32df | |||
| 4fa0803854 | |||
| 9ab4abd18c | |||
| f375a232f2 | |||
| 85daf96c6d | |||
| 8b56c4af06 | |||
| 4da299730b | |||
| dff0fe1b20 | |||
| ae74c01440 | |||
| cde0632795 | |||
| 6cc033f2b3 | |||
| 8aaf080d68 | |||
| 4378b83ae3 | |||
| d3a78eb55f | |||
| f4d1e351c0 | |||
| 7b79b2a752 | |||
| 143774290e | |||
| a9a5bcf180 | |||
| f9c8fcf79f | |||
| 86e82987ba | |||
| 5fe4df6233 | |||
| d79b3ba8ae | |||
| 8f3c97e3f1 | |||
| d95713bd5d | |||
| bdf9736c53 | |||
| 7e85212f59 | |||
| 0c692feedb | |||
| 78da7b9646 | |||
| 992ccebeea | |||
| c13dc6c789 | |||
| 5e6af67a5e | |||
| e32d23f291 | |||
| a880eab216 | |||
| 6c8fe00271 | |||
| c37c1fb693 | |||
| 0c3292abfb | |||
| 66050d88b2 | |||
| 1771c6f669 | |||
| acc77da702 | |||
| bdb9f7fd28 | |||
| f9e15febb7 | |||
| 1ba2a63e58 | |||
| c838a38ea1 | |||
| 2e34e4f80f | |||
| 2bb20697b4 | |||
| 28b774ebdb | |||
| 12be8b4772 | |||
| be62f7d934 | |||
| c48eef1c6e | |||
| 544da49fda | |||
| 26ea4afa08 | |||
| a0f1efaaad | |||
| 7645e6e536 | |||
| c21b4ec861 | |||
| 30a933bf94 | |||
| 646074d659 | |||
| d63db6a05e | |||
| dc49976071 | |||
| 52bee6e472 | |||
| 57ec230092 | |||
| 549804ea2d | |||
| fd7acd5c1e | |||
| fb99e07d58 | |||
| 557c94c831 | |||
| 64508494d5 | |||
| c0b2cb764a | |||
| 71be92f02d | |||
| 08fb6c874a | |||
| 94d04eaa0d |
+4
-2
@@ -12,6 +12,7 @@
|
|||||||
"import/no-namespace": "off",
|
"import/no-namespace": "off",
|
||||||
"i18n-text/no-en": "off",
|
"i18n-text/no-en": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
|
"no-shadow": "off",
|
||||||
"sort-imports": "off",
|
"sort-imports": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||||
@@ -28,8 +29,9 @@
|
|||||||
"@typescript-eslint/no-for-in-array": "error",
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
"@typescript-eslint/no-inferrable-types": "error",
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
"@typescript-eslint/no-namespace": "error",
|
"@typescript-eslint/no-namespace": "error",
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/no-shadow": "error",
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
"@typescript-eslint/no-useless-constructor": "error",
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
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 build
|
||||||
|
- name: Upload distribution
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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/
|
||||||
+23
-3
@@ -6,13 +6,27 @@ 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: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
groups:
|
||||||
|
github-actions:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "weekly"
|
||||||
open-pull-requests-limit: 10
|
|
||||||
ignore:
|
ignore:
|
||||||
- dependency-name: "@types/node"
|
- dependency-name: "@types/node" # Breaking change: update with next major release
|
||||||
|
- dependency-name: "@octokit/rest" # Tied to node version
|
||||||
|
groups:
|
||||||
|
npm-dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
|
||||||
- package-ecosystem: "gradle"
|
- package-ecosystem: "gradle"
|
||||||
directory: ".github/workflow-samples/gradle-plugin"
|
directory: ".github/workflow-samples/gradle-plugin"
|
||||||
registries:
|
registries:
|
||||||
@@ -49,3 +63,9 @@ updates:
|
|||||||
- gradle-plugin-portal
|
- gradle-plugin-portal
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
- package-ecosystem: "gradle"
|
||||||
|
directory: "test/init-scripts"
|
||||||
|
registries:
|
||||||
|
- gradle-plugin-portal
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|||||||
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,14 @@
|
|||||||
rootProject.name = 'basic'
|
plugins {
|
||||||
|
id "com.gradle.enterprise" version "3.16.1"
|
||||||
|
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.12.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
gradleEnterprise {
|
||||||
|
buildScan {
|
||||||
|
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||||
|
termsOfServiceAgree = "yes"
|
||||||
|
publishAlways()
|
||||||
|
uploadInBackground = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rootProject.name = 'groovy-dsl'
|
||||||
|
|||||||
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.gradle.enterprise") version "3.10"
|
id("com.gradle.enterprise") version "3.16.1"
|
||||||
|
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.12.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
// Required to keep dependabot happy
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'no-ge'
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.build-scan" version "3.10"
|
id "com.gradle.build-scan" version "3.16.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.10"
|
id "com.gradle.enterprise" version "3.16.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
# the `language` matrix defined below to confirm you have the correct set of
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
# supported CodeQL languages.
|
# supported CodeQL languages.
|
||||||
#
|
#
|
||||||
name: "CodeQL"
|
name: CI-codeql
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -38,11 +38,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# 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)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -67,4 +67,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v3
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Dependency Review Action
|
||||||
|
#
|
||||||
|
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
||||||
|
#
|
||||||
|
# Source repository: https://github.com/actions/dependency-review-action
|
||||||
|
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
||||||
|
name: CI-dependency-review
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependency-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 'Checkout Repository'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: 'Dependency Review'
|
||||||
|
uses: actions/dependency-review-action@v3
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
name: CI-full-check
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- assigned
|
||||||
|
- review_requested
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '.github/**'
|
||||||
|
- 'dist/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action-inputs:
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
cache-cleanup:
|
||||||
|
uses: ./.github/workflows/integ-test-cache-cleanup.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
caching-config:
|
||||||
|
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}}-
|
||||||
|
|
||||||
|
execution-with-caching:
|
||||||
|
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
execution:
|
||||||
|
uses: ./.github/workflows/integ-test-execution.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
gradle-enterprise-injection:
|
||||||
|
uses: ./.github/workflows/integ-test-inject-gradle-enterprise.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
provision-gradle-versions:
|
||||||
|
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-configuration-cache:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
|
||||||
|
restore-custom-gradle-home:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-containerized-gradle-home:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-gradle-home:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-java-toolchain:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
sample-kotlin-dsl:
|
||||||
|
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
sample-gradle-plugin:
|
||||||
|
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
toolchain-detection:
|
||||||
|
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
name: CI-init-script-check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/ci-init-script-check.yml'
|
||||||
|
- 'src/resources/init-scripts/**'
|
||||||
|
- 'test/init-scripts/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-init-scripts:
|
||||||
|
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
|
||||||
|
uses: gradle/gradle-build-action@v2.11.0 # Use a released version to avoid breakages
|
||||||
|
- name: Run integration tests
|
||||||
|
working-directory: test/init-scripts
|
||||||
|
run: ./gradlew check
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
name: CI-quick-check
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches-ignore: main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-distribution:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build and upload distribution
|
||||||
|
uses: ./.github/actions/build-dist
|
||||||
|
|
||||||
|
run-unit-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Configure Gradle as default for unit test
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: 8.5
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run all
|
||||||
|
|
||||||
|
action-inputs:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
cache-cleanup:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-cache-cleanup.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
cache-key-prefix: ${{github.run_number}}- # Requires a fresh cache entry each run
|
||||||
|
|
||||||
|
caching-config:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
dependency-graph:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
execution-with-caching:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
execution:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-execution.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
gradle-enterprise-injection:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-inject-gradle-enterprise.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
provision-gradle-versions:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
restore-configuration-cache:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
|
||||||
|
restore-containerized-gradle-home:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||||
|
with:
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
restore-custom-gradle-home:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
|
with:
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
restore-gradle-home:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
restore-java-toolchain:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
sample-kotlin-dsl:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
sample-gradle-plugin:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
toolchain-detection:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
name: CI-verify-outputs
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- assigned
|
||||||
|
- review_requested
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dependabot/**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
npm -v
|
||||||
|
node -v
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- 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@v4
|
||||||
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
@@ -1,18 +1,27 @@
|
|||||||
name: Execute failure cases
|
name: demo-failure-cases
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
failing-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Test build failure
|
||||||
|
uses: ./
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
arguments: not-a-valid-task
|
||||||
|
|
||||||
wrapper-missing:
|
wrapper-missing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Test wrapper missing
|
- name: Test wrapper missing
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -24,7 +33,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Test bad config value
|
- name: Test bad config value
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
name: Demo Job Summary, for Gradle builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
many-gradle-builds:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build distribution
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
- 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
|
||||||
|
- 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
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew assemble
|
||||||
|
- name: Build kotlin-dsl project with multiple gradle invocations
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: |
|
||||||
|
./gradlew tasks --no-daemon
|
||||||
|
./gradlew help check
|
||||||
|
- name: Fail groovy-dsl project
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
continue-on-error: true
|
||||||
|
run: ./gradlew not-a-real-task
|
||||||
|
|
||||||
|
successful-builds-with-no-summary:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build distribution
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
- 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: Build distribution
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
- 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
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
name: Demo adding Build Scan® comment to PR
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [assigned, review_requested]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
successful-build-with-always-comment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout project sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
add-job-summary-as-pr-comment: always
|
||||||
|
- name: Run build with Gradle wrapper
|
||||||
|
id: gradle
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew build --scan
|
||||||
|
|
||||||
|
successful-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 build --scan
|
||||||
|
|
||||||
|
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
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
name: Verify generated outputs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run all
|
|
||||||
- name: Check for uncommitted changes
|
|
||||||
# Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
|
|
||||||
run: |
|
|
||||||
git diff --exit-code --stat -- . ':!node_modules' \
|
|
||||||
|| (echo "##[error] found changed files after build. please 'npm run all'" \
|
|
||||||
"and check in all changes" \
|
|
||||||
&& exit 1)
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
name: Test action inputs
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action-inputs:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Invoke with multi-line arguments
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: |
|
||||||
|
--configuration-cache
|
||||||
|
--build-cache
|
||||||
|
-DsystemProperty=FOO
|
||||||
|
-PgradleProperty=BAR
|
||||||
|
test
|
||||||
|
jar
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
name: Test cache cleanup
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: integ-test-cache-cleanup-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
full-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build with 3.1
|
||||||
|
working-directory: test/jest/resources/cache-cleanup
|
||||||
|
run: gradle --no-daemon --build-cache -Dcommons_math3_version="3.1" build
|
||||||
|
|
||||||
|
# Second build will use the cache from the first build, but cleanup should remove unused artifacts
|
||||||
|
assemble-build:
|
||||||
|
needs: full-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false
|
||||||
|
gradle-home-cache-cleanup: true
|
||||||
|
- name: Build with 3.1.1
|
||||||
|
working-directory: test/jest/resources/cache-cleanup
|
||||||
|
run: gradle --no-daemon --build-cache -Dcommons_math3_version="3.1.1" build
|
||||||
|
|
||||||
|
check-clean-cache:
|
||||||
|
needs: assemble-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Report Gradle User Home
|
||||||
|
run: du -hc ~/.gradle/caches/modules-2
|
||||||
|
- name: Verify cleaned cache
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ! -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1.1 ]; then
|
||||||
|
echo "::error ::Should find commons-math3 3.1.1 in cache"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1 ]; then
|
||||||
|
echo "::error ::Should NOT find commons-math3 3.1 in cache"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
+48
-32
@@ -1,40 +1,45 @@
|
|||||||
name: Test caching configuration
|
name: Test caching configuration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
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
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
# Add "enterprise" to main cache entry but omit "notifications"
|
# Add "enterprise" to main cache entry but omit "notifications"
|
||||||
gradle-home-cache-includes: |
|
gradle-home-cache-includes: |
|
||||||
caches
|
caches
|
||||||
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
|
||||||
@@ -44,11 +49,13 @@ jobs:
|
|||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -57,7 +64,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
|
||||||
@@ -67,11 +75,13 @@ jobs:
|
|||||||
cache-disabled:
|
cache-disabled:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -80,19 +90,21 @@ 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@v3
|
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@v2
|
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
|
||||||
@@ -101,24 +113,26 @@ 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@v3
|
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:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -129,15 +143,17 @@ jobs:
|
|||||||
|
|
||||||
verify-write-only-build:
|
verify-write-only-build:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||||
needs: seed-build-write-only
|
needs: seed-build-write-only
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
name: Test dependency graph
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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
|
||||||
|
- 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 }}"
|
||||||
|
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
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
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"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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)
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
name: Test execution with caching
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Execute Gradle build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: test
|
||||||
|
|
||||||
|
# Test that the gradle-user-home is restored
|
||||||
|
verify-build:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Execute Gradle build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: test --offline -DverifyCachedBuild=true
|
||||||
|
|
||||||
+36
-21
@@ -1,19 +1,21 @@
|
|||||||
name: Test Gradle execution
|
name: Test execution
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Tests for executing with different Gradle versions.
|
# Tests for executing with different Gradle versions.
|
||||||
@@ -21,17 +23,20 @@ jobs:
|
|||||||
gradle-execution:
|
gradle-execution:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
script-suffix: '.bat'
|
script-suffix: '.bat'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
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:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
gradle-version: 6.9
|
gradle-version: 6.9
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper
|
build-root-directory: .github/workflow-samples/no-wrapper
|
||||||
arguments: help -DgradleVersionCheck=6.9
|
arguments: help -DgradleVersionCheck=6.9
|
||||||
@@ -46,34 +51,44 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
gradle-executable: .github/workflow-samples/groovy-dsl/gradlew${{ matrix.script-suffix }}
|
gradle-executable: .github/workflow-samples/groovy-dsl/gradlew${{ matrix.script-suffix }}
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper
|
build-root-directory: .github/workflow-samples/no-wrapper
|
||||||
arguments: help -DgradleVersionCheck=7.4.2
|
arguments: help
|
||||||
|
|
||||||
gradle-versions:
|
gradle-versions:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
gradle: [7.5.1, 6.9.2, 5.6.4, 4.10.3, 3.5.1]
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- gradle: 5.6.4
|
- gradle: 5.6.4
|
||||||
build-root-suffix: -gradle-5
|
build-root-suffix: -gradle-5
|
||||||
- gradle: 4.10.3
|
- gradle: 4.10.3
|
||||||
build-root-suffix: -gradle-4
|
build-root-suffix: -gradle-4
|
||||||
|
- gradle: 3.5.1
|
||||||
|
build-root-suffix: -gradle-4
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 8
|
||||||
- name: Run Gradle build
|
- name: Run Gradle build
|
||||||
uses: ./
|
uses: ./
|
||||||
id: gradle
|
id: gradle
|
||||||
with:
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
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@v3
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
name: Test gradle enterprise injection
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENTERPRISE_ACCESS_KEY:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
GRADLE_ENTERPRISE_INJECTION_ENABLED: true
|
||||||
|
GRADLE_ENTERPRISE_URL: https://ge.solutions-team.gradle.com
|
||||||
|
GRADLE_ENTERPRISE_PLUGIN_VERSION: 3.16.1
|
||||||
|
GRADLE_ENTERPRISE_CCUD_PLUGIN_VERSION: 1.12.1
|
||||||
|
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
inject-gradle-enterprise:
|
||||||
|
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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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')
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
name: Test provision Gradle versions
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Tests for executing with different Gradle versions.
|
||||||
|
# Each build verifies that it is executed with the expected Gradle version.
|
||||||
|
provision-gradle:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
script-suffix: '.bat'
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle with v6.9
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
gradle-version: 6.9
|
||||||
|
- name: Test uses Gradle v6.9
|
||||||
|
working-directory: .github/workflow-samples/no-wrapper
|
||||||
|
run: gradle help "-DgradleVersionCheck=6.9"
|
||||||
|
- name: Setup Gradle with v7.1.1
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: 7.1.1
|
||||||
|
- name: Test uses Gradle v7.1.1
|
||||||
|
working-directory: .github/workflow-samples/no-wrapper
|
||||||
|
run: gradle help "-DgradleVersionCheck=7.1.1"
|
||||||
|
- name: Setup Gradle with release-candidate
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
gradle-version: release-candidate
|
||||||
|
- name: Test use release-candidate
|
||||||
|
working-directory: .github/workflow-samples/no-wrapper
|
||||||
|
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:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
gradle: [7.3, 6.9, 5.6.4, 4.10.3, 3.5.1]
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
include:
|
||||||
|
- gradle: 5.6.4
|
||||||
|
build-root-suffix: -gradle-5
|
||||||
|
- gradle: 4.10.3
|
||||||
|
build-root-suffix: -gradle-4
|
||||||
|
- gradle: 3.5.1
|
||||||
|
build-root-suffix: -gradle-4
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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: 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
|
||||||
|
id: gradle
|
||||||
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
|
- 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')
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
name: Test restore configuration-cache
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
secrets:
|
||||||
|
GRADLE_ENCRYPTION_KEY:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build-groovy:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
|
verify-build-groovy:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||||
|
needs: seed-build-groovy
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
|
gradle-version: 8.6-rc-1
|
||||||
|
- name: Groovy build with configuration-cache enabled
|
||||||
|
id: execute
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: gradle test --configuration-cache
|
||||||
|
- name: Check that configuration-cache was used
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
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
|
||||||
|
gradle-user-home-not-fully-restored:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||||
|
needs: seed-build-groovy
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
|
uses: ./
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
||||||
|
with:
|
||||||
|
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)
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
|
seed-build-kotlin:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: gradle help --configuration-cache
|
||||||
|
|
||||||
|
modify-build-kotlin:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin-modified
|
||||||
|
needs: seed-build-kotlin
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: gradle test --configuration-cache
|
||||||
|
|
||||||
|
# Test restore configuration-cache from the third build invocation
|
||||||
|
verify-build-kotlin:
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin-modified
|
||||||
|
needs: modify-build-kotlin
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
id: execute
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: gradle test --configuration-cache
|
||||||
|
- name: Check that configuration-cache was used
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
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')
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
name: Test restore custom Gradle Home
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: fedora:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
distribution: temurin
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build using Gradle wrapper
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||||
|
dependencies-cache:
|
||||||
|
needs: seed-build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: fedora:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
distribution: temurin
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build with --offline
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test --offline
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
name: Test restore custom Gradle Home
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set Gradle User Home
|
||||||
|
run: |
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build using Gradle wrapper
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test --info
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||||
|
dependencies-cache:
|
||||||
|
needs: seed-build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set Gradle User Home
|
||||||
|
run: |
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build with --offline
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test --offline --info
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||||
|
build-cache:
|
||||||
|
needs: seed-build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set Gradle User Home
|
||||||
|
run: |
|
||||||
|
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||||
|
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build and verify tasks from cache
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test -DverifyCachedBuild=true --info
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
name: Test restore Gradle Home
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
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_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build using Gradle wrapper
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||||
|
dependencies-cache:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build with --offline
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test --offline
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||||
|
build-cache:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build and verify tasks from cache
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
run: ./gradlew test -DverifyCachedBuild=true
|
||||||
|
|
||||||
|
# Check that the build can run when Gradle User Home is not fully restored
|
||||||
|
no-extracted-cache-entries-restored:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
|
uses: ./
|
||||||
|
env:
|
||||||
|
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Check executee Gradle build
|
||||||
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
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: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- 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
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
name: Test restore java toolchains
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build using Gradle wrapper
|
||||||
|
working-directory: .github/workflow-samples/java-toolchain
|
||||||
|
run: ./gradlew test --info
|
||||||
|
|
||||||
|
# Test that the gradle-user-home cache will cache the toolchain, by running build with --offline
|
||||||
|
toolchain-cache:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Execute Gradle build with --offline
|
||||||
|
working-directory: .github/workflow-samples/java-toolchain
|
||||||
|
run: ./gradlew test --info --offline
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
name: Test sample Gradle Plugin project
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build gradle-plugin project
|
||||||
|
working-directory: .github/workflow-samples/gradle-plugin
|
||||||
|
run: ./gradlew build
|
||||||
|
|
||||||
|
verify-build:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Build gradle-plugin project
|
||||||
|
working-directory: .github/workflow-samples/gradle-plugin
|
||||||
|
run: ./gradlew build --offline
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
name: Test sample Kotlin DSL project
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
runner-os:
|
||||||
|
type: string
|
||||||
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||||
|
- name: Build kotlin-dsl project
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew build
|
||||||
|
|
||||||
|
verify-build:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
- name: Build kotlin-dsl project
|
||||||
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
|
run: ./gradlew build --offline
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
name: Test different action inputs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
action-inputs:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Invoke with multi-line arguments
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: |
|
|
||||||
--configuration-cache
|
|
||||||
--build-cache
|
|
||||||
-DsystemProperty=FOO
|
|
||||||
-PgradleProperty=BAR
|
|
||||||
test
|
|
||||||
jar
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
name: Test save/restore configuration-cache state
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Run initial Gradle builds to push initial cache entries
|
|
||||||
# These builds should start fresh without cache hits, due to the seed injected into the cache key above.
|
|
||||||
seed-build-groovy:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Groovy build with configuration-cache enabled
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --configuration-cache
|
|
||||||
|
|
||||||
configuration-cache-groovy:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
|
||||||
needs: seed-build-groovy
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Groovy build with configuration-cache enabled
|
|
||||||
id: execute
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --configuration-cache
|
|
||||||
- name: Check that configuration-cache was used
|
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
|
||||||
|
|
||||||
# Check that the build can run when no extracted cache entries are restored
|
|
||||||
no-extracted-cache-entries-restored:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
|
||||||
needs: seed-build-groovy
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
|
||||||
uses: ./
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Check execute Gradle build with configuration cache enabled (but not restored)
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --configuration-cache
|
|
||||||
|
|
||||||
seed-build-kotlin:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Execute 'help' with configuration-cache enabled
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew help --configuration-cache
|
|
||||||
|
|
||||||
modify-build-kotlin:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
|
||||||
needs: seed-build-kotlin
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Execute 'test' with configuration-cache enabled
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew test --configuration-cache
|
|
||||||
|
|
||||||
# Test restore configuration-cache from the third build invocation
|
|
||||||
configuration-cache-kotlin:
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
|
||||||
needs: modify-build-kotlin
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute 'test' again with configuration-cache enabled
|
|
||||||
id: execute
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew test --configuration-cache
|
|
||||||
- name: Check that configuration-cache was used
|
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
|
||||||
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
name: Test save/restore Gradle Home directory
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build using Gradle wrapper
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test
|
|
||||||
|
|
||||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
|
||||||
dependencies-cache:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute Gradle build with --offline
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --offline
|
|
||||||
|
|
||||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
|
||||||
build-cache:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute Gradle build and verify tasks from cache
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test -DverifyCachedBuild=true
|
|
||||||
|
|
||||||
# Check that the build can run when Gradle User Home is not fully restored
|
|
||||||
no-extracted-cache-entries-restored:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
|
||||||
uses: ./
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Check executee Gradle build
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test
|
|
||||||
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
name: Test save/restore java toolchains
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build using Gradle wrapper
|
|
||||||
working-directory: .github/workflow-samples/java-toolchain
|
|
||||||
run: ./gradlew test --info
|
|
||||||
|
|
||||||
# Test that the gradle-user-home cache will cache the toolchain, by running build with --offline
|
|
||||||
toolchain-cache:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute Gradle build with --offline
|
|
||||||
working-directory: .github/workflow-samples/java-toolchain
|
|
||||||
run: ./gradlew test --info --offline
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
name: Test save/restore Gradle state with direct execution
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Execute Gradle build
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: test
|
|
||||||
|
|
||||||
# Test that the gradle-user-home is restored
|
|
||||||
verify-build:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Execute Gradle build
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: test --offline -DverifyCachedBuild=true
|
|
||||||
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
name: Test caching with a custom GRADLE_USER_HOME
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
GRADLE_USER_HOME: ${{github.workspace}}/custom/gradle/home
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Run initial Gradle builds to push initial cache entries
|
|
||||||
# These builds should start fresh without cache hits, due to the seed injected into the cache key above.
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build using Gradle wrapper
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --info
|
|
||||||
|
|
||||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
|
||||||
dependencies-cache:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute Gradle build with --offline
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test --offline --info
|
|
||||||
|
|
||||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
|
||||||
build-cache:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
- name: Execute Gradle build and verify tasks from cache
|
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
run: ./gradlew test -DverifyCachedBuild=true --info
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
name: Test provision different Gradle versions
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Tests for executing with different Gradle versions.
|
|
||||||
# Each build verifies that it is executed with the expected Gradle version.
|
|
||||||
provision-gradle:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
include:
|
|
||||||
- os: windows-latest
|
|
||||||
script-suffix: '.bat'
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle with v6.9
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
gradle-version: 6.9
|
|
||||||
- name: Test uses Gradle v6.9
|
|
||||||
working-directory: .github/workflow-samples/no-wrapper
|
|
||||||
run: gradle help "-DgradleVersionCheck=6.9"
|
|
||||||
- name: Setup Gradle with v7.1.1
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
gradle-version: 7.1.1
|
|
||||||
- name: Test uses Gradle v7.1.1
|
|
||||||
working-directory: .github/workflow-samples/no-wrapper
|
|
||||||
run: gradle help "-DgradleVersionCheck=7.1.1"
|
|
||||||
- name: Setup Gradle with release-candidate
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
gradle-version: release-candidate
|
|
||||||
- name: Test use release-candidate
|
|
||||||
working-directory: .github/workflow-samples/no-wrapper
|
|
||||||
run: gradle help
|
|
||||||
|
|
||||||
gradle-versions:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
include:
|
|
||||||
- gradle: 5.6.4
|
|
||||||
build-root-suffix: -gradle-5
|
|
||||||
- gradle: 4.10.3
|
|
||||||
build-root-suffix: -gradle-4
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
gradle-version: ${{ matrix.gradle }}
|
|
||||||
- name: Run Gradle build
|
|
||||||
id: gradle
|
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
|
||||||
- name: Check build scan url
|
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
|
||||||
uses: actions/github-script@v3
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
core.setFailed('No build scan detected')
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
name: Test caching with Gradle Plugin project using TestKit
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build gradle-plugin project
|
|
||||||
working-directory: .github/workflow-samples/gradle-plugin
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
verify-build:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build gradle-plugin project
|
|
||||||
working-directory: .github/workflow-samples/gradle-plugin
|
|
||||||
run: ./gradlew build --offline
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
name: Test caching with Kotlin DSL
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build kotlin-dsl project
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
verify-build:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Build kotlin-dsl project
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew build --offline
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
name: Add a build scan comment to PR
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
jobs:
|
|
||||||
gradle:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout project sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: ./
|
|
||||||
- name: Run build with Gradle wrapper
|
|
||||||
id: gradle
|
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
|
||||||
run: ./gradlew build --scan
|
|
||||||
- name: "Add build scan URL as PR comment"
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
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: 'PR ready for review: ${{ steps.gradle.outputs.build-scan-url }}'
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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 }}
|
||||||
@@ -102,5 +102,3 @@ __tests__/runner/*
|
|||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
# ASDF tool configuration
|
|
||||||
.tool-versions
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Configuration file for asdf version manager
|
||||||
|
nodejs 20.10.0
|
||||||
|
gradle 8.5
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
### How to merge a Dependabot PR
|
||||||
|
|
||||||
|
The "distribution" for a GitHub Action is checked into the repository itself.
|
||||||
|
In the case of the `gradle-build-action`, the transpiled sources are committed to the `dist` directory.
|
||||||
|
Any production dependencies are inlined into the distribution.
|
||||||
|
So if a Dependabot PR updates a production dependency (or a dev dependency that changes the distribution, like the Typescript compiler),
|
||||||
|
then a manual step is required to rebuild the dist and commit.
|
||||||
|
|
||||||
|
The simplest process to follow is:
|
||||||
|
1. Checkout the dependabot branch locally eg: `git checkout dependabot/npm_and_yarn/actions/github-5.1.0`
|
||||||
|
2. Run `npm install` to download and the new dependencies and install locally
|
||||||
|
3. Run `npm run build` to regenerate the distribution
|
||||||
|
4. Push the changes to the dependabot branch
|
||||||
|
5. If/when the checks pass, you can merge the dependabot PR
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'java'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testImplementation('junit:junit:4.12')
|
|
||||||
}
|
|
||||||
Binary file not shown.
-185
@@ -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" "$@"
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+73
-14
@@ -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:
|
||||||
@@ -14,11 +14,30 @@ inputs:
|
|||||||
default: false
|
default: false
|
||||||
|
|
||||||
cache-read-only:
|
cache-read-only:
|
||||||
description: When 'true', existing entries will be read from the cache but no entries will be written.
|
description: |
|
||||||
|
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.
|
||||||
|
required: false
|
||||||
|
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
|
||||||
|
|
||||||
|
cache-write-only:
|
||||||
|
description: |
|
||||||
|
When 'true', entries will not be restored from the cache but will be saved at the end of the Job.
|
||||||
|
Setting this to 'true' implies cache-read-only will be 'false'.
|
||||||
|
required: 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
|
required: false
|
||||||
default: false
|
|
||||||
# e.g. Use the following setting to only write cache entries from your 'main' branch
|
|
||||||
# cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
|
||||||
|
|
||||||
gradle-home-cache-includes:
|
gradle-home-cache-includes:
|
||||||
description: Paths within Gradle User Home to cache.
|
description: Paths within Gradle User Home to cache.
|
||||||
@@ -34,41 +53,81 @@ 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' and 'download-and-submit'.
|
||||||
|
required: false
|
||||||
|
default: 'disabled'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
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.
|
||||||
|
|
||||||
gradle-executable:
|
gradle-executable:
|
||||||
description: Path to the Gradle executable
|
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
|
||||||
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:
|
||||||
|
description: When 'false', no Job Summary will be generated for the Job.
|
||||||
|
required: false
|
||||||
|
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.
|
||||||
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
||||||
# Use at your own risk!
|
# Use at your own risk!
|
||||||
cache-write-only:
|
|
||||||
description: When 'true', entries will not be restored from the cache but will be saved at the end of the Job. This allows a 'clean' cache entry to be written.
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
gradle-home-cache-strict-match:
|
gradle-home-cache-strict-match:
|
||||||
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.
|
||||||
|
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.
|
||||||
|
gradle-version:
|
||||||
|
description: Version of Gradle that was setup by the action
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/main/index.js'
|
main: 'dist/main/index.js'
|
||||||
post: 'dist/post/index.js'
|
post: 'dist/post/index.js'
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: 'Clear dependency graph for a correlator'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
job-correlator:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Set current timestamp as env variable
|
||||||
|
shell: bash
|
||||||
|
run: echo "NOW=$(date -Iseconds)" >> $GITHUB_ENV
|
||||||
|
- name: Submit empty dependency graph
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -L \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ github.token }}" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/dependency-graph/snapshots \
|
||||||
|
-d '{ "version" : 0, "job" : { "id" : "${{ github.run_id }}", "correlator" : "${{ inputs.job-correlator }} " }, "sha" : "${{ github.sha }}", "ref" : "${{ github.ref }}", "detector" : { "name" : "GitHub Dependency Graph Gradle Plugin", "version" : "0.0.3", "url" : "https://github.com/gradle/github-dependency-graph-gradle-plugin" }, "manifests" : {}, "scanned" : "${{ env.NOW }}" }'
|
||||||
|
- run: echo "::notice ::Cleared dependency graph for job correlator '${{ inputs.job-correlator }}'"
|
||||||
|
shell: bash
|
||||||
Vendored
+141507
-237
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+138592
-237
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Generated
+6636
-4137
File diff suppressed because it is too large
Load Diff
+30
-20
@@ -8,9 +8,13 @@
|
|||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"build": "ncc build src/main.ts --out dist/main --source-map --minify && ncc build src/post.ts --out dist/post --source-map --minify",
|
"compile-main": "ncc build src/main.ts --out dist/main --source-map --no-source-map-register",
|
||||||
|
"compile-post": "ncc build src/post.ts --out dist/post --source-map --no-source-map-register",
|
||||||
|
"compile": "npm run compile-main && npm run compile-post",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"all": "npm run format && npm run lint && npm run build && npm test"
|
"check": "npm run format && npm run lint",
|
||||||
|
"build": "npm run check && npm run compile",
|
||||||
|
"all": "npm run build && npm test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -24,28 +28,34 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "2.0.4",
|
"@actions/artifact": "2.0.0",
|
||||||
"@actions/core": "1.8.2",
|
"@actions/cache": "3.2.2",
|
||||||
|
"@actions/core": "1.10.1",
|
||||||
"@actions/exec": "1.1.1",
|
"@actions/exec": "1.1.1",
|
||||||
"@actions/github": "5.0.3",
|
"@actions/github": "6.0.0",
|
||||||
"@actions/glob": "0.3.0",
|
"@actions/glob": "0.4.0",
|
||||||
"@actions/http-client": "2.0.1",
|
"@actions/http-client": "2.2.0",
|
||||||
"@actions/tool-cache": "2.0.1",
|
"@actions/tool-cache": "2.0.1",
|
||||||
"string-argv": "0.3.1"
|
"@octokit/rest": "19.0.13",
|
||||||
|
"@octokit/webhooks-types": "7.3.1",
|
||||||
|
"semver": "7.5.4",
|
||||||
|
"string-argv": "0.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "16.11.21",
|
"@types/jest": "29.5.11",
|
||||||
"@types/unzipper": "0.10.5",
|
"@types/node": "20.10.0",
|
||||||
"@typescript-eslint/parser": "5.23.0",
|
"@types/unzipper": "0.10.9",
|
||||||
"@vercel/ncc": "0.33.4",
|
"@typescript-eslint/parser": "6.17.0",
|
||||||
"eslint": "8.15.0",
|
"@vercel/ncc": "0.38.1",
|
||||||
"eslint-plugin-github": "4.3.6",
|
"eslint": "8.56.0",
|
||||||
"eslint-plugin-jest": "26.2.2",
|
"eslint-plugin-github": "4.10.1",
|
||||||
"jest": "28.1.0",
|
"eslint-plugin-jest": "27.6.1",
|
||||||
|
"eslint-plugin-prettier": "5.1.2",
|
||||||
|
"jest": "29.7.0",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"patch-package": "6.4.7",
|
"patch-package": "8.0.0",
|
||||||
"prettier": "2.6.2",
|
"prettier": "3.1.1",
|
||||||
"ts-jest": "28.0.2",
|
"ts-jest": "29.1.1",
|
||||||
"typescript": "4.6.4"
|
"typescript": "5.3.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 0b5a2a8..757ad88 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;
|
|
||||||
@@ -138,6 +140,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()) {
|
|
||||||
@@ -145,6 +148,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()) {
|
|
||||||
@@ -176,8 +180,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
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
diff --git a/node_modules/@actions/cache/lib/cache.d.ts b/node_modules/@actions/cache/lib/cache.d.ts
|
||||||
|
index 4658366..b796e58 100644
|
||||||
|
--- a/node_modules/@actions/cache/lib/cache.d.ts
|
||||||
|
+++ b/node_modules/@actions/cache/lib/cache.d.ts
|
||||||
|
@@ -21,7 +21,7 @@ export declare function isFeatureAvailable(): boolean;
|
||||||
|
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||||
|
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||||
|
*/
|
||||||
|
-export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise<string | undefined>;
|
||||||
|
+export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise<CacheEntry | undefined>;
|
||||||
|
/**
|
||||||
|
* Saves a list of files with the specified key
|
||||||
|
*
|
||||||
|
@@ -31,4 +31,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, enableCrossOsArchive?: boolean): Promise<number>;
|
||||||
|
+export declare function saveCache(paths: string[], key: string, options?: UploadOptions, enableCrossOsArchive?: boolean): 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 9d636aa..a176bd7 100644
|
||||||
|
--- a/node_modules/@actions/cache/lib/cache.js
|
||||||
|
+++ b/node_modules/@actions/cache/lib/cache.js
|
||||||
|
@@ -127,18 +127,21 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
||||||
|
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||||
|
yield (0, tar_1.extractTar)(archivePath, compressionMethod);
|
||||||
|
core.info('Cache restored successfully');
|
||||||
|
- return cacheEntry.cacheKey;
|
||||||
|
- }
|
||||||
|
- catch (error) {
|
||||||
|
- const typedError = error;
|
||||||
|
- if (typedError.name === ValidationError.name) {
|
||||||
|
- throw error;
|
||||||
|
- }
|
||||||
|
- else {
|
||||||
|
- // Supress all non-validation cache related errors because caching should be optional
|
||||||
|
- core.warning(`Failed to restore: ${error.message}`);
|
||||||
|
- }
|
||||||
|
+
|
||||||
|
+ // PATCHED - Return more inforamtion about restored entry
|
||||||
|
+ return new CacheEntry(cacheEntry.cacheKey, archiveFileSize);;
|
||||||
|
}
|
||||||
|
+ // PATCHED - propagate errors
|
||||||
|
+ // catch (error) {
|
||||||
|
+ // const typedError = error;
|
||||||
|
+ // if (typedError.name === ValidationError.name) {
|
||||||
|
+ // throw error;
|
||||||
|
+ // }
|
||||||
|
+ // else {
|
||||||
|
+ // // Supress all non-validation cache related errors because caching should be optional
|
||||||
|
+ // core.warning(`Failed to restore: ${error.message}`);
|
||||||
|
+ // }
|
||||||
|
+ // }
|
||||||
|
finally {
|
||||||
|
// Try to delete the archive to save space
|
||||||
|
try {
|
||||||
|
@@ -206,19 +209,23 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
}
|
||||||
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
|
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||||
|
+
|
||||||
|
+ // PATCHED - Return more inforamtion about saved entry
|
||||||
|
+ return new CacheEntry(key, archiveFileSize);
|
||||||
|
}
|
||||||
|
- catch (error) {
|
||||||
|
- const typedError = error;
|
||||||
|
- if (typedError.name === ValidationError.name) {
|
||||||
|
- throw error;
|
||||||
|
- }
|
||||||
|
- else if (typedError.name === ReserveCacheError.name) {
|
||||||
|
- core.info(`Failed to save: ${typedError.message}`);
|
||||||
|
- }
|
||||||
|
- else {
|
||||||
|
- core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ // PATCHED - propagate errors
|
||||||
|
+ // catch (error) {
|
||||||
|
+ // const typedError = error;
|
||||||
|
+ // if (typedError.name === ValidationError.name) {
|
||||||
|
+ // throw error;
|
||||||
|
+ // }
|
||||||
|
+ // else if (typedError.name === ReserveCacheError.name) {
|
||||||
|
+ // core.info(`Failed to save: ${typedError.message}`);
|
||||||
|
+ // }
|
||||||
|
+ // else {
|
||||||
|
+ // core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
+ // }
|
||||||
|
+ // }
|
||||||
|
finally {
|
||||||
|
// Try to delete the archive to save space
|
||||||
|
try {
|
||||||
|
@@ -232,4 +239,11 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
diff --git a/node_modules/@azure/logger/dist-esm/src/debug.js b/node_modules/@azure/logger/dist-esm/src/debug.js
|
||||||
|
index d202779..30e8313 100644
|
||||||
|
--- a/node_modules/@azure/logger/dist-esm/src/debug.js
|
||||||
|
+++ b/node_modules/@azure/logger/dist-esm/src/debug.js
|
||||||
|
@@ -7,7 +7,7 @@ let enabledNamespaces = [];
|
||||||
|
let skippedNamespaces = [];
|
||||||
|
const debuggers = [];
|
||||||
|
if (debugEnvVariable) {
|
||||||
|
- enable(debugEnvVariable);
|
||||||
|
+ // enable(debugEnvVariable);
|
||||||
|
}
|
||||||
|
const debugObj = Object.assign((namespace) => {
|
||||||
|
return createDebugger(namespace);
|
||||||
|
diff --git a/node_modules/@azure/logger/dist-esm/src/index.js b/node_modules/@azure/logger/dist-esm/src/index.js
|
||||||
|
index cc25720..2925db5 100644
|
||||||
|
--- a/node_modules/@azure/logger/dist-esm/src/index.js
|
||||||
|
+++ b/node_modules/@azure/logger/dist-esm/src/index.js
|
||||||
|
@@ -20,7 +20,7 @@ if (logLevelFromEnv) {
|
||||||
|
setLogLevel(logLevelFromEnv);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
- console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
|
||||||
|
+ console.error(`AZURE_LOG_LEVEL set to unknown log level; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
diff --git a/node_modules/@azure/logger/dist/index.js b/node_modules/@azure/logger/dist/index.js
|
||||||
|
index 81e97c3..a415e2f 100644
|
||||||
|
--- a/node_modules/@azure/logger/dist/index.js
|
||||||
|
+++ b/node_modules/@azure/logger/dist/index.js
|
||||||
|
@@ -21,7 +21,7 @@ let enabledNamespaces = [];
|
||||||
|
let skippedNamespaces = [];
|
||||||
|
const debuggers = [];
|
||||||
|
if (debugEnvVariable) {
|
||||||
|
- enable(debugEnvVariable);
|
||||||
|
+ // enable(debugEnvVariable);
|
||||||
|
}
|
||||||
|
const debugObj = Object.assign((namespace) => {
|
||||||
|
return createDebugger(namespace);
|
||||||
|
@@ -125,7 +125,7 @@ if (logLevelFromEnv) {
|
||||||
|
setLogLevel(logLevelFromEnv);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
- console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
|
||||||
|
+ console.error(`AZURE_LOG_LEVEL set to unknown log level; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
@@ -1 +0,0 @@
|
|||||||
[FIX] Save/restore exploded Gradle dist rather than zip
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
|
export interface BuildResult {
|
||||||
|
get rootProjectName(): string
|
||||||
|
get rootProjectDir(): string
|
||||||
|
get requestedTasks(): string
|
||||||
|
get gradleVersion(): string
|
||||||
|
get gradleHomeDir(): string
|
||||||
|
get buildFailed(): boolean
|
||||||
|
get buildScanUri(): string
|
||||||
|
get buildScanFailed(): boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
+81
-147
@@ -1,104 +1,40 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as github from '@actions/github'
|
import * as glob from '@actions/glob'
|
||||||
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import * as params from './input-params'
|
||||||
import {CacheListener} from './cache-reporting'
|
import {CacheListener} from './cache-reporting'
|
||||||
import {
|
import {saveCache, restoreCache, cacheDebug, isCacheDebuggingEnabled, tryDelete, generateCacheKey} from './cache-utils'
|
||||||
getCacheKeyPrefix,
|
import {GradleHomeEntryExtractor, ConfigurationCacheEntryExtractor} from './cache-extract-entries'
|
||||||
determineJobContext,
|
|
||||||
saveCache,
|
|
||||||
restoreCache,
|
|
||||||
cacheDebug,
|
|
||||||
isCacheDebuggingEnabled,
|
|
||||||
tryDelete
|
|
||||||
} from './cache-utils'
|
|
||||||
import {ConfigurationCacheEntryExtractor, GradleHomeEntryExtractor} from './cache-extract-entries'
|
|
||||||
|
|
||||||
const CACHE_PROTOCOL_VERSION = 'v6-'
|
|
||||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
||||||
|
|
||||||
export const META_FILE_DIR = '.gradle-build-action'
|
export const META_FILE_DIR = '.gradle-build-action'
|
||||||
export const PROJECT_ROOTS_FILE = 'project-roots.txt'
|
|
||||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
|
||||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
|
||||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
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:
|
|
||||||
* - A user-defined prefix (optional)
|
|
||||||
* - 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
|
|
||||||
*/
|
|
||||||
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 runnerOs = process.env['RUNNER_OS'] || ''
|
|
||||||
const cacheKeyForOs = `${cacheKeyBase}|${runnerOs}`
|
|
||||||
|
|
||||||
// Prefer caches that run this job
|
|
||||||
const cacheKeyForJob = `${cacheKeyForOs}|${github.context.job}`
|
|
||||||
|
|
||||||
// Prefer (even more) jobs that run this job with the same context (matrix)
|
|
||||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${determineJobContext()}]`
|
|
||||||
|
|
||||||
// Exact match on Git SHA
|
|
||||||
const cacheKey = `${cacheKeyForJobContext}-${github.context.sha}`
|
|
||||||
|
|
||||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForOs])
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GradleStateCache {
|
export class GradleStateCache {
|
||||||
private cacheName: string
|
private cacheName: string
|
||||||
private cacheDescription: string
|
private cacheDescription: string
|
||||||
|
|
||||||
|
protected readonly userHome: string
|
||||||
protected readonly gradleUserHome: string
|
protected readonly gradleUserHome: string
|
||||||
|
|
||||||
constructor(gradleUserHome: string) {
|
constructor(userHome: string, gradleUserHome: string) {
|
||||||
|
this.userHome = userHome
|
||||||
this.gradleUserHome = gradleUserHome
|
this.gradleUserHome = gradleUserHome
|
||||||
this.cacheName = 'gradle'
|
this.cacheName = 'gradle'
|
||||||
this.cacheDescription = 'Gradle User Home'
|
this.cacheDescription = 'Gradle User Home'
|
||||||
}
|
}
|
||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
const actionCacheDir = path.resolve(this.gradleUserHome, '.gradle-build-action')
|
this.initializeGradleUserHome()
|
||||||
fs.mkdirSync(actionCacheDir, {recursive: true})
|
|
||||||
|
|
||||||
const initScriptsDir = path.resolve(this.gradleUserHome, 'init.d')
|
// Export the GRADLE_ENCRYPTION_KEY variable if provided
|
||||||
fs.mkdirSync(initScriptsDir, {recursive: true})
|
const encryptionKey = params.getCacheEncryptionKey()
|
||||||
|
if (encryptionKey) {
|
||||||
this.initializeGradleUserHome(this.gradleUserHome, initScriptsDir)
|
core.exportVariable('GRADLE_ENCRYPTION_KEY', encryptionKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheOutputExists(): boolean {
|
cacheOutputExists(): boolean {
|
||||||
@@ -161,9 +97,18 @@ export class GradleStateCache {
|
|||||||
async save(listener: CacheListener): Promise<void> {
|
async save(listener: CacheListener): Promise<void> {
|
||||||
const cacheKey = generateCacheKey(this.cacheName).key
|
const cacheKey = generateCacheKey(this.cacheName).key
|
||||||
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY)
|
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY)
|
||||||
|
const gradleHomeEntryListener = listener.entry(this.cacheDescription)
|
||||||
|
|
||||||
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
||||||
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`)
|
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`)
|
||||||
|
|
||||||
|
for (const entryListener of listener.cacheEntries) {
|
||||||
|
if (entryListener === gradleHomeEntryListener) {
|
||||||
|
entryListener.markNotSaved('cache key not changed')
|
||||||
|
} else {
|
||||||
|
entryListener.markNotSaved(`referencing '${this.cacheDescription}' cache entry not saved`)
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +121,7 @@ export class GradleStateCache {
|
|||||||
|
|
||||||
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`)
|
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`)
|
||||||
const cachePath = this.getCachePath()
|
const cachePath = this.getCachePath()
|
||||||
const entryListener = listener.entry(this.cacheDescription)
|
await saveCache(cachePath, cacheKey, gradleHomeEntryListener)
|
||||||
await saveCache(cachePath, cacheKey, entryListener)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -187,7 +131,7 @@ export class GradleStateCache {
|
|||||||
*/
|
*/
|
||||||
async beforeSave(listener: CacheListener): Promise<void> {
|
async beforeSave(listener: CacheListener): Promise<void> {
|
||||||
await this.debugReportGradleUserHomeSize('before saving common artifacts')
|
await this.debugReportGradleUserHomeSize('before saving common artifacts')
|
||||||
this.deleteExcludedPaths()
|
await this.deleteExcludedPaths()
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
new GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
|
new GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
|
||||||
new ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
|
new ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
|
||||||
@@ -200,13 +144,21 @@ export class GradleStateCache {
|
|||||||
/**
|
/**
|
||||||
* Delete any file paths that are excluded by the `gradle-home-cache-excludes` parameter.
|
* Delete any file paths that are excluded by the `gradle-home-cache-excludes` parameter.
|
||||||
*/
|
*/
|
||||||
private deleteExcludedPaths(): void {
|
private async deleteExcludedPaths(): Promise<void> {
|
||||||
const rawPaths: string[] = core.getMultilineInput(EXCLUDE_PATHS_PARAMETER)
|
const rawPaths: string[] = params.getCacheExcludes()
|
||||||
|
rawPaths.push('caches/*/cc-keystore')
|
||||||
const resolvedPaths = rawPaths.map(x => path.resolve(this.gradleUserHome, x))
|
const resolvedPaths = rawPaths.map(x => path.resolve(this.gradleUserHome, x))
|
||||||
|
|
||||||
for (const p of resolvedPaths) {
|
for (const p of resolvedPaths) {
|
||||||
cacheDebug(`Deleting excluded path: ${p}`)
|
cacheDebug(`Removing excluded path: ${p}`)
|
||||||
tryDelete(p)
|
const globber = await glob.create(p, {
|
||||||
|
implicitDescendants: false
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const toDelete of await globber.glob()) {
|
||||||
|
cacheDebug(`Removing excluded file: ${toDelete}`)
|
||||||
|
await tryDelete(toDelete)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +168,7 @@ export class GradleStateCache {
|
|||||||
* but this can be overridden by the `gradle-home-cache-includes` parameter.
|
* but this can be overridden by the `gradle-home-cache-includes` parameter.
|
||||||
*/
|
*/
|
||||||
protected getCachePath(): string[] {
|
protected getCachePath(): string[] {
|
||||||
const rawPaths: string[] = core.getMultilineInput(INCLUDE_PATHS_PARAMETER)
|
const rawPaths: string[] = params.getCacheIncludes()
|
||||||
rawPaths.push(META_FILE_DIR)
|
rawPaths.push(META_FILE_DIR)
|
||||||
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x))
|
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x))
|
||||||
cacheDebug(`Using cache paths: ${resolvedPaths}`)
|
cacheDebug(`Using cache paths: ${resolvedPaths}`)
|
||||||
@@ -231,78 +183,60 @@ export class GradleStateCache {
|
|||||||
return path.resolve(this.gradleUserHome, rawPath)
|
return path.resolve(this.gradleUserHome, rawPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
private initializeGradleUserHome(gradleUserHome: string, initScriptsDir: string): void {
|
private initializeGradleUserHome(): void {
|
||||||
const propertiesFile = path.resolve(gradleUserHome, 'gradle.properties')
|
// Create a directory for storing action metadata
|
||||||
fs.appendFileSync(propertiesFile, 'org.gradle.daemon=false')
|
const actionCacheDir = path.resolve(this.gradleUserHome, '.gradle-build-action')
|
||||||
|
fs.mkdirSync(actionCacheDir, {recursive: true})
|
||||||
|
|
||||||
const buildScanCapture = path.resolve(initScriptsDir, 'build-scan-capture.init.gradle')
|
this.copyInitScripts()
|
||||||
fs.writeFileSync(
|
|
||||||
buildScanCapture,
|
|
||||||
`import org.gradle.util.GradleVersion
|
|
||||||
|
|
||||||
// Only run against root build. Do not run against included builds.
|
// Copy the default toolchain definitions to `~/.m2/toolchains.xml`
|
||||||
def isTopLevelBuild = gradle.getParent() == null
|
this.registerToolchains()
|
||||||
if (isTopLevelBuild) {
|
}
|
||||||
def version = GradleVersion.current().baseVersion
|
|
||||||
def atLeastGradle4 = version >= GradleVersion.version("4.0")
|
|
||||||
def atLeastGradle6 = version >= GradleVersion.version("6.0")
|
|
||||||
|
|
||||||
if (atLeastGradle6) {
|
private copyInitScripts(): void {
|
||||||
settingsEvaluated { settings ->
|
// Copy init scripts from src/resources to Gradle UserHome
|
||||||
if (settings.pluginManager.hasPlugin("com.gradle.enterprise")) {
|
const initScriptsDir = path.resolve(this.gradleUserHome, 'init.d')
|
||||||
registerCallbacks(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject.name)
|
fs.mkdirSync(initScriptsDir, {recursive: true})
|
||||||
}
|
const initScriptFilenames = [
|
||||||
}
|
'gradle-build-action.build-result-capture.init.gradle',
|
||||||
} else if (atLeastGradle4) {
|
'gradle-build-action.build-result-capture-service.plugin.groovy',
|
||||||
projectsEvaluated { gradle ->
|
'gradle-build-action.github-dependency-graph.init.gradle',
|
||||||
if (gradle.rootProject.pluginManager.hasPlugin("com.gradle.build-scan")) {
|
'gradle-build-action.github-dependency-graph-gradle-plugin-apply.groovy',
|
||||||
registerCallbacks(gradle.rootProject.extensions["buildScan"], gradle.rootProject.name)
|
'gradle-build-action.inject-gradle-enterprise.init.gradle'
|
||||||
}
|
]
|
||||||
|
for (const initScriptFilename of initScriptFilenames) {
|
||||||
|
const initScriptContent = this.readResourceFileAsString('init-scripts', initScriptFilename)
|
||||||
|
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
|
||||||
|
fs.writeFileSync(initScriptPath, initScriptContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
private registerToolchains(): void {
|
||||||
buildScanExtension.with {
|
const preInstalledToolchains = this.readResourceFileAsString('toolchains.xml')
|
||||||
def scanFile = new File("gradle-build-scan.txt")
|
const m2dir = path.resolve(this.userHome, '.m2')
|
||||||
def buildFailed = false
|
const toolchainXmlTarget = path.resolve(m2dir, 'toolchains.xml')
|
||||||
|
if (!fs.existsSync(toolchainXmlTarget)) {
|
||||||
|
// Write a new toolchains.xml file if it doesn't exist
|
||||||
|
fs.mkdirSync(m2dir, {recursive: true})
|
||||||
|
fs.writeFileSync(toolchainXmlTarget, preInstalledToolchains)
|
||||||
|
|
||||||
buildFinished { result ->
|
core.info(`Wrote default JDK locations to ${toolchainXmlTarget}`)
|
||||||
buildFailed = (result.failure != null)
|
} else {
|
||||||
}
|
// Merge into an existing toolchains.xml file
|
||||||
|
const existingToolchainContent = fs.readFileSync(toolchainXmlTarget, 'utf8')
|
||||||
|
const appendedContent = preInstalledToolchains.split('<toolchains>').pop()!
|
||||||
|
const mergedContent = existingToolchainContent.replace('</toolchains>', appendedContent)
|
||||||
|
|
||||||
buildScanPublished { buildScan ->
|
fs.writeFileSync(toolchainXmlTarget, mergedContent)
|
||||||
scanFile.text = buildScan.buildScanUri
|
core.info(`Merged default JDK locations into ${toolchainXmlTarget}`)
|
||||||
|
|
||||||
// Send commands directly to GitHub Actions via STDOUT.
|
|
||||||
def gradleCommand = rootProjectName + " " + gradle.startParameter.taskNames.join(" ")
|
|
||||||
if (buildFailed) {
|
|
||||||
println("::warning ::Gradle build '\${gradleCommand}' FAILED - \${buildScan.buildScanUri}")
|
|
||||||
} else {
|
|
||||||
println("::notice ::Gradle build '\${gradleCommand}' - \${buildScan.buildScanUri}")
|
|
||||||
}
|
|
||||||
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
|
||||||
)
|
|
||||||
|
|
||||||
const projectRootCapture = path.resolve(initScriptsDir, 'project-root-capture.init.gradle')
|
private readResourceFileAsString(...paths: string[]): string {
|
||||||
fs.writeFileSync(
|
// Resolving relative to __dirname will allow node to find the resource at runtime
|
||||||
projectRootCapture,
|
const absolutePath = path.resolve(__dirname, '..', '..', 'src', 'resources', ...paths)
|
||||||
`
|
return fs.readFileSync(absolutePath, 'utf8')
|
||||||
// Only run against root build. Do not run against included builds.
|
|
||||||
def isTopLevelBuild = gradle.getParent() == null
|
|
||||||
if (isTopLevelBuild) {
|
|
||||||
settingsEvaluated { settings ->
|
|
||||||
def projectRootEntry = settings.rootDir.absolutePath + "\\n"
|
|
||||||
def projectRootList = new File(settings.gradle.gradleUserHomeDir, "${PROJECT_ROOTS_FILE}")
|
|
||||||
if (!projectRootList.exists() || !projectRootList.text.contains(projectRootEntry)) {
|
|
||||||
projectRootList << projectRootEntry
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import * as core from '@actions/core'
|
||||||
|
import * as exec from '@actions/exec'
|
||||||
|
import * as glob from '@actions/glob'
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
export class CacheCleaner {
|
||||||
|
private readonly gradleUserHome: string
|
||||||
|
private readonly tmpDir: string
|
||||||
|
|
||||||
|
constructor(gradleUserHome: string, tmpDir: string) {
|
||||||
|
this.gradleUserHome = gradleUserHome
|
||||||
|
this.tmpDir = tmpDir
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepare(): Promise<void> {
|
||||||
|
// Reset the file-access journal so that files appear not to have been used recently
|
||||||
|
fs.rmSync(path.resolve(this.gradleUserHome, 'caches/journal-1'), {recursive: true, force: true})
|
||||||
|
fs.mkdirSync(path.resolve(this.gradleUserHome, 'caches/journal-1'), {recursive: true})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.resolve(this.gradleUserHome, 'caches/journal-1/file-access.properties'),
|
||||||
|
'inceptionTimestamp=0'
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set the modification time of all files to the past: this timestamp is used when there is no matching entry in the journal
|
||||||
|
await this.ageAllFiles()
|
||||||
|
|
||||||
|
// Touch all 'gc' files so that cache cleanup won't run immediately.
|
||||||
|
await this.touchAllFiles('gc.properties')
|
||||||
|
}
|
||||||
|
|
||||||
|
async forceCleanup(): Promise<void> {
|
||||||
|
// Age all 'gc' files so that cache cleanup will run immediately.
|
||||||
|
await this.ageAllFiles('gc.properties')
|
||||||
|
|
||||||
|
// Run a dummy Gradle build to trigger cache cleanup
|
||||||
|
const cleanupProjectDir = path.resolve(this.tmpDir, 'dummy-cleanup-project')
|
||||||
|
fs.mkdirSync(cleanupProjectDir, {recursive: true})
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.resolve(cleanupProjectDir, 'settings.gradle'),
|
||||||
|
'rootProject.name = "dummy-cleanup-project"'
|
||||||
|
)
|
||||||
|
fs.writeFileSync(path.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}')
|
||||||
|
|
||||||
|
const gradleCommand = `gradle -g ${this.gradleUserHome} --no-daemon --build-cache --no-scan --quiet -DGITHUB_DEPENDENCY_GRAPH_ENABLED=false noop`
|
||||||
|
await exec.exec(gradleCommand, [], {
|
||||||
|
cwd: cleanupProjectDir
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private async ageAllFiles(fileName = '*'): Promise<void> {
|
||||||
|
core.debug(`Aging all files in Gradle User Home with name ${fileName}`)
|
||||||
|
await this.setUtimes(`${this.gradleUserHome}/**/${fileName}`, new Date(0))
|
||||||
|
}
|
||||||
|
|
||||||
|
private async touchAllFiles(fileName = '*'): Promise<void> {
|
||||||
|
core.debug(`Touching all files in Gradle User Home with name ${fileName}`)
|
||||||
|
await this.setUtimes(`${this.gradleUserHome}/**/${fileName}`, new Date())
|
||||||
|
}
|
||||||
|
|
||||||
|
private async setUtimes(pattern: string, timestamp: Date): Promise<void> {
|
||||||
|
const globber = await glob.create(pattern, {
|
||||||
|
implicitDescendants: false
|
||||||
|
})
|
||||||
|
for await (const file of globber.globGenerator()) {
|
||||||
|
fs.utimesSync(file, timestamp, timestamp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+113
-44
@@ -2,18 +2,14 @@ import path from 'path'
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as glob from '@actions/glob'
|
import * as glob from '@actions/glob'
|
||||||
|
import * as semver from 'semver'
|
||||||
|
|
||||||
import {META_FILE_DIR, PROJECT_ROOTS_FILE} from './cache-base'
|
import * as params from './input-params'
|
||||||
|
|
||||||
|
import {META_FILE_DIR} from './cache-base'
|
||||||
import {CacheEntryListener, CacheListener} from './cache-reporting'
|
import {CacheEntryListener, CacheListener} from './cache-reporting'
|
||||||
import {
|
import {cacheDebug, getCacheKeyPrefix, hashFileNames, restoreCache, saveCache, tryDelete} from './cache-utils'
|
||||||
cacheDebug,
|
import {BuildResult, loadBuildResults} from './build-results'
|
||||||
getCacheKeyPrefix,
|
|
||||||
hashFileNames,
|
|
||||||
isCacheDebuggingEnabled,
|
|
||||||
restoreCache,
|
|
||||||
saveCache,
|
|
||||||
tryDelete
|
|
||||||
} from './cache-utils'
|
|
||||||
|
|
||||||
const SKIP_RESTORE_VAR = 'GRADLE_BUILD_ACTION_SKIP_RESTORE'
|
const SKIP_RESTORE_VAR = 'GRADLE_BUILD_ACTION_SKIP_RESTORE'
|
||||||
|
|
||||||
@@ -51,6 +47,7 @@ class ExtractedCacheEntryDefinition {
|
|||||||
pattern: string
|
pattern: string
|
||||||
bundle: boolean
|
bundle: boolean
|
||||||
uniqueFileNames = true
|
uniqueFileNames = true
|
||||||
|
notCacheableReason: string | undefined
|
||||||
|
|
||||||
constructor(artifactType: string, pattern: string, bundle: boolean) {
|
constructor(artifactType: string, pattern: string, bundle: boolean) {
|
||||||
this.artifactType = artifactType
|
this.artifactType = artifactType
|
||||||
@@ -58,10 +55,24 @@ class ExtractedCacheEntryDefinition {
|
|||||||
this.bundle = bundle
|
this.bundle = bundle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate that the file names matching the cache entry pattern are NOT sufficient to uniquely identify the contents.
|
||||||
|
* If the file names are sufficient, then we use a hash of the file names to identify the entry.
|
||||||
|
* With non-unique-file-names, we hash the file contents to identify the cache entry.
|
||||||
|
*/
|
||||||
withNonUniqueFileNames(): ExtractedCacheEntryDefinition {
|
withNonUniqueFileNames(): ExtractedCacheEntryDefinition {
|
||||||
this.uniqueFileNames = false
|
this.uniqueFileNames = false
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify that the cache entry, should not be saved for some reason, even though the contents exist.
|
||||||
|
* This is used to prevent configuration-cache entries being cached when they were generated by Gradle < 8.6,
|
||||||
|
*/
|
||||||
|
notCacheableBecause(reason: string): ExtractedCacheEntryDefinition {
|
||||||
|
this.notCacheableReason = reason
|
||||||
|
return this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,10 +158,14 @@ abstract class AbstractEntryExtractor {
|
|||||||
const artifactType = cacheEntryDefinition.artifactType
|
const artifactType = cacheEntryDefinition.artifactType
|
||||||
const pattern = cacheEntryDefinition.pattern
|
const pattern = cacheEntryDefinition.pattern
|
||||||
|
|
||||||
|
if (cacheEntryDefinition.notCacheableReason) {
|
||||||
|
listener.entry(pattern).markNotSaved(cacheEntryDefinition.notCacheableReason)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Find all matching files for this cache entry definition
|
// Find all matching files for this cache entry definition
|
||||||
const globber = await glob.create(pattern, {
|
const globber = await glob.create(pattern, {
|
||||||
implicitDescendants: false,
|
implicitDescendants: false
|
||||||
followSymbolicLinks: false
|
|
||||||
})
|
})
|
||||||
const matchingFiles = await globber.glob()
|
const matchingFiles = await globber.glob()
|
||||||
|
|
||||||
@@ -212,6 +227,7 @@ abstract class AbstractEntryExtractor {
|
|||||||
|
|
||||||
if (previouslyRestoredKey === cacheKey) {
|
if (previouslyRestoredKey === cacheKey) {
|
||||||
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
|
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
|
||||||
|
entryListener.markNotSaved('contents unchanged')
|
||||||
} else {
|
} else {
|
||||||
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
|
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
|
||||||
await saveCache([pattern], cacheKey, entryListener)
|
await saveCache([pattern], cacheKey, entryListener)
|
||||||
@@ -245,7 +261,7 @@ abstract class AbstractEntryExtractor {
|
|||||||
|
|
||||||
// Run actions sequentially if debugging is enabled
|
// Run actions sequentially if debugging is enabled
|
||||||
private async awaitForDebugging(p: Promise<ExtractedCacheEntry>): Promise<ExtractedCacheEntry> {
|
private async awaitForDebugging(p: Promise<ExtractedCacheEntry>): Promise<ExtractedCacheEntry> {
|
||||||
if (isCacheDebuggingEnabled()) {
|
if (params.isCacheDebuggingEnabled()) {
|
||||||
await p
|
await p
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
@@ -261,7 +277,7 @@ abstract class AbstractEntryExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const filedata = fs.readFileSync(cacheMetadataFile, 'utf-8')
|
const filedata = fs.readFileSync(cacheMetadataFile, 'utf-8')
|
||||||
cacheDebug(`Loaded cache metadata: ${filedata}`)
|
cacheDebug(`Loaded cache metadata for ${this.extractorName}: ${filedata}`)
|
||||||
const extractedCacheEntryMetadata = JSON.parse(filedata) as ExtractedCacheEntryMetadata
|
const extractedCacheEntryMetadata = JSON.parse(filedata) as ExtractedCacheEntryMetadata
|
||||||
return extractedCacheEntryMetadata.entries
|
return extractedCacheEntryMetadata.entries
|
||||||
}
|
}
|
||||||
@@ -269,12 +285,12 @@ abstract class AbstractEntryExtractor {
|
|||||||
/**
|
/**
|
||||||
* Saves information about the extracted cache entries into the 'cache-metadata.json' file.
|
* Saves information about the extracted cache entries into the 'cache-metadata.json' file.
|
||||||
*/
|
*/
|
||||||
private saveMetadataForCacheResults(results: ExtractedCacheEntry[]): void {
|
protected saveMetadataForCacheResults(results: ExtractedCacheEntry[]): void {
|
||||||
const extractedCacheEntryMetadata = new ExtractedCacheEntryMetadata()
|
const extractedCacheEntryMetadata = new ExtractedCacheEntryMetadata()
|
||||||
extractedCacheEntryMetadata.entries = results.filter(x => x.cacheKey !== undefined)
|
extractedCacheEntryMetadata.entries = results.filter(x => x.cacheKey !== undefined)
|
||||||
|
|
||||||
const filedata = JSON.stringify(extractedCacheEntryMetadata)
|
const filedata = JSON.stringify(extractedCacheEntryMetadata)
|
||||||
cacheDebug(`Saving cache metadata: ${filedata}`)
|
cacheDebug(`Saving cache metadata for ${this.extractorName}: ${filedata}`)
|
||||||
|
|
||||||
fs.writeFileSync(this.getCacheMetadataFile(), filedata, 'utf-8')
|
fs.writeFileSync(this.getCacheMetadataFile(), filedata, 'utf-8')
|
||||||
}
|
}
|
||||||
@@ -306,13 +322,12 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
|||||||
private async deleteWrapperZips(): Promise<void> {
|
private async deleteWrapperZips(): Promise<void> {
|
||||||
const wrapperZips = path.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip')
|
const wrapperZips = path.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip')
|
||||||
const globber = await glob.create(wrapperZips, {
|
const globber = await glob.create(wrapperZips, {
|
||||||
implicitDescendants: false,
|
implicitDescendants: false
|
||||||
followSymbolicLinks: false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
for (const p of await globber.glob()) {
|
for (const wrapperZip of await globber.glob()) {
|
||||||
cacheDebug(`Deleting wrapper zip: ${p}`)
|
cacheDebug(`Deleting wrapper zip: ${wrapperZip}`)
|
||||||
tryDelete(p)
|
await tryDelete(wrapperZip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +353,8 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
||||||
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false), // Entire wrapper directory cached together
|
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false), // Each wrapper directory cached separately
|
||||||
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
entryDefinition('java-toolchains', ['jdks/*/'], false), // Each extracted JDK cached separately
|
||||||
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
||||||
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
||||||
entryDefinition('kotlin-dsl', ['caches/*/kotlin-dsl/*/*'], true)
|
entryDefinition('kotlin-dsl', ['caches/*/kotlin-dsl/*/*'], true)
|
||||||
@@ -357,42 +372,96 @@ export class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
|
|||||||
* entry is not reusable.
|
* entry is not reusable.
|
||||||
*/
|
*/
|
||||||
async restore(listener: CacheListener): Promise<void> {
|
async restore(listener: CacheListener): Promise<void> {
|
||||||
if (listener.fullyRestored) {
|
if (!listener.fullyRestored) {
|
||||||
return super.restore(listener)
|
this.markNotRestored(listener, 'Gradle User Home was not fully restored')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored')
|
if (!params.getCacheEncryptionKey()) {
|
||||||
for (const cacheEntry of this.loadExtractedCacheEntries()) {
|
this.markNotRestored(listener, 'Encryption Key was not provided')
|
||||||
listener.entry(cacheEntry.pattern).markRequested('NOT_RESTORED')
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return await super.restore(listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
private markNotRestored(listener: CacheListener, reason: string): void {
|
||||||
|
const cacheEntries = this.loadExtractedCacheEntries()
|
||||||
|
if (cacheEntries.length > 0) {
|
||||||
|
core.info(`Not restoring configuration-cache state, as ${reason}`)
|
||||||
|
for (const cacheEntry of cacheEntries) {
|
||||||
|
listener.entry(cacheEntry.pattern).markNotRestored(reason)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the results file based on no entries restored
|
||||||
|
this.saveMetadataForCacheResults([])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async extract(listener: CacheListener): Promise<void> {
|
||||||
|
if (!params.getCacheEncryptionKey()) {
|
||||||
|
const cacheEntryDefinitions = this.getExtractedCacheEntryDefinitions()
|
||||||
|
if (cacheEntryDefinitions.length > 0) {
|
||||||
|
core.info('Not saving configuration-cache state, as no encryption key was provided')
|
||||||
|
for (const cacheEntry of cacheEntryDefinitions) {
|
||||||
|
listener.entry(cacheEntry.pattern).markNotSaved('No encryption key provided')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await super.extract(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract cache entries for the configuration cache in each project.
|
* Extract cache entries for the configuration cache in each project.
|
||||||
*/
|
*/
|
||||||
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
||||||
return this.getProjectRoots().map(projectRoot => {
|
// Group BuildResult by existing configCacheDir
|
||||||
const configCachePath = path.resolve(projectRoot, '.gradle/configuration-cache')
|
const groupedResults = this.getConfigCacheDirectoriesWithAssociatedBuildResults()
|
||||||
return new ExtractedCacheEntryDefinition(
|
|
||||||
|
return Object.entries(groupedResults).map(([configCachePath, pathResults]) => {
|
||||||
|
// Create a entry definition for each unique configuration cache directory
|
||||||
|
const definition = new ExtractedCacheEntryDefinition(
|
||||||
'configuration-cache',
|
'configuration-cache',
|
||||||
configCachePath,
|
configCachePath,
|
||||||
true
|
true
|
||||||
).withNonUniqueFileNames()
|
).withNonUniqueFileNames()
|
||||||
|
|
||||||
|
// If any associated build result used Gradle < 8.6, then mark it as not cacheable
|
||||||
|
if (
|
||||||
|
pathResults.find(result => {
|
||||||
|
const gradleVersion = semver.coerce(result.gradleVersion)
|
||||||
|
return gradleVersion && semver.lt(gradleVersion, '8.6.0')
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
core.info(
|
||||||
|
`Not saving config-cache data for ${configCachePath}. Configuration cache data is only saved for Gradle 8.6+`
|
||||||
|
)
|
||||||
|
definition.notCacheableBecause('Configuration cache data only saved for Gradle 8.6+')
|
||||||
|
}
|
||||||
|
return definition
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private getConfigCacheDirectoriesWithAssociatedBuildResults(): Record<string, BuildResult[]> {
|
||||||
* For every Gradle invocation, we record the project root directory. This method returns the entire
|
return loadBuildResults().reduce(
|
||||||
* set of project roots, to allow saving of configuration-cache entries for each.
|
(acc, buildResult) => {
|
||||||
*/
|
// For each build result, find the config-cache dir
|
||||||
private getProjectRoots(): string[] {
|
const configCachePath = path.resolve(buildResult.rootProjectDir, '.gradle/configuration-cache')
|
||||||
const projectList = path.resolve(this.gradleUserHome, PROJECT_ROOTS_FILE)
|
// Ignore case where config-cache dir doesn't exist
|
||||||
if (!fs.existsSync(projectList)) {
|
if (!fs.existsSync(configCachePath)) {
|
||||||
core.info(`Missing project list file ${projectList}`)
|
return acc
|
||||||
return []
|
}
|
||||||
}
|
|
||||||
const projectRoots = fs.readFileSync(projectList, 'utf-8')
|
// Group by unique config cache directories and collect associated build results
|
||||||
core.info(`Found project roots '${projectRoots}' in ${projectList}`)
|
if (!acc[configCachePath]) {
|
||||||
return projectRoots.trim().split('\n')
|
acc[configCachePath] = []
|
||||||
|
}
|
||||||
|
acc[configCachePath].push(buildResult)
|
||||||
|
return acc
|
||||||
|
},
|
||||||
|
{} as Record<string, BuildResult[]>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+108
-26
@@ -1,4 +1,4 @@
|
|||||||
import * as core from '@actions/core'
|
import * as cache from '@actions/cache'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects information on what entries were saved and restored during the action.
|
* Collects information on what entries were saved and restored during the action.
|
||||||
@@ -6,11 +6,23 @@ import * as core from '@actions/core'
|
|||||||
*/
|
*/
|
||||||
export class CacheListener {
|
export class CacheListener {
|
||||||
cacheEntries: CacheEntryListener[] = []
|
cacheEntries: CacheEntryListener[] = []
|
||||||
|
cacheReadOnly = false
|
||||||
|
cacheWriteOnly = false
|
||||||
|
cacheDisabled = false
|
||||||
|
cacheDisabledReason = 'disabled'
|
||||||
|
|
||||||
get fullyRestored(): boolean {
|
get fullyRestored(): boolean {
|
||||||
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored())
|
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get cacheStatus(): string {
|
||||||
|
if (!cache.isFeatureAvailable()) return 'not available'
|
||||||
|
if (this.cacheDisabled) return this.cacheDisabledReason
|
||||||
|
if (this.cacheWriteOnly) return 'write-only'
|
||||||
|
if (this.cacheReadOnly) return 'read-only'
|
||||||
|
return 'enabled'
|
||||||
|
}
|
||||||
|
|
||||||
entry(name: string): CacheEntryListener {
|
entry(name: string): CacheEntryListener {
|
||||||
for (const entry of this.cacheEntries) {
|
for (const entry of this.cacheEntries) {
|
||||||
if (entry.entryName === name) {
|
if (entry.entryName === name) {
|
||||||
@@ -50,9 +62,11 @@ export class CacheEntryListener {
|
|||||||
requestedRestoreKeys: string[] | undefined
|
requestedRestoreKeys: string[] | undefined
|
||||||
restoredKey: string | undefined
|
restoredKey: string | undefined
|
||||||
restoredSize: number | undefined
|
restoredSize: number | undefined
|
||||||
|
notRestored: string | undefined
|
||||||
|
|
||||||
savedKey: string | undefined
|
savedKey: string | undefined
|
||||||
savedSize: number | undefined
|
savedSize: number | undefined
|
||||||
|
notSaved: string | undefined
|
||||||
|
|
||||||
constructor(entryName: string) {
|
constructor(entryName: string) {
|
||||||
this.entryName = entryName
|
this.entryName = entryName
|
||||||
@@ -74,6 +88,11 @@ export class CacheEntryListener {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markNotRestored(message: string): CacheEntryListener {
|
||||||
|
this.notRestored = message
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
markSaved(key: string, size: number | undefined): CacheEntryListener {
|
markSaved(key: string, size: number | undefined): CacheEntryListener {
|
||||||
this.savedKey = key
|
this.savedKey = key
|
||||||
this.savedSize = size
|
this.savedSize = size
|
||||||
@@ -85,54 +104,117 @@ export class CacheEntryListener {
|
|||||||
this.savedSize = 0
|
this.savedSize = 0
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markNotSaved(message: string): CacheEntryListener {
|
||||||
|
this.notSaved = message
|
||||||
|
return this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logCachingReport(listener: CacheListener): void {
|
export function generateCachingReport(listener: CacheListener): string {
|
||||||
if (listener.cacheEntries.length === 0) {
|
const entries = listener.cacheEntries
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
core.info(`---------- Caching Summary -------------
|
return `
|
||||||
Restored Entries Count: ${getCount(listener.cacheEntries, e => e.restoredSize)}
|
<details>
|
||||||
Size: ${getSum(listener.cacheEntries, e => e.restoredSize)}
|
<summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>
|
||||||
Saved Entries Count: ${getCount(listener.cacheEntries, e => e.savedSize)}
|
${renderEntryTable(entries)}
|
||||||
Size: ${getSum(listener.cacheEntries, e => e.savedSize)}`)
|
|
||||||
|
|
||||||
core.startGroup('Cache Entry details')
|
<h5>Cache Entry Details</h5>
|
||||||
for (const entry of listener.cacheEntries) {
|
<pre>
|
||||||
core.info(`Entry: ${entry.entryName}
|
${renderEntryDetails(listener)}
|
||||||
|
</pre>
|
||||||
|
</details>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderEntryTable(entries: CacheEntryListener[]): string {
|
||||||
|
return `
|
||||||
|
<table>
|
||||||
|
<tr><td></td><th>Count</th><th>Total Size (Mb)</th></tr>
|
||||||
|
<tr><td>Entries Restored</td>
|
||||||
|
<td>${getCount(entries, e => e.restoredSize)}</td>
|
||||||
|
<td>${getSize(entries, e => e.restoredSize)}</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>Entries Saved</td>
|
||||||
|
<td>${getCount(entries, e => e.savedSize)}</td>
|
||||||
|
<td>${getSize(entries, e => e.savedSize)}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderEntryDetails(listener: CacheListener): string {
|
||||||
|
return listener.cacheEntries
|
||||||
|
.map(
|
||||||
|
entry => `Entry: ${entry.entryName}
|
||||||
Requested Key : ${entry.requestedKey ?? ''}
|
Requested Key : ${entry.requestedKey ?? ''}
|
||||||
Restored Key : ${entry.restoredKey ?? ''}
|
Restored Key : ${entry.restoredKey ?? ''}
|
||||||
Size: ${formatSize(entry.restoredSize)}
|
Size: ${formatSize(entry.restoredSize)}
|
||||||
|
${getRestoredMessage(entry, listener.cacheWriteOnly)}
|
||||||
Saved Key : ${entry.savedKey ?? ''}
|
Saved Key : ${entry.savedKey ?? ''}
|
||||||
Size: ${formatSize(entry.savedSize)}`)
|
Size: ${formatSize(entry.savedSize)}
|
||||||
|
${getSavedMessage(entry, listener.cacheReadOnly)}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
.join('---\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRestoredMessage(entry: CacheEntryListener, cacheWriteOnly: boolean): string {
|
||||||
|
if (entry.notRestored) {
|
||||||
|
return `(Entry not restored: ${entry.notRestored})`
|
||||||
}
|
}
|
||||||
core.endGroup()
|
if (cacheWriteOnly) {
|
||||||
|
return '(Entry not restored: cache is write-only)'
|
||||||
|
}
|
||||||
|
if (entry.requestedKey === undefined) {
|
||||||
|
return '(Entry not restored: not requested)'
|
||||||
|
}
|
||||||
|
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, cacheReadOnly: boolean): string {
|
||||||
|
if (entry.notSaved) {
|
||||||
|
return `(Entry not saved: ${entry.notSaved})`
|
||||||
|
}
|
||||||
|
if (entry.savedKey === undefined) {
|
||||||
|
if (cacheReadOnly) {
|
||||||
|
return '(Entry not saved: cache is read-only)'
|
||||||
|
}
|
||||||
|
if (entry.notRestored) {
|
||||||
|
return '(Entry not saved: not restored)'
|
||||||
|
}
|
||||||
|
return '(Entry not saved: reason unknown)'
|
||||||
|
}
|
||||||
|
if (entry.savedSize === 0) {
|
||||||
|
return '(Entry not saved: entry with key already exists)'
|
||||||
|
}
|
||||||
|
return '(Entry saved)'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCount(
|
function getCount(
|
||||||
cacheEntries: CacheEntryListener[],
|
cacheEntries: CacheEntryListener[],
|
||||||
predicate: (value: CacheEntryListener) => number | undefined
|
predicate: (value: CacheEntryListener) => number | undefined
|
||||||
): number {
|
): number {
|
||||||
return cacheEntries.filter(e => predicate(e) !== undefined).length
|
return cacheEntries.filter(e => predicate(e)).length
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSum(
|
function getSize(
|
||||||
cacheEntries: CacheEntryListener[],
|
cacheEntries: CacheEntryListener[],
|
||||||
predicate: (value: CacheEntryListener) => number | undefined
|
predicate: (value: CacheEntryListener) => number | undefined
|
||||||
): string {
|
): number {
|
||||||
if (cacheEntries.length === 0) {
|
const bytes = cacheEntries.map(e => predicate(e) ?? 0).reduce((p, v) => p + v, 0)
|
||||||
return '0'
|
return Math.round(bytes / (1024 * 1024))
|
||||||
}
|
|
||||||
return formatSize(cacheEntries.map(e => predicate(e) ?? 0).reduce((p, v) => p + v, 0))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSize(bytes: number | undefined): string {
|
function formatSize(bytes: number | undefined): string {
|
||||||
if (bytes === undefined) {
|
if (bytes === undefined || bytes === 0) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
if (bytes === 0) {
|
|
||||||
return '0 (Entry already exists)'
|
|
||||||
}
|
|
||||||
return `${Math.round(bytes / (1024 * 1024))} MB (${bytes} B)`
|
return `${Math.round(bytes / (1024 * 1024))} MB (${bytes} B)`
|
||||||
}
|
}
|
||||||
|
|||||||
+134
-22
@@ -1,44 +1,137 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as cache from '@actions/cache'
|
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 crypto from 'crypto'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
|
import * as params from './input-params'
|
||||||
|
|
||||||
import {CacheEntryListener} from './cache-reporting'
|
import {CacheEntryListener} from './cache-reporting'
|
||||||
|
|
||||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
const CACHE_PROTOCOL_VERSION = 'v9-'
|
||||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
|
||||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
||||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT'
|
||||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB'
|
||||||
const CACHE_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
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'
|
||||||
|
|
||||||
|
const SEGMENT_DOWNLOAD_TIMEOUT_VAR = 'SEGMENT_DOWNLOAD_TIMEOUT_MINS'
|
||||||
|
const SEGMENT_DOWNLOAD_TIMEOUT_DEFAULT = 10 * 60 * 1000 // 10 minutes
|
||||||
|
|
||||||
export function isCacheDisabled(): boolean {
|
export function isCacheDisabled(): boolean {
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return params.isCacheDisabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheReadOnly(): boolean {
|
export function isCacheReadOnly(): boolean {
|
||||||
return core.getBooleanInput(CACHE_READONLY_PARAMETER)
|
return !isCacheWriteOnly() && params.isCacheReadOnly()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheWriteOnly(): boolean {
|
export function isCacheWriteOnly(): boolean {
|
||||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER)
|
return params.isCacheWriteOnly()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCacheOverwriteExisting(): boolean {
|
||||||
|
return params.isCacheOverwriteExisting()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheDebuggingEnabled(): boolean {
|
export function isCacheDebuggingEnabled(): boolean {
|
||||||
return process.env[CACHE_DEBUG_VAR] ? true : false
|
return params.isCacheDebuggingEnabled()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCacheCleanupEnabled(): boolean {
|
||||||
|
return params.isCacheCleanupEnabled()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 workflow and 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()}`
|
||||||
|
|
||||||
|
// Then prefer caches that run job with the same ID
|
||||||
|
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`
|
||||||
|
|
||||||
|
// Prefer (even more) jobs that run this job in the same workflow with the same context (matrix)
|
||||||
|
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`
|
||||||
|
|
||||||
|
// Exact match on Git SHA
|
||||||
|
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`
|
||||||
|
|
||||||
|
if (params.isCacheStrictMatch()) {
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment])
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCacheKeyPrefix(): string {
|
export function getCacheKeyPrefix(): string {
|
||||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
||||||
return process.env[CACHE_PREFIX_VAR] || ''
|
return process.env[CACHE_KEY_PREFIX_VAR] || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export function determineJobContext(): string {
|
function getCacheKeyEnvironment(): string {
|
||||||
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
const runnerOs = process.env['RUNNER_OS'] || ''
|
||||||
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheKeyJob(): string {
|
||||||
|
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 workflow name and 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.
|
// 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)
|
const workflowName = github.context.workflow
|
||||||
return hashStrings([workflowJobContext])
|
const workflowJobContext = params.getJobMatrix()
|
||||||
|
return hashStrings([workflowName, 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 {
|
export function hashFileNames(fileNames: string[]): string {
|
||||||
@@ -61,12 +154,17 @@ export async function restoreCache(
|
|||||||
): Promise<cache.CacheEntry | undefined> {
|
): Promise<cache.CacheEntry | undefined> {
|
||||||
listener.markRequested(cacheKey, cacheRestoreKeys)
|
listener.markRequested(cacheKey, cacheRestoreKeys)
|
||||||
try {
|
try {
|
||||||
const restoredEntry = await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys)
|
// Only override the read timeout if the SEGMENT_DOWNLOAD_TIMEOUT_MINS env var has NOT been set
|
||||||
|
const cacheRestoreOptions = process.env[SEGMENT_DOWNLOAD_TIMEOUT_VAR]
|
||||||
|
? {}
|
||||||
|
: {segmentTimeoutInMs: SEGMENT_DOWNLOAD_TIMEOUT_DEFAULT}
|
||||||
|
const restoredEntry = await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys, cacheRestoreOptions)
|
||||||
if (restoredEntry !== undefined) {
|
if (restoredEntry !== undefined) {
|
||||||
listener.markRestored(restoredEntry.key, restoredEntry.size)
|
listener.markRestored(restoredEntry.key, restoredEntry.size)
|
||||||
}
|
}
|
||||||
return restoredEntry
|
return restoredEntry
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
listener.markNotRestored((error as Error).message)
|
||||||
handleCacheFailure(error, `Failed to restore ${cacheKey}`)
|
handleCacheFailure(error, `Failed to restore ${cacheKey}`)
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
@@ -79,8 +177,10 @@ export async function saveCache(cachePath: string[], cacheKey: string, listener:
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof cache.ReserveCacheError) {
|
if (error instanceof cache.ReserveCacheError) {
|
||||||
listener.markAlreadyExists(cacheKey)
|
listener.markAlreadyExists(cacheKey)
|
||||||
|
} else {
|
||||||
|
listener.markNotSaved((error as Error).message)
|
||||||
}
|
}
|
||||||
handleCacheFailure(error, `Failed to save cache entry ${cacheKey}`)
|
handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,20 +213,27 @@ export function handleCacheFailure(error: unknown, message: string): void {
|
|||||||
* Attempt to delete a file or directory, waiting to allow locks to be released
|
* Attempt to delete a file or directory, waiting to allow locks to be released
|
||||||
*/
|
*/
|
||||||
export async function tryDelete(file: string): Promise<void> {
|
export async function tryDelete(file: string): Promise<void> {
|
||||||
const stat = fs.lstatSync(file)
|
const maxAttempts = 5
|
||||||
for (let count = 0; count < 3; count++) {
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||||
|
if (!fs.existsSync(file)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
|
const stat = fs.lstatSync(file)
|
||||||
if (stat.isDirectory()) {
|
if (stat.isDirectory()) {
|
||||||
fs.rmdirSync(file, {recursive: true})
|
fs.rmSync(file, {recursive: true})
|
||||||
} else {
|
} else {
|
||||||
fs.unlinkSync(file)
|
fs.unlinkSync(file)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (count === 2) {
|
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
|
throw error
|
||||||
} else {
|
} else {
|
||||||
core.warning(String(error))
|
cacheDebug(`Attempt to delete ${file} failed. Will try again.`)
|
||||||
await delay(1000)
|
await delay(1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,3 +243,8 @@ export async function tryDelete(file: string): Promise<void> {
|
|||||||
async function delay(ms: number): Promise<void> {
|
async function delay(ms: number): Promise<void> {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getJavaProcesses(): Promise<string> {
|
||||||
|
const jpsOutput = await exec.getExecOutput('jps', ['-lm'])
|
||||||
|
return jpsOutput.stdout
|
||||||
|
}
|
||||||
|
|||||||
+57
-39
@@ -1,13 +1,19 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {isCacheDisabled, isCacheReadOnly, isCacheWriteOnly} from './cache-utils'
|
import {
|
||||||
import {logCachingReport, CacheListener} from './cache-reporting'
|
isCacheCleanupEnabled,
|
||||||
|
isCacheDisabled,
|
||||||
|
isCacheReadOnly,
|
||||||
|
isCacheWriteOnly,
|
||||||
|
isCacheOverwriteExisting
|
||||||
|
} from './cache-utils'
|
||||||
|
import {CacheListener} from './cache-reporting'
|
||||||
|
import {DaemonController} from './daemon-controller'
|
||||||
import {GradleStateCache} from './cache-base'
|
import {GradleStateCache} from './cache-base'
|
||||||
|
import {CacheCleaner} from './cache-cleaner'
|
||||||
|
|
||||||
const CACHE_RESTORED_VAR = 'GRADLE_BUILD_ACTION_CACHE_RESTORED'
|
const CACHE_RESTORED_VAR = 'GRADLE_BUILD_ACTION_CACHE_RESTORED'
|
||||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
|
||||||
const CACHE_LISTENER = 'CACHE_LISTENER'
|
|
||||||
|
|
||||||
export async function restore(gradleUserHome: string): Promise<void> {
|
export async function restore(userHome: string, gradleUserHome: string, cacheListener: CacheListener): Promise<void> {
|
||||||
// Bypass restore cache on all but first action step in workflow.
|
// Bypass restore cache on all but first action step in workflow.
|
||||||
if (process.env[CACHE_RESTORED_VAR]) {
|
if (process.env[CACHE_RESTORED_VAR]) {
|
||||||
core.info('Cache only restored on first action step.')
|
core.info('Cache only restored on first action step.')
|
||||||
@@ -15,72 +21,84 @@ export async function restore(gradleUserHome: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
core.exportVariable(CACHE_RESTORED_VAR, true)
|
core.exportVariable(CACHE_RESTORED_VAR, true)
|
||||||
|
|
||||||
const gradleStateCache = new GradleStateCache(gradleUserHome)
|
const gradleStateCache = new GradleStateCache(userHome, gradleUserHome)
|
||||||
|
|
||||||
if (isCacheDisabled()) {
|
if (isCacheDisabled()) {
|
||||||
core.info('Cache is disabled: will not restore state from previous builds.')
|
core.info('Cache is disabled: will not restore state from previous builds.')
|
||||||
// Initialize the Gradle User Home even when caching is disabled.
|
// Initialize the Gradle User Home even when caching is disabled.
|
||||||
gradleStateCache.init()
|
gradleStateCache.init()
|
||||||
|
cacheListener.cacheDisabled = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gradleStateCache.cacheOutputExists()) {
|
if (gradleStateCache.cacheOutputExists()) {
|
||||||
core.info('Gradle User Home already exists: will not restore from cache.')
|
if (!isCacheOverwriteExisting()) {
|
||||||
// Initialize pre-existing Gradle User Home.
|
core.info('Gradle User Home already exists: will not restore from cache.')
|
||||||
gradleStateCache.init()
|
// Initialize pre-existing Gradle User Home.
|
||||||
return
|
gradleStateCache.init()
|
||||||
|
cacheListener.cacheDisabled = true
|
||||||
|
cacheListener.cacheDisabledReason = 'disabled due to pre-existing Gradle User Home'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
core.info('Gradle User Home already exists: will overwrite with cached contents.')
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleStateCache.init()
|
gradleStateCache.init()
|
||||||
// Mark the state as restored so that post-action will perform save.
|
// Mark the state as restored so that post-action will perform save.
|
||||||
core.saveState(CACHE_RESTORED_VAR, true)
|
core.saveState(CACHE_RESTORED_VAR, true)
|
||||||
// Save the Gradle User Home for the post-action step.
|
|
||||||
core.saveState(GRADLE_USER_HOME, gradleUserHome)
|
|
||||||
|
|
||||||
if (isCacheWriteOnly()) {
|
if (isCacheWriteOnly()) {
|
||||||
core.info('Cache is write-only: will not restore from cache.')
|
core.info('Cache is write-only: will not restore from cache.')
|
||||||
|
cacheListener.cacheWriteOnly = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await core.group('Restore Gradle state from cache', async () => {
|
await core.group('Restore Gradle state from cache', async () => {
|
||||||
const cacheListener = new CacheListener()
|
|
||||||
await gradleStateCache.restore(cacheListener)
|
await gradleStateCache.restore(cacheListener)
|
||||||
|
|
||||||
core.saveState(CACHE_LISTENER, cacheListener.stringify())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function save(): Promise<void> {
|
|
||||||
if (!shouldSaveCaches()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const cacheListener: CacheListener = CacheListener.rehydrate(core.getState(CACHE_LISTENER))
|
|
||||||
|
|
||||||
if (isCacheReadOnly()) {
|
|
||||||
core.info('Cache is read-only: will not save state for use in subsequent builds.')
|
|
||||||
logCachingReport(cacheListener)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await core.group('Caching Gradle state', async () => {
|
|
||||||
const gradleUserHome = core.getState(GRADLE_USER_HOME)
|
|
||||||
return new GradleStateCache(gradleUserHome).save(cacheListener)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
logCachingReport(cacheListener)
|
if (isCacheCleanupEnabled() && !isCacheReadOnly()) {
|
||||||
|
core.info('Preparing cache for cleanup.')
|
||||||
|
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
|
||||||
|
await cacheCleaner.prepare()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldSaveCaches(): boolean {
|
export async function save(
|
||||||
|
userHome: string,
|
||||||
|
gradleUserHome: string,
|
||||||
|
cacheListener: CacheListener,
|
||||||
|
daemonController: DaemonController
|
||||||
|
): Promise<void> {
|
||||||
if (isCacheDisabled()) {
|
if (isCacheDisabled()) {
|
||||||
core.info('Cache is disabled: will not save state for later builds.')
|
core.info('Cache is disabled: will not save state for later builds.')
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!core.getState(CACHE_RESTORED_VAR)) {
|
if (!core.getState(CACHE_RESTORED_VAR)) {
|
||||||
core.info('Cache will not be saved: not restored in main action step.')
|
core.info('Cache will not be saved: not restored in main action step.')
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
if (isCacheReadOnly()) {
|
||||||
|
core.info('Cache is read-only: will not save state for use in subsequent builds.')
|
||||||
|
cacheListener.cacheReadOnly = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await daemonController.stopAllDaemons()
|
||||||
|
|
||||||
|
if (isCacheCleanupEnabled()) {
|
||||||
|
core.info('Forcing cache cleanup.')
|
||||||
|
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
|
||||||
|
try {
|
||||||
|
await cacheCleaner.forceCleanup()
|
||||||
|
} catch (e) {
|
||||||
|
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await core.group('Caching Gradle state', async () => {
|
||||||
|
return new GradleStateCache(userHome, gradleUserHome).save(cacheListener)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import * as core from '@actions/core'
|
||||||
|
import * as exec from '@actions/exec'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
import {BuildResult} from './build-results'
|
||||||
|
|
||||||
|
export class DaemonController {
|
||||||
|
private readonly gradleHomes
|
||||||
|
|
||||||
|
constructor(buildResults: BuildResult[]) {
|
||||||
|
const allHomes = buildResults.map(buildResult => buildResult.gradleHomeDir)
|
||||||
|
this.gradleHomes = Array.from(new Set(allHomes))
|
||||||
|
}
|
||||||
|
|
||||||
|
async stopAllDaemons(): Promise<void> {
|
||||||
|
core.info('Stopping all Gradle daemons before saving Gradle User Home state')
|
||||||
|
|
||||||
|
const executions: Promise<number>[] = []
|
||||||
|
const args = ['--stop']
|
||||||
|
|
||||||
|
for (const gradleHome of this.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 for ${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