Commit Graph

253 Commits

Author SHA1 Message Date
daz
9e58f8b1de Add dependency-graph-file as step output
Fixes #804
2023-07-24 08:37:14 -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
915a66c096 Bump dependency-graph version number 2023-07-17 15:46:14 -06:00
daz
9f977db2d8 Update to latest plugin version 2023-07-17 15:12:30 -06:00
Daz DeBoer
a0fdbb009a Fix issue locating wrapper bat on windows 2023-07-15 23:04:38 -06:00
daz
f59a6d4310 Avoid log messages for included builds 2023-07-15 22:33:54 -06:00
daz
b69de5f2a9 Support multiple invocations in dependency-graph init script
If an existing dependency graph file is present for the configured job correlator,
we now generate a unique correlator value for the invocation. This allows the action
to submit dependency snapshots for a series of Gradle invocations within the same Job.

This commit updates to `github-dependency-graph-gradle-plugin@v0.0.6`, which reduces
redundancy in the mapping of resolved Gradle dependencies to the GitHub Dependency Graph.
2023-07-15 22:33:31 -06:00
daz
3c11eee5f9 Don't use full path when executing gradlew
Fixes #796
2023-07-13 16:15:54 -06:00
daz
cef72ff9e4 Use latest github-dependency-graph-gradle-plugin 2023-07-10 07:16:49 -06:00
daz
f01b48d89d Do not attempt dependency graph on unsupported Gradle versions 2023-07-07 20:42:49 -06:00
daz
1e71bceb3f Supply plugin portal URL directly
The 'gradlePluginPortal()' convenience isn't supported in older Gradle versions.
2023-07-07 20:42:49 -06:00
daz
c0186c5832 Replace spaces with underscore in job correlator 2023-07-07 20:42:49 -06:00
daz
ee7ca6ac9b Remove defunct generate actions 2023-07-07 20:42:48 -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
820b228f28 Switch back to using published plugin 2023-07-07 20:42:48 -06:00
daz
d0ffeaa089 Reduce log level for debug message 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
a6ad1901be Copy dependency graph init script to Gradle Home
- Temporarily use a hard-coded plugin for convenience
2023-07-07 20:42:48 -06:00
daz
626d937994 Remove commas from workflow name
Commas are explicitly disallowed in cache keys, so remove any from
workflow name when generating cache key.
2023-06-29 10:01:14 -06:00
daz
be413309fa First cut at actions for dependency-graph
- Dependency graph init-script references published version of plugin jar.
- `dependency-graph-generate` action will:
     - Provision Gradle if required
     - Execute Gradle with dependency-graph plugin to generate graph JSON
     - Upload dependency-graph JSON file as workflow artifact
- `dependency-graph-submit` action will:
    - Download dependency-graph JSON artifact
    - Submit the graph via the GitHub dependency submission API
2023-06-28 11:24:57 -06:00
daz
07023d3e3e Refactor input parameters
Moved reading of all input parameters into a common source: `input-params.ts`.
This centralized all input parameter reads, and allowed an improved implementation
of reading boolean parameters. In particular, the implementation now provides a default
value for a boolean input parameter that isn't declared for an action.
2023-06-06 10:47:56 -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
2bf6bc3646 Include workflow name in cache key
Fixes #699 by avoiding cache key collisions between jobs with the
same name in different workflows.
2023-05-23 14:59:12 -06:00
daz
d23c38fad3 Remove incorrect comment 2023-05-04 08:25:28 -06:00
daz
a580d9bd57 Detect GE plugin applied in settingsEvaluated
The `PluginManager.hasPlugin` method was not detecting the GE plugin when it
was applied during settingsEvaluated.
Switching to `PluginManager.withPlugin` fixes this.

