Commit Graph
100 Commits
Author SHA1 Message Date
Daz DeBoer ddee3ca933 Update all outdated dependencies 2021-12-02 14:35:52 -07:00
Daz DeBoer 03d1894080 Update to build with NPM 8.1 2021-12-02 12:59:54 -07:00
Daz DeBoerandGitHub 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 DeBoerandGitHub 92a1f98d35 Merge pull request #123 from gradle/toward-setup-gradle
Avoid using command-line modification to enhance build execution. Instead, files are written to Gradle User Home to achieve the same functionality.
2021-11-28 08:22:36 -07:00
Daz DeBoer fdfc5bf12f Build outputs 2021-11-28 08:04:54 -07:00
Daz DeBoer a25c0ce6cb Improve title on build scan notice 2021-11-28 08:04:54 -07:00
Daz DeBoer 76f85a724c Record build scan url directly from init script
Instead of writing the URL to a file on disk, reading it later and
using the Actions API to record the output parameter and write the notice,
these things are now done directly via Actions commands emitted directly
from the init script.
2021-11-27 20:49:10 -07:00
Daz DeBoer 45ef022607 Always initialize Gradle User Home with init script
The generated gradle.properties file and init script are not cached,
so need to be generated even when restoring from cache.
2021-11-27 20:45:49 -07:00
Daz DeBoer a72af0b6a6 Persist build-scan-capture init script into Gradle User Home
Instead of writing this file to a temp directory and referencing it
on the Gradle command line, the init script is now written to Gradle
User Home so that it is picked up automatically.
2021-11-27 20:44:43 -07:00
Daz DeBoer b0c29bffb7 Use a properties file to disable daemon execution
Instead of passing `--no-daemon` on the command line, the same
functionality is now acheived by writing a gradle.properties file
when initializing Gradle User Home.
2021-11-27 16:07:07 -07:00
Daz DeBoer 996094e8e8 Avoid failing job on any failure in post-action
Failures to store cache entries should not fail the action or the Job.
This fix attempts to catch and log any unexpected errors that occur when
saving cache entries.

Fixes: #119
Fixes: #120
2021-11-15 09:31:56 -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 DeBoerandGitHub c12283ec57 Add a section explaining advantages 2021-11-01 12:35:15 -06:00
Daz DeBoerandGitHub f2dc0d8256 Add section on optimizing cache effectiveness 2021-11-01 08:17:33 -06:00
Daz DeBoer 717db318c1 Fix logging of cache key for Gradle User Home 2021-10-31 20:49:29 -06:00
Daz DeBoerandGitHub 2a57ddf74a Merge pull request #111 from gradle/dd/cache-report
Add a report to assist with diagnosing and optimizing cache performance
2021-10-30 21:53:01 +02:00
Daz DeBoer 230fd6b47f Build outputs 2021-10-30 13:46:29 -06:00
Daz DeBoer 472ac8a356 Report sizes of cache entries
Using the patched version of @actions/cache, we now report the total
size of cache entries restored/saved, as well as details of each one.
2021-10-30 13:45:39 -06:00
Daz DeBoer 3ba05ede1f Add patch for @actions/cache to expose entry size
There's no easy way to get the size of restored/saved cache entries
using the @actions/cache library. Rather than reimplement it, this commit
adds a patch that will be applied whenever 'npm install' is run.

