mirror of
https://github.com/actions/cache.git
synced 2025-07-05 08:34:50 +02:00
Compare commits
4 Commits
bishal/deb
...
kotewar/up
Author | SHA1 | Date | |
---|---|---|---|
21238b32cf | |||
76371af810 | |||
93d39f69f1 | |||
e7cab40f69 |
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
This action allows caching dependencies and build outputs to improve workflow execution time.
|
This action allows caching dependencies and build outputs to improve workflow execution time.
|
||||||
|
|
||||||
>Two other actions are available in addition to the primary `cache` action:
|
Two other actions are available in addition to the primary `cache` action:
|
||||||
>* [Restore action](./restore/README.md)
|
|
||||||
>* [Save action](./save/README.md)
|
* [Restore action](./restore/README.md)
|
||||||
|
|
||||||
|
* [Save action](./save/README.md)
|
||||||
|
|
||||||
[](https://github.com/actions/cache/actions/workflows/workflow.yml)
|
[](https://github.com/actions/cache/actions/workflows/workflow.yml)
|
||||||
|
|
||||||
|
13
dist/restore/index.js
vendored
13
dist/restore/index.js
vendored
@ -28332,7 +28332,6 @@ class Batch {
|
|||||||
}
|
}
|
||||||
this.concurrency = concurrency;
|
this.concurrency = concurrency;
|
||||||
this.emitter = new events.EventEmitter();
|
this.emitter = new events.EventEmitter();
|
||||||
this.index = 0;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Add a operation into queue.
|
* Add a operation into queue.
|
||||||
@ -28386,8 +28385,6 @@ class Batch {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
parallelExecute() {
|
parallelExecute() {
|
||||||
const local_index = this.index++;
|
|
||||||
console.log(`parallelExecute ${local_index} Active count: ${this.actives} Completed count: ${this.completed} total: ${this.operations.length}`);
|
|
||||||
if (this.state === BatchStates.Error) {
|
if (this.state === BatchStates.Error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -28398,7 +28395,6 @@ class Batch {
|
|||||||
while (this.actives < this.concurrency) {
|
while (this.actives < this.concurrency) {
|
||||||
const operation = this.nextOperation();
|
const operation = this.nextOperation();
|
||||||
if (operation) {
|
if (operation) {
|
||||||
console.log(`parallelExecute ${local_index} starting execution of operation ${this.offset}. Active count: ${this.actives}`);
|
|
||||||
operation();
|
operation();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -28837,21 +28833,15 @@ async function streamToBuffer(stream, buffer, offset, end, encoding) {
|
|||||||
let pos = 0; // Position in stream
|
let pos = 0; // Position in stream
|
||||||
const count = end - offset; // Total amount of data needed in stream
|
const count = end - offset; // Total amount of data needed in stream
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => reject(new Error(`The operation cannot be completed in timeout.`)), REQUEST_TIMEOUT);
|
||||||
console.log("Timeout triggered.");
|
|
||||||
return reject(new Error(`The operation cannot be completed in timeout.`));
|
|
||||||
}, REQUEST_TIMEOUT);
|
|
||||||
stream.on("readable", () => {
|
stream.on("readable", () => {
|
||||||
console.log("Entering readable");
|
|
||||||
if (pos >= count) {
|
if (pos >= count) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
console.log("Leaving readable");
|
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let chunk = stream.read();
|
let chunk = stream.read();
|
||||||
if (!chunk) {
|
if (!chunk) {
|
||||||
console.log("Leaving readable");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof chunk === "string") {
|
if (typeof chunk === "string") {
|
||||||
@ -28861,7 +28851,6 @@ async function streamToBuffer(stream, buffer, offset, end, encoding) {
|
|||||||
const chunkLength = pos + chunk.length > count ? count - pos : chunk.length;
|
const chunkLength = pos + chunk.length > count ? count - pos : chunk.length;
|
||||||
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);
|
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);
|
||||||
pos += chunkLength;
|
pos += chunkLength;
|
||||||
console.log("Leaving readable");
|
|
||||||
});
|
});
|
||||||
stream.on("end", () => {
|
stream.on("end", () => {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
33
examples.md
33
examples.md
@ -39,7 +39,6 @@
|
|||||||
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
||||||
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
||||||
- [Swift - Mint](#swift---mint)
|
- [Swift - Mint](#swift---mint)
|
||||||
- [* - Bazel](#---bazel)
|
|
||||||
|
|
||||||
## C# - NuGet
|
## C# - NuGet
|
||||||
|
|
||||||
@ -658,35 +657,3 @@ steps:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-mint-
|
${{ runner.os }}-mint-
|
||||||
```
|
```
|
||||||
|
|
||||||
## * - Bazel
|
|
||||||
|
|
||||||
[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` and `macos-latest` base images.
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Cache Bazel
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/bazel
|
|
||||||
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-bazel-
|
|
||||||
- run: bazelisk test //...
|
|
||||||
```
|
|
||||||
|
|
||||||
### macOS
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Cache Bazel
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/private/var/tmp/_bazel_runner/
|
|
||||||
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-bazel-
|
|
||||||
- run: bazelisk test //...
|
|
||||||
```
|
|
||||||
|
@ -30,10 +30,10 @@ Reusing cache across feature branches is not allowed today to provide cache [iso
|
|||||||
|
|
||||||
From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is passed as true. This means that a cache created on `ubuntu-latest` or `mac-latest` can be used by `windows-latest` and vice versa, provided the workflow which runs on `windows-latest` have input `enableCrossOsArchive` as true. This is useful to cache dependencies which are independent of the runner platform. This will help reduce the consumption of the cache quota and help build for multiple platforms from the same cache. Things to keep in mind while using this feature:
|
From `v3.2.3` cache is cross-os compatible when `enableCrossOsArchive` input is passed as true. This means that a cache created on `ubuntu-latest` or `mac-latest` can be used by `windows-latest` and vice versa, provided the workflow which runs on `windows-latest` have input `enableCrossOsArchive` as true. This is useful to cache dependencies which are independent of the runner platform. This will help reduce the consumption of the cache quota and help build for multiple platforms from the same cache. Things to keep in mind while using this feature:
|
||||||
|
|
||||||
- Only cache files that are compatible across OSs.
|
- Only cache those files which are compatible across OSs.
|
||||||
- Caching symlinks might cause issues while restoring them as they behave differently on different OSs.
|
- Caching symlinks might cause issues while restoration as they work differently on different OSs.
|
||||||
- Be mindful when caching files from outside your github workspace directory as the directory is located at different places across OS.
|
- Only cache files from within your github workspace directory.
|
||||||
- Avoid using directory pointers such as `${{ github.workspace }}` or `~` (home) which eventually evaluate to an absolute path that does not match across OSs.
|
- Avoid using directory pointers such as `${{ github.workspace }}` or `~` (home) which eventually evaluate to an absolute path and will not match across OSs.
|
||||||
|
|
||||||
## Force deletion of caches overriding default cache eviction policy
|
## Force deletion of caches overriding default cache eviction policy
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user