Fixes #626
2023-04-26 10:49:32 -06:00
Daz DeBoer
eb126d771e Update for Gradle 8.1 release
With Gradle 8.1, the configuration-cache has changed and is now stable. 
As a temporary measure, this commit disables save/restore of the configuration-cache
data to avoid issues until we can deal with this change properly.
2023-04-14 16:23:09 -06:00
Jonathan Leitschuh
887e0bda35 Fix typo (#655)
Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
2023-04-04 20:22:54 -06:00
Daz DeBoer
6095a76664 Update tests for Gradle 8 2023-02-18 13:25:58 -07:00
Daz DeBoer
b47aad4750 Remove use of deprecated fs.rmdir
Using fs.rm({recursive: true}) instead.

Fixes #502
2023-02-06 12:40:03 -07:00
Daz DeBoer
e444647395 Save/restore extracted JDK instead of archive
Gradle 7.6 changes the way the downloaded JDKs are saved and extracted.
To workaround this difference, save and restore the extracted JDK instead.
2022-12-07 20:07:40 +13:00
Daz DeBoer
3fbe033aaa Retain 'set-output' command when GITHUB_OUTPUT is not set
This should maintain compatibility with older GitHub Enterprise versions
2022-10-22 08:20:16 -06:00
Daz DeBoer
3b959539de Remove use of deprecated 'set-output' command
- Use GITHUB_OUTPUT file in init script
- Write to a marker file in configuratiion-cache tests

Fixes #461
2022-10-20 14:09:12 -06:00
Daz DeBoer
394498f89f Avoid appending to existing build-results file
When configuration-cache is enabled, the invocationId may not be unique, which can result in
mulitple builds writing to the same file. Rather than failing the post-action, we simply
ignore any subsequent build results with the same ID.

Fixes #441
2022-09-26 11:03:26 -06:00
Daz DeBoer
0e4b100458 Use node to set file timestamps
Using `find` and `touch` will not work on windows, so this provides a
cross-platform mechanism.
2022-08-26 09:04:11 -06:00
Daz DeBoer
82bc72e1e7 Re-enable cache-cleanup on Windows 2022-08-26 09:03:58 -06:00
Daz DeBoer
531cc21aeb Clarify comment 2022-08-25 20:26:16 -06:00
Daz DeBoer
cc60593845 Disable cache-cleanup on Windows
It does not seem possible to use `find .. -exec ..` on Windows,
so a node-only solution may be required.
2022-08-25 20:06:13 -06:00
Daz DeBoer
fb549a8417 Avoid using GNU-specific touch options
This makes cache-cleaner work correctly on MacOS.
2022-08-25 20:03:04 -06:00
Daz DeBoer
25ec178747 Add integration test for cache cleanup 2022-08-22 14:08:28 -06:00
Daz DeBoer
3cc0a8f6bb Add some explanatory comments 2022-08-22 14:08:28 -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
eb22e65b5b Extract constant for Env Var name 2022-08-22 13:30:07 -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
f0ec7fb780 Remove 'followSymbolicLinks: false' flag for Globber
It appears that when restoring the Gradle User Home directory, certain empty
directories are being identified by Node as broken symlinks. This results in
`Error: ENOENT: No such file or directory` when attempting to resolve a Glob pattern.

By using the default behaviour of Globber (followSymbolicLinks && ignoreBrokenLinks),
these bad files no longer cause errors when saving the Gradle User Home to cache.

Fixes #408
2022-08-18 17:10:03 -06:00
Daz DeBoer
8f9b7c7d7f Add a configurable timeout for cache reads
Fixes #369
2022-08-16 17:37:41 -06:00
Daz DeBoer
b49446f8e1 Improved cache reporting
- Fix count of saved entries
- Catch and report errors on save and restore
- Correctly report entries that are never requested
2022-08-16 16:37:17 -06:00
Daz DeBoer
792a93a5e3 Do not write build-results file outside GitHub Actions context
The init-scripts added to Gradle User Home were assuming the presence of certain
GitHub Actions environment variables. With this fix, these init scripts behave
better without these env vars.

Fixes #350
2022-07-11 15:09:56 -06:00
Daz DeBoer
6965e8ed4c Only stop Gradle Daemons when saving Gradle User Home state
Fixes #341
2022-06-22 16:41:03 -06:00
Daz DeBoer
884bca012f Extracted some classes and refactored for clarity 2022-06-22 16:35:55 -06:00