The work is done by 'patch-package'.
2021-10-30 13:44:24 -06:00
Daz DeBoer d785346c8c Use cache.description 2021-10-30 13:44:22 -06:00
Daz DeBoer 6ca4d4ade2 Improve formatting for caching report 2021-10-30 12:15:00 -06:00
Daz DeBoer 75cec40e58 Rename 'report' classes to 'listener'
- `CachingReport` -> `CacheListener`
- `CacheEntryReport` -> `CacheEntryListener`
2021-10-30 12:15:00 -06:00
Daz DeBoer c317ccac62 Refactor: extract cache-base out of cache-utils 2021-10-30 12:15:00 -06:00
Daz DeBoer a74bb0fad6 Monitor cache saves and add basic caching report
- Restore `CachingReport` instance in 'post' action
- Record keys for any entries saved
- Report caching activity as JSON in post action
2021-10-30 12:14:59 -06:00
Daz DeBoer 6ff2065a12 Upgrade Jest to address security warning 2021-10-30 12:11:59 -06:00
Daz DeBoer 727b4612ba Fix early return from bundle processing 2021-10-30 12:11:59 -06:00
Daz DeBoerandGitHub 613f4ec588 Merge pull request #109 from gradle/dd/rc21
Fix issues for 2.0-rc.2
- Support multi-line strings for cache-tuning parameters #106 
- Include all downloaded files in `dependencies` bundle #100 
- Only restore configuration-cache if Gradle User Home is fully restored #107
2021-10-30 14:39:28 +02:00
Daz DeBoer db6202adcd Build outputs 2021-10-30 06:29:25 -06:00
Daz DeBoer f0f68e07c3 Better handling of .cache files that are not restored
- Remove any .cache file that is not restored
- Report on any .cache file that exists but has no config
2021-10-30 06:28:20 -06:00
Daz DeBoer 8ba5a0033b Track 'fully-restored' by tracking each cache restore
Instead of tracking a single 'fully-restored' flag, track the restore status of each
cache entry restore. If any of these are requested but not restored, then the overall
Gradle User Home cache is not fully restored.

Added special handling for the case when zero artifact bundles are set: this is used
in tests to simulate a not-fully-restored state.
2021-10-30 06:05:21 -06:00
Daz DeBoer 9edc2a11bd Only restore configuration-cache if Gradle Home is fully restored
Fixes #107
2021-10-29 09:34:36 -06:00
Daz DeBoer 079e4844d6 Split tests for caching
- Separate testing of Gradle Home caching from configuration-cache caching
- Add test for configuration-cache when Gradle Home is not fully restored
2021-10-29 09:34:35 -06:00
Daz DeBoer 4ebd000afd Bundle all downloaded dependency files
Previously, only .jar files were bundled, with other files (modules, POMs, zips, etc)
being left in Gradle User Home. All downloaded files are now included in the bundle.

Fixes #100
2021-10-29 08:03:03 -06:00
Daz DeBoer 063fc6a872 Allow source files to contain lines up to 120 characters
This avoids excessive line-feeds when reformatting code to 80 char lines.
2021-10-29 07:50:06 -06:00
Daz DeBoer e3ada7e5c2 Use multiline input parameters instead of JSON input
The `gradle-home-cache-includes` and `gradle-home-cache-excludes` parameters were initially implemented
as JSON string inputs. This makes these inputs non-idiomatic and easier to get wrong.

This change converts them to multi-line input parameters.

Fixes #106
2021-10-29 07:29:57 -06:00
Daz DeBoer d61e5be06a Remove note about Beta release from README 2021-10-27 16:27:21 -06:00
Daz DeBoerandGitHub db2b34260f Merge pull request #101 from gradle/dd/rename-parameters
Rename and document parameters for clarity 

- cache-paths -> gradle-home-cache-includes
- cache-exclude-paths -> gradle-home-cache-excludes
- CACHE_DEBUG_ENABLED -> GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED
2021-10-28 00:18:36 +02:00
Daz DeBoer c031dc946b Build outputs 2021-10-27 16:09:53 -06:00
Daz DeBoer 0eb881f067 Adapt workflows to renamed parameters 2021-10-27 16:07:24 -06:00
Daz DeBoer 27f2dc276c Rename and document parameters for clarity
- cache-paths -> gradle-home-cache-includes
- cache-exclude-paths -> gradle-home-cache-excludes
- CACHE_DEBUG_ENABLED -> GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED
2021-10-27 16:05:07 -06:00
Daz DeBoer cba1833dde Run test builds on Ubuntu and Windows
- Remove MacOS since the agents are current flaky
- Add Windows to a few more test pipelines
2021-10-21 12:08:17 -06:00
Daz DeBoer 39db90e99b Include build scan link in failure notice 2021-10-21 12:04:25 -06:00
Daz DeBoerandGitHub 947a893558 Merge pull request #97 from gradle/dd/configurable-cache
Add some internal options for fine-tuning the gradle-build-action cache

