mirror of
https://github.com/actions/cache.git
synced 2024-12-01 14:22:24 +08:00
Compare commits
3 Commits
527133f4fa
...
b75a0be237
Author | SHA1 | Date | |
---|---|---|---|
|
b75a0be237 | ||
|
8469c94c6a | ||
|
0eb01d12a1 |
@ -157,6 +157,7 @@ Every programming language and framework has its own way of caching.
|
|||||||
|
|
||||||
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
|
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
|
||||||
|
|
||||||
|
* [Bun](./examples.md#bun)
|
||||||
* [C# - NuGet](./examples.md#c---nuget)
|
* [C# - NuGet](./examples.md#c---nuget)
|
||||||
* [Clojure - Lein Deps](./examples.md#clojure---lein-deps)
|
* [Clojure - Lein Deps](./examples.md#clojure---lein-deps)
|
||||||
* [D - DUB](./examples.md#d---dub)
|
* [D - DUB](./examples.md#d---dub)
|
||||||
|
5
dist/restore-only/index.js
vendored
5
dist/restore-only/index.js
vendored
@ -189,12 +189,13 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
|
const fileSizeMultiplierGb = 10 // 10GB per repo limit
|
||||||
|
const fileSizeLimit = fileSizeMultiplierGb * 1024 * 1024 * 1024;
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
||||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the ${fileSizeMultiplierGb}GB limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
core.debug('Reserving Cache');
|
core.debug('Reserving Cache');
|
||||||
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
||||||
|
5
dist/restore/index.js
vendored
5
dist/restore/index.js
vendored
@ -189,12 +189,13 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
|
const fileSizeMultiplierGb = 10 // 10GB per repo limit
|
||||||
|
const fileSizeLimit = fileSizeMultiplierGb * 1024 * 1024 * 1024;
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
||||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the ${fileSizeMultiplierGb}GB limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
core.debug('Reserving Cache');
|
core.debug('Reserving Cache');
|
||||||
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
||||||
|
5
dist/save-only/index.js
vendored
5
dist/save-only/index.js
vendored
@ -189,12 +189,13 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
|
const fileSizeMultiplierGb = 10 // 10GB per repo limit
|
||||||
|
const fileSizeLimit = fileSizeMultiplierGb * 1024 * 1024 * 1024;
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
||||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the ${fileSizeMultiplierGb}GB limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
core.debug('Reserving Cache');
|
core.debug('Reserving Cache');
|
||||||
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
||||||
|
5
dist/save/index.js
vendored
5
dist/save/index.js
vendored
@ -189,12 +189,13 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
if (core.isDebug()) {
|
if (core.isDebug()) {
|
||||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
|
const fileSizeMultiplierGb = 10 // 10GB per repo limit
|
||||||
|
const fileSizeLimit = fileSizeMultiplierGb * 1024 * 1024 * 1024;
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
||||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the ${fileSizeMultiplierGb}GB limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
core.debug('Reserving Cache');
|
core.debug('Reserving Cache');
|
||||||
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
|
||||||
|
21
examples.md
21
examples.md
@ -1,5 +1,6 @@
|
|||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
- [Bun](#bun)
|
||||||
- [C# - NuGet](#c---nuget)
|
- [C# - NuGet](#c---nuget)
|
||||||
- [Clojure - Lein Deps](#clojure---lein-deps)
|
- [Clojure - Lein Deps](#clojure---lein-deps)
|
||||||
- [D - DUB](#d---dub)
|
- [D - DUB](#d---dub)
|
||||||
@ -41,6 +42,26 @@
|
|||||||
- [Swift - Mint](#swift---mint)
|
- [Swift - Mint](#swift---mint)
|
||||||
- [* - Bazel](#---bazel)
|
- [* - Bazel](#---bazel)
|
||||||
|
|
||||||
|
## Bun
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.bun/install/cache
|
||||||
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~\.bun
|
||||||
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||||
|
```
|
||||||
|
|
||||||
## C# - NuGet
|
## C# - NuGet
|
||||||
|
|
||||||
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
||||||
|
Loading…
Reference in New Issue
Block a user