Commit graph

188 commits

Author SHA1 Message Date
Daz DeBoer
222b714890
Build outputs 2022-01-17 14:44:32 -07:00
Daz DeBoer
42faf281e6
Include names of requested tasks in build scan notice
This should make it easier to differentiate between build scan notices for different
Gradle invocations in the same Job.

Fixes: #124
2021-12-31 10:34:53 -07:00
Daz DeBoer
13d93c1ca1
Check executable bit on Gradle script
Fixes #76
2021-12-30 21:40:27 -07:00
Daz DeBoer
39e51526fb
Build outputs 2021-12-30 16:03:02 -07:00
Daz DeBoer
d50632cfd1
Build outputs 2021-12-17 10:29:59 -07:00
Daz DeBoer
3814d56740
Build outputs 2021-12-08 15:14:19 -07:00
Daz DeBoer
887e1a09ab
Include original error in log messages 2021-12-08 14:44:57 -07:00
Daz DeBoer
574cf0ddce Build outputs 2021-12-08 14:05:13 -07:00
Daz DeBoer
b88c4086b9
Don't overwrite title in build-scan notice 2021-12-08 13:07:52 -07:00
Daz DeBoer
ddee3ca933
Update all outdated dependencies 2021-12-02 14:35:52 -07:00
Daz DeBoer
322805e800
Refactor: use a single .json file to describe all cached artifact bundles (#121)
This is a pure refactor, moving from a separate .cache file per bundle to a single cache-metadata.json file describing all bundles. Instead of storing cache metadata in a separate .cache file per artifact bundle, all of the metadata is now stored in a single `.json` file.

This will make it easier to implement more flexible artifact-caching strategies, such as caching each wrapper zip separately.

* Always include cache protocol version in cache key
* Store all cache metadata in a single JSON file
* Rename cache-metadata file and bump protocol version
* Polish and documentation
2021-11-28 10:19:56 -07:00
Daz DeBoer
fdfc5bf12f
Build outputs 2021-11-28 08:04:54 -07:00
Daz DeBoer
4137be6a8b
Minor improvement to logging in post-action
- Ensure that "Caching Gradle state" group always has 1 message
- Only print cache report when entries were restored or saved
2021-11-05 08:35:45 -06:00
Daz DeBoer
4e899835b3
Avoid failing build on distributions cache errors
- Warn and continue on failure to restore a Gradle distribution from cache
- Warn and continue on failure to save a Gradle distribution to cache
- Extract common functionality for consistent handling of cache failures

Fixes #116
2021-11-05 07:01:48 -06:00
Daz DeBoer
717db318c1
Fix logging of cache key for Gradle User Home 2021-10-31 20:49:29 -06:00
Daz DeBoer
230fd6b47f
Build outputs 2021-10-30 13:46:29 -06:00
Daz DeBoer
727b4612ba
Fix early return from bundle processing 2021-10-30 12:11:59 -06:00
Daz DeBoer
db6202adcd
Build outputs 2021-10-30 06:29:25 -06:00
Daz DeBoer
c031dc946b
Build outputs 2021-10-27 16:09:53 -06:00
Daz DeBoer
39db90e99b
Include build scan link in failure notice 2021-10-21 12:04:25 -06:00
Daz DeBoer
b99e9f0bc3
Build outputs 2021-10-21 11:13:10 -06:00
Daz DeBoer
a94b9252d5
Improve cache logging 2021-10-16 10:15:40 -06:00
Daz DeBoer
25672bf196
Build outputs 2021-10-16 09:50:40 -06:00
Daz DeBoer
263f84178a
Prefix cache key with protocol version
This will ensure that incompatiblee cache entries generated by previous action releases
will not be used.
2021-10-16 08:33:42 -06:00
Daz DeBoer
fe55bf4667
Build outputs 2021-10-15 14:56:44 -06:00
Daz DeBoer
7abf13ee48
Build outputs 2021-10-15 13:21:26 -06:00
Daz DeBoer
e7b5fd0b28
Build outputs 2021-10-15 11:46:51 -06:00
Daz DeBoer
8ab7c9d8dd
Do not fail action on cache errors
Ensure that we catch and log errors in `beforeSave` and `afterRestore`,
and do not fail the entire workflow in these cases.
2021-10-14 12:19:24 -06:00
Daz DeBoer
5328161026
Build outputs 2021-10-04 23:59:42 +02:00
Daz DeBoer
60b1ffac6b
Fix build-scan-init script to work with build-in build-scan plugins 2021-09-29 14:39:48 -06:00
Daz DeBoer
0918f5f2a4
Rename source file for clarity 2021-09-28 00:04:50 -06:00
Daz DeBoer
a7174b82a2
Use init script to capture build scan URL
Instead of parsing the log output, we instead register a
buildScanPublished listener and record the build scan URL
to a file. This file is subsequently read to report the
build scan URL.

Fixes #30
2021-09-28 00:04:41 -06:00
Daz DeBoer
1fb8644035
Build outputs 2021-09-27 21:53:19 -06:00
Daz DeBoer
bebb162342
Usability improvements:
- Include bundle name in cache key
- Emit a few more messages at 'info'
2021-09-15 17:50:53 -06:00
Daz DeBoer
6084a4eb65
Cache artifacts with single entry per type
When caching is too fine-grained, an excessive number of cache
requests can result in HTTP 429 errors due to rate limiting.
By caching all artifacts of a particular type in a single entry
we hope to mitigate this, at the expense of some reduction in
cache space optimization.

This change also adds caching for all dependency jars, as well as
instrumented jars in the 'caches/jars-X' directory.
2021-09-15 17:45:47 -06:00
Daz DeBoer
9bfa003014
Build outputs 2021-09-14 18:11:31 -06:00
Daz DeBoer
d06e19f862
Build outputs 2021-09-13 11:50:07 -06:00
Daz DeBoer
cae99bf6d9
Tidy up cache entry de-duplication
- Rename feature to "common artifact caching"
- Cleanup logging
- Refactor/rename for clarity
2021-09-12 10:31:52 -06:00
Daz DeBoer
5a90152b1f
Restore/cache deduplicated files in parallel 2021-09-12 10:31:52 -06:00
Daz DeBoer
4b92b8d013
Cache downloaded dependency jars separately
This will further remove common files out the the Gradle User Home
cache entries, reducing cache usage by removing redundancy.
2021-09-12 10:31:51 -06:00
Daz DeBoer
693293c29a
Consolidate logic for separate artifact file caching
Making this functionality more general will make it easier to add other
artifacts to the set that we cache separately.
2021-09-12 10:31:51 -06:00
Daz DeBoer
ac5d8920dd
Cache generated-gradle-jars separately from Gradle User Home
Similar to wrapper distributions, these large files are common
to many Gradle User Home cache entries. Storing them separately removes
this redundancy from the Gradle User Home cache.
2021-09-12 10:31:51 -06:00
Daz DeBoer
e833360307
Cache downloaded wrapper dists separately
In the current model, each cached Gradle User Home could contain
a copy of one or more downloaded wrapper distributions. This results
in large cache entries which could easily lead to premature eviction.

With this change, wrapper dists are cached separately from the rest
of the Gradle User Home directory. The artifact file is replaced by
a marker file which allows the action to restore the artifact from
cache when the Gradle user Home cache is restored.
2021-09-12 10:31:51 -06:00
Daz DeBoer
4032438d2b
Build outputs 2021-09-07 16:26:37 -06:00
Daz DeBoer
c79d4172e0
Build outputs 2021-08-27 12:53:01 -06:00
Daz DeBoer
b3afdc78a7
Truncate Gradle args when constructing cache key (#71)
Cache keys have a hard limit of 512 characters, so we need to ensure that we don't generate a key longer than this.

- Remove excess whitespace
- Truncate to 400 characters

Fixes #70
2021-08-24 12:46:48 -06:00
Daz DeBoer
e0c2736e35
Include Gradle invocation arguments in cache keys (#69)
This permits a new cache entry to be persisted when a subsequent Gradle invocation does more work that an earlier invocation.

Fixes #68
2021-08-22 17:11:05 -06:00
Daz DeBoer
a63892c289
Log cache entry on save 2021-08-22 14:58:36 -06:00
Daz DeBoer
7336529ec5
Build distribution 2021-08-07 16:13:35 -07:00
Daz DeBoer
bc4d6bddd4
Rebuild index files 2021-07-26 15:45:00 -06:00
Daz DeBoer
33e91b639d
Cache Gradle distributions downloaded for a particular version (#58)
- Cache is separate from (but similar to) the wrapper distribution cache
- New 'distributions-cache-enabled' flag controls caching of all downloaded distributions
  (including wrapper distributions)
- Deprecated the 'wrapper-cache-enabled' flag for removal in v2
2021-07-08 12:22:48 -06:00
Daz DeBoer
e4ec586f46 Only cache the wrapper ZIP, not the exploded dir
Prior to this change, the wrapper cache contained both the downloaded zip
file as well as the exploded wrapper dir. Only the zip file is required,
as Gradle will automatically detect and unpack.
2021-07-08 08:01:44 -06:00
Daz DeBoer
15a8123fbc Validate presense of gradle wrapper to provide better feedback
- Provide a more useful error message when no Gradle wrapper can be located,
  and 'gradle-version' or 'gradle-executable' is not used.
- Add test for case where wrapper is missing.
  This isn't really a "test" per-se, but this failing build invocation makes it
  easy to verify the GitHub action behaviour when the build is misconfigured.
2021-07-08 08:01:44 -06:00
Daz DeBoer
18c8a679dc Look for gradle wrapper in build-root-directory by default
This removes the need to specify `wrapper-directory` when using a Gradle
project that is not located in the root of the workspace.

Fixes #44.
2021-07-06 09:56:27 -06:00
Daz DeBoer
738bda9866
Use built-in library functions in preference to custom implementations
- Use built-in `hashFiles` function included in '@actions/globv0.2.0'
- Use `downloadTool` and `extractZip` functions from '@actions/tool-cache'
2021-07-05 13:57:22 -06:00
Daz DeBoer
47c9af9d7d
Rebuild outputs 2021-07-05 12:40:53 -06:00
paul
6bf2690b23 Upgrade dependencies 2020-12-22 12:11:50 +01:00
Paul Merlin
2efcc22ff5 Replace typed-rest-client with @actions/http-client 2020-09-13 14:17:37 +02:00
Paul Merlin
cb2742a00b Protect RC provisioning from network problems and add logging 2020-09-13 13:30:54 +02:00
Paul Merlin
863daedf86 Bump test build wrapper 2020-09-13 13:23:48 +02:00
Paul Merlin
e3d60b3873 Protect wrapper cache restore against tar errors 2020-09-13 13:06:00 +02:00
Paul Merlin
2dd6cc1801 Upgrade dependencies 2020-09-13 12:37:40 +02:00
Paul Merlin
f11e7d60d7 Short-circuit dependencies and configuration caching if cache dir already exists
This is relevant if you run this action several times in a single job.
This prevent doing unnecessary work starting with the second job using the action.
This prevent droping dependencies downloaded by the first job using the action.
This prevent Windows agents to fail unlinking already existing files.
2020-06-22 16:40:58 +02:00
Paul Merlin
7137b09ae2 Upgrade dependencies 2020-06-22 16:36:25 +02:00
Paul Merlin
466a737d16 Only restore wrapper cache if dir doesn't exist 2020-06-15 19:33:04 +02:00
Paul Merlin
4c7d97cca4 Add caching of Gradle build configuration cache 2020-06-15 15:58:20 +02:00
Paul Merlin
ae50675399 Better warning message 2020-06-15 15:43:21 +02:00
Paul Merlin
d7a54a26c7 Don't drop gc.properties in dependencies cache
because it would disable Gradle cache cleanup
2020-06-15 15:41:53 +02:00
Paul Merlin
02a8a21e55 Add input to disable wrapper caching 2020-06-15 15:41:09 +02:00
Paul Merlin
3abad5567a Add input to disable dependencies caching altogether 2020-06-15 14:32:54 +02:00
Paul Merlin
355e9c1f86 Try delete dependencies lock files and disable caching if not possible 2020-06-15 14:22:41 +02:00
Paul Merlin
26dd4cb9bb Make file hashing more robust 2020-06-15 14:09:44 +02:00
Paul Merlin
317ca35dca Refine dependencies caching 2020-06-15 13:16:51 +02:00
Paul Merlin
053762c1c1 Add input to make the dependencies caching strict 2020-06-15 13:05:36 +02:00
Paul Merlin
95e20daa83 Automatic caching of dependencies
in a best effort manner by default
allowing to specify files to hash for computing the cache key
2020-06-15 13:04:42 +02:00
Paul Merlin
692fda9de7 Cache wrapper install when gradle-executable points to a wrapper 2020-06-14 18:01:54 +02:00
Paul Merlin
c839ac993c Locate user home in an OS agnostic way 2020-06-14 12:28:17 +02:00
Paul Merlin
1c1db193aa Cache wrapper installation 2020-06-13 16:15:53 +02:00
Paul Merlin
9675f09de6 Compute wrapper cache key 2020-06-13 15:51:58 +02:00
Paul Merlin
392bcac1c1 Fix state 2020-06-13 15:03:30 +02:00
Paul Merlin
a2ba1beedb Debugging 2020-06-13 15:01:08 +02:00
Paul Merlin
42e2fed267 Cache wrapper dist, step 1 2020-06-13 14:48:54 +02:00
Paul Merlin
8e2fd532f1 Fix dist download 2020-06-13 14:37:12 +02:00
Paul Merlin
4a9a0a05a3 Lint 3 2020-06-13 14:30:57 +02:00
Paul Merlin
1647b85e82 Lint 2 2020-06-13 14:21:54 +02:00
Paul Merlin
6cee865aea Lint 2020-06-13 13:58:25 +02:00
Paul Merlin
e0644c97f9 Split action, step 2 2020-06-13 13:34:07 +02:00
Paul Merlin
9cc76cdea7 Split action, step 1 2020-06-13 13:30:20 +02:00