- Can specify cache-paths to override the default directories cached from Gradle User Home
- Can specify cache-exclude-paths to exclude files from the Gradle User Home cache
- Files under caches/<gradle-version>/kotlin-dsl are now cached as a bundle
2021-10-21 19:26:19 +02:00
Daz DeBoer b99e9f0bc3 Build outputs 2021-10-21 11:13:10 -06:00
Daz DeBoer 4cf255df10 Move bundle metadata files out of caches directory
Instead, use a separate '.gradle-build-action' directory for bundle
metadata files. This directory is always part of the cache-path.
2021-10-21 11:13:09 -06:00
Daz DeBoer 614d8770a4 Add test for cache configuration 2021-10-21 11:13:09 -06:00
Daz DeBoer 69453dbfc5 Include 'kotlin-dsl' as a cache-artifact-bundle 2021-10-21 11:13:09 -06:00
Daz DeBoer 1113cb87cb Allow cache-exclude-paths to be configured for action
All excluded paths are deleted prior to caching the Gradle User Home.
2021-10-21 11:13:09 -06:00
Daz DeBoer 9c95294209 Allow cache-paths to be set via action config 2021-10-21 11:13:08 -06:00
Daz DeBoer f901ec9c20 Bump cache-protocol version 2021-10-20 15:04:14 -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 cb6a0acca4 Use precise matching for artifact bundles
This should fix the warnings issued when saving artifact bundles.
2021-10-16 09:49:15 -06:00
Daz DeBoer aa2ed2e033 Use cache protocol version for bundle keys too 2021-10-16 09:49:14 -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 DeBoerandGitHub 0eb5996567 Merge pull request #93 from gradle/dd/instrumented-jars-fix
Ensure all-or-nothing restore of cached instrumented-jars

Leaving the .lock and .receipt files lying around was causing issues when the actual jar files were not restored. Now the entire directory will either be missing, or completely restored.

Fixes #91
2021-10-15 23:04:47 +02:00
Daz DeBoer fe55bf4667 Build outputs 2021-10-15 14:56:44 -06:00
Daz DeBoer 709ded51a5 Treat directory for instrumented jar as single artifact
Leaving the `.lock` and `.receipt` files lying around was causing
issues when the actual jar files were not restored. Now the entire
directory will either be missing, or completely restored.
2021-10-15 14:54:29 -06:00
Daz DeBoer 8b1f1a3817 Add test for execution when no bundles are restored 2021-10-15 13:29:09 -06:00
Daz DeBoer 7abf13ee48 Build outputs 2021-10-15 13:21:26 -06:00
Daz DeBoer da64595ccc Make artifact bundle definitions an input parameter 2021-10-15 13:21:13 -06:00
Daz DeBoer 29b14c7fca Refactor: rename methods for 'bundle' concept 2021-10-15 12:34:38 -06:00
Daz DeBoer d1ab42cddf Document support for multi-line arguments
Fixes #88
2021-10-15 12:24:41 -06:00
Daz DeBoer 422726cec5 Add test for multi-line input arguments 2021-10-15 12:20:01 -06:00
Daz DeBoerandGitHub 4bc52c85c3 Merge pull request #92 from gradle/dd/cache-debug-logging
Improve cache logging and behaviour
2021-10-15 20:17:35 +02:00
Daz DeBoer e7b5fd0b28 Build outputs 2021-10-15 11:46:51 -06:00
Daz DeBoer 53ccc3e0d7 Add more cache debug logging 2021-10-15 11:45:15 -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 DeBoerandGitHub 0cf00ed767 Fix test for release-candidate
Since this is an ever-changing version, this fix removes the `gradleVersionCheck` from the invocation.
2021-10-14 10:48:44 -06:00
Daz DeBoerandGitHub aedc5fc8f9 Mention that CACHE_DEBUG_ENABLED will disable parallel save/restore 2021-10-14 10:41:45 -06:00
Daz DeBoerandGitHub 78e25cd233 Document the CACHE_DEBUG_ENABLED flag 2021-10-14 10:39:12 -06:00
Daz DeBoerandGitHub 29894757f3 Merge pull request #90 from gradle/dd/windows-locks
Allow time for processes to delete file locks on windows
2021-10-05 01:30:13 +02:00
Daz DeBoer 5328161026 Build outputs 2021-10-04 23:59:42 +02:00
Daz DeBoer 4968d2280b Allow time for processes to release file locks on windows 2021-10-04 23:59:08 +02:00
Daz DeBoerandGitHub c000a0b58f Merge pull request #87 from gradle/dd/gradle-versions
Fix build-scan link detection with older build-scan plugins

