Commit graph

75 commits

Author SHA1 Message Date
daz
60c43cb563
Make it easy to publish to scans.gradle.com
- Allow init-script to publish to scans.gradle.com
- Add paramaters to enable build scan publishing
- Test coverage for build scan publishing
2024-01-25 08:56:13 -07:00
daz
49ade81b5d
Add a new option to clear the dependency-graph
When changing workflow names or when changing to the new 'dependency-submission'
action, it can be useful to clear existing dependency graph snapshots from previous
submissions. While the old graphs will eventually "age out", the 'clear' option will
submit an empty dependency graph for an existing Job correlator, ensuring that old
dependency graphs don't linger.
2024-01-23 16:19:25 -07:00
daz
a01f794d92
Add dependency-graph-continue-on-failure input param
- Translate to env var for init-script support
- Use when deciding whether to log or rethrow errors
- Add a custom error type to trigger failure in post action
2024-01-13 07:20:45 -07:00
daz
3a75647ad4
Remove 'gradle-executable' input param 2024-01-04 13:53:16 -07:00
daz
333078158e
Allow job-summary only on failure
Instead of a binary true/false option, it is now possible to only add
a Job Summary when the build failed. This applies both to the overall
Job Summary added to the workflow run, and to the new PR comment feature.
2024-01-01 17:50:40 -07:00
daz
34a07dced0
Automatically add Job Summary as PR comment
Rather than requiring a separate step to add a PR comment,
the `gradle-build-action` can now automatically add the Job Summary
as a PR comment

Fixes #1020
2024-01-01 17:50:15 -07:00
daz
a4dabb3a70
Adapt dependency-graph support for new artifact API
- Don't upload artifacts when using 'generate-and-submit'
- New option 'generate-and-upload' to be used with 'download-and-submit'
- Use Artifact API for downloading in the same and different workflow
2023-12-23 21:24:11 -07:00
daz
89f8dcd819
Complete deprecation of direct Gradle execution
- Deprecate `build-root-directory` and `gradle-executable` parameters
- Remove examples from README
2023-12-23 12:22:44 -07:00
daz
a738af78ea
Provide cache-encryption-key as action input
This makes it easier for users to enable config-cache saving in their workflow.

Config-cache data will only be saved/restored when the key is provided,
and the key is exported as `GRADLE_ENCRYPTION_KEY` for use in subsequent steps.
2023-12-22 12:52:09 -07:00
daz
f053e6b7e7
Deprecate the arguments parameter
Fixes #996
2023-12-20 09:57:20 -07:00
daz
c821b7c4f1
Update to run on Node 20 2023-12-20 09:57:18 -07:00
Daz DeBoer
9bca466e27
Make artifact retention configurable
- Added a new `artifact-retention-days` input parameter to control retention of uploaded artifacts
- Artifacts retention will use repository settings if not overridden.
2023-11-09 00:06:31 -07:00
daz
3d49588efc
Allow cache to overwrite existing Gradle User Home
Fixes #480
2023-08-19 13:37:53 -06:00
daz
8cade330d4 Include provisioned Gradle version as action output
Fixes #259
2023-08-19 20:37:12 +02:00
Daz DeBoer
dc5f59ec6e
Update action description for SEO 2023-08-17 17:00:13 -06:00
daz
7241fa5d56
Add new output to Action.yml 2023-07-24 08:43:47 -06:00
daz
632e888003
Update to the latest dependency-graph plugin
- Remove experimental warning
- Update documentation
2023-07-24 08:37:14 -06:00
daz
ced6859e9c
Update Build Scan™ to Build Scan® 2023-07-22 08:53:58 -06:00
daz
063cc1c708
Allow flexible use of dependency-graph support
Adds a 'dependency-graph' parameter that has 4 options:
1. 'disabled': no dependency graph files generated (the default)
2. 'generate': dependency graph files will be generated and saved as artifacts.
3. 'generate-and-submit': dependency graph files will be generated, saved as artifacts,
   and submitted to the Dependency Submission API on job completion.
4. 'download-and-submit': any previously uploaded dependency graph artifacts will be downloaded
   and submitted to the Dependency Submission API.
2023-07-07 20:42:48 -06:00
daz
4c9c435d2f
Configure Gradle User Home for dependency-graph
Instead of requiring an action step to generate the graph, configure Gradle User Home
so that subsequent Gradle invocations can generate a graph. Any generated graph files
are uploaded as artifacts on job completion.

- Construct job.correlator from workflow/job/matrix
- Export job.correlator as an environment var
- Upload artifacts at job completion in post-action step
- Specify the location of dependency graph report
- Only apply dependency graph init script when explicitly enabled
2023-07-07 20:42:48 -06:00
daz
c94d573317
Refactor action execution for reuse
Introducing new actions for the GitHub dependency graph will involve reuse of much of
the action infrastructure. This commit reorganises things a little to facilitate reuse.
2023-06-03 14:09:52 -06:00
Daz DeBoer
915123c493
Add experimental support for cache-cleanup
- Includes basic implementation as `CacheCleaner`
- Integration test that checks unused files are removed:
  - Downloaded dependencies
  - Local build cache entries
  - Wrapper distributions
