added hosted tool cache section

This commit is contained in:
Maxim Lobanov 2021-03-23 18:39:46 +03:00
parent 87ce602186
commit 0ebe88be8c
2 changed files with 12 additions and 1 deletions

View file

@ -61,10 +61,12 @@ Currently, the following distributions are supported:
### Check latest
In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local cache. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific version of Java is always used.
The local version of Java in cache gets updated on weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on-flight. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
```yaml
steps:
- uses: actions/checkout@v2
@ -106,6 +108,7 @@ jobs:
- [Testing against different platforms](docs/advanced-usage.md#Testing-against-different-platforms)
- [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven)
- [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle)
- [Hosted Tool Cache](#Hosted-Tool-Cache)
## License

View file

@ -9,6 +9,7 @@
- [Testing against different platforms](#Testing-against-different-platforms)
- [Publishing using Apache Maven](#Publishing-using-Apache-Maven)
- [Publishing using Gradle](#Publishing-using-Gradle)
- [Hosted Tool Cache](#Hosted-Tool-Cache)
See [action.yml](../action.yml) for more details on task inputs.
@ -291,3 +292,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
```
## Hosted Tool Cache
GitHub Hosted Runners have a tools cache that comes with some Java versions installed. This tools cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and there is where you will find Java installed. `setup-java` works by taking a specific version of Java in this tools cache and adding it to PATH.
Currently, LTS versions of Adopt OpenJDK (`adopt`) are cached on the GitHub Hosted Runners.
The tools cache gets updated on weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).