Fixes #86
2021-09-29 15:15:24 -06:00
Daz DeBoer 6ff498182a Add checks for build scan links 2021-09-29 15:10:39 -06: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 9b7c81f8f6 Test execution with older Gradle versions 2021-09-29 13:34:05 -06:00
Daz DeBoer b650771559 Cleanup samples 2021-09-29 13:23:25 -06:00
Daz DeBoer 17f624cb5b Rename 'basic' sample to 'groovy-dsl' 2021-09-28 20:31:11 -06:00
Daz DeBoerandGitHub 21dee71590 Update README for v2 2021-09-28 11:30:55 -06:00
Daz DeBoerandGitHub 83e2129213 Merge pull request #84 from gradle/dependabot/npm_and_yarn/ansi-regex-5.0.1
Bump ansi-regex from 5.0.0 to 5.0.1
2021-09-28 08:45:48 -06:00
Daz DeBoerandGitHub b16787d530 Merge pull request #80 from gradle/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2021-09-28 08:45:34 -06:00
Daz DeBoerandGitHub 204870af89 Merge pull request #85 from gradle/dd/init-script
Use an init-script to capture buildScanPublished event
2021-09-28 00:08:42 -06:00
Daz DeBoer 0918f5f2a4 Rename source file for clarity 2021-09-28 00:04:50 -06:00
Daz DeBoer 1b1a3c48ad Publish scans from no-wrapper sample build
This allows more testing of build scan capture functionality
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 DeBoerandGitHub 5576baa56b Merge pull request #83 from gradle/dd/v2
Adapt paths to differing Gradle User Home
2021-09-27 22:08:40 -06:00
Daz DeBoer 1026c62889 Only run failure-cases workflow on manual trigger 2021-09-27 22:05:23 -06:00
Daz DeBoer 1fb8644035 Build outputs 2021-09-27 21:53:19 -06:00
Daz DeBoer 5a5a5b4387 Normalize paths to Gradle User Home when calculating cache keys
Fixes #77
2021-09-27 21:52:03 -06:00
Daz DeBoer cc5cdb7fe0 Adapt caching for GRADLE_USER_HOME env var
Fixes #74
2021-09-27 21:50:14 -06:00
Daz DeBoer e0d37eb073 Workflow to test with custom GRADLE_USER_HOME 2021-09-27 19:48:26 -06:00
Daz DeBoer bdd89aa34f Refactored workflows
- Improve workflow names
- Split execution testing from cache testing
2021-09-27 19:33:22 -06:00
Daz DeBoerandGitHub 656ad4b5f2 Move continue-on-error into the step definition
Hopefully this will allow GitHub to ignore the failure.
2021-09-15 17:57:43 -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 dbb485d80d Only perform post-restore and pre-save cache actions when required 2021-09-15 17:45:47 -06:00
Daz DeBoer 9bfa003014 Build outputs 2021-09-14 18:11:31 -06:00