2022-08-22 14:08:28 -06:00
Daz DeBoer
8a386f6915
Remove custom option for cache-read-timeout
Now that `@actions/cache` provides a env var override, we can remove our
custom configuration for setting the timeout on cache restore operations.

If the env var is NOT set, we continue to override the 60min default with 10mins.
2022-08-22 13:13:20 -06:00
Daz DeBoer
bf2a15ee94
Fix cache-read-only for scheduled jobs
The fix for #383 introduced a bug that caused the post-action to fail when
attemping to resolve `cache-read-only` for scheduled jobs.
This has been fixed with an explicit (rather than implicit) check for 'event.repository != null'.

Fixes #409
2022-08-18 12:35:47 -06:00
Daz DeBoer
8f9b7c7d7f
Add a configurable timeout for cache reads
Fixes #369
2022-08-16 17:37:41 -06:00
Daz DeBoer
e4e8267f88
Don't set cache-read-only for scheduled workflows
For scheduled workflows, we don't know the default branch. In this case cannot determine if
the workflow is running on the default branch, and so cannot know when to enable `cache-read-only`.

Fixes #383
2022-08-16 11:08:42 -06:00
Daz DeBoer
63bcd47c1b
Allow Job Summary generation to be disabled 2022-06-06 07:13:23 -06:00
Daz DeBoer
b02f4f1968
Disable cache-read-only when cache-write-only is set 2022-06-04 11:28:12 -06:00
Daz DeBoer
0a36ca9fb8
Use 'cache-read-only' for all but default_branch
Cache entries _written_ from jobs run on a non-default branch will be private
to other jobs for that branch. When development flow involves working on a
feature branch and then merging into 'main', these branch-private cache
entries can result in eviction of other (shared) cache entries generated
for the default branch.

With this change, we make the recommended setup the default, by running
with `cache-read-only: true` for any jobs run on a non-default branch.
These jobs will be able to read cache entries written from the main branch,
but will not write any cache entries.

Fixes #143
2022-06-04 11:19:07 -06:00
Daz DeBoer
1904e7e80d
Upgradle to use node v16 2022-01-27 08:22:29 -07:00
Daz DeBoer
b9c806c75d
Fix example in action.yml 2022-01-24 15:08:55 -07:00
Daz DeBoer
08d5b40ca5
Add experimental support for 'cache-write-only'
There may be cases where it a "fresh" cache entry would be beneficial,
for example if the Gradle User Home cache entry grows over time.

This setting would run the build as if no prior cache entry exists.
2022-01-20 15:04:11 -07:00
Daz DeBoer
a23ac1d61c
Add experimental support for 'strict-match' caching
By default, the action will attempt to restore a Gradle User Home
cache entry from a different set of matrix inputs (or a different Job entirely)
if an existing entry is not found for the current Job (including matrix inputs).

By specifying the experimental `gradle-home-cache-strict-match` parameter, a user
can avoid this fuzzy matching and ensure that a job execution starts with an
empty Gradle User Home if no entry from a prior execution is found.
2022-01-20 15:03:54 -07:00
Daz DeBoer
3edb3cb004
Reorder inputs in metadata file for v2.1 2021-12-30 18:16:51 -07:00
Daz DeBoer
76ea8a76b2
Treat configuration-cache as an extracted entry
Instead of using a fallback strategy to locate a configuration-cache entry
based on the current job and git SHA, these entries are now keyed based on their
file content with the keys persisted in the primary Gradle User Home entry.

This removes the chance of having a configuration-cache entry restored that is
incompatible with the restored Gradle User Home state, and makes the logic easier
to understand.

This change involved a fairly major refactor, with the CacheEntryExtractor being
split out from the primary cache implementation, and adding a separate extractor
implementation for configuration-cache.
2021-12-30 16:03:02 -07:00
Daz DeBoer
12fc52a49a
Combine java-toolchain entry definitions
- Remove configuration parameter for cache-entry-definitions. This allows richer modelling of extracted entries.
- Include both *.zip and *.tar.gz in entry definition for java-toolchains.
2021-12-30 16:03:02 -07:00
Daz DeBoer
c157d0a332
Cache downloaded Java Toolchains
Due to limitations with the way extracted entries are defined, a separate entry
is defined for *nix and windows.

Fixes #33
2021-12-30 16:02:02 -07:00
Daz DeBoer
37f2880a8a Cache wrapper zips and generated jars individually
Using a single cache entry for all files of a type is necessary to avoid
overloading the cache service. However, this mechanism is not very efficient
for certain artifacts like wrapper zips and generated-gradle-jars, where the
same individual files are often shared between different jobs.

With this change, any configured file patterns that do not end in '*' will
be cached as individual files. At this time this includes downloaded wrapper
zips and generated-gradle-jars.

Fixes #78
2021-12-08 14:05:13 -07: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
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
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
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
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
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
da64595ccc
Make artifact bundle definitions an input parameter 2021-10-15 13:21:13 -06:00
Daz DeBoer
d1ab42cddf
Document support for multi-line arguments
Fixes #88
2021-10-15 12:24:41 -06:00
Daz DeBoer
bbe1574290
Add some TODOs to the code for future reference 2021-09-13 11:50:07 -06:00
Daz DeBoer
3390540145
Simplify setting caches to disabled or read-only 2021-09-13 11:04:42 -06:00