mirror of
https://github.com/actions/cache.git
synced 2025-07-04 16:14: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.
|
||||
|
||||
>Two other actions are available in addition to the primary `cache` action:
|
||||
>* [Restore action](./restore/README.md)
|
||||
>* [Save action](./save/README.md)
|
||||
Two other actions are available in addition to the primary `cache` action:
|
||||
|
||||
* [Restore action](./restore/README.md)
|
||||
|
||||
* [Save action](./save/README.md)
|
||||
|
||||
[](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.emitter = new events.EventEmitter();
|
||||
this.index = 0;
|
||||
}
|
||||
/**
|
||||
* Add a operation into queue.
|
||||
@ -28386,8 +28385,6 @@ class Batch {
|
||||
*
|
||||
*/
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@ -28398,7 +28395,6 @@ class Batch {
|
||||
while (this.actives < this.concurrency) {
|
||||
const operation = this.nextOperation();
|
||||
if (operation) {
|
||||
console.log(`parallelExecute ${local_index} starting execution of operation ${this.offset}. Active count: ${this.actives}`);
|
||||
operation();
|
||||
}
|
||||
else {
|
||||
@ -28837,21 +28833,15 @@ async function streamToBuffer(stream, buffer, offset, end, encoding) {
|
||||
let pos = 0; // Position in stream
|
||||
const count = end - offset; // Total amount of data needed in stream
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeout = setTimeout(() => {
|
||||
console.log("Timeout triggered.");
|
||||
return reject(new Error(`The operation cannot be completed in timeout.`));
|
||||
}, REQUEST_TIMEOUT);
|
||||
const timeout = setTimeout(() => reject(new Error(`The operation cannot be completed in timeout.`)), REQUEST_TIMEOUT);
|
||||
stream.on("readable", () => {
|
||||
console.log("Entering readable");
|
||||
if (pos >= count) {
|
||||
clearTimeout(timeout);
|
||||
console.log("Leaving readable");
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
let chunk = stream.read();
|
||||
if (!chunk) {
|
||||
console.log("Leaving readable");
|
||||
return;
|
||||
}
|
||||
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;
|
||||
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);
|
||||
pos += chunkLength;
|
||||
console.log("Leaving readable");
|
||||
});
|
||||
stream.on("end", () => {
|
||||
clearTimeout(timeout);
|
||||
|
33
examples.md
33
examples.md
@ -39,7 +39,6 @@
|
||||
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
||||
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
||||
- [Swift - Mint](#swift---mint)
|
||||
- [* - Bazel](#---bazel)
|
||||
|
||||
## C# - NuGet
|
||||
|
||||
@ -658,35 +657,3 @@ steps:
|
||||
restore-keys: |
|
||||
${{ 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:
|
||||
|
||||
- Only cache files that are compatible across OSs.
|
||||
- Caching symlinks might cause issues while restoring them as they behave 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.
|
||||
- Avoid using directory pointers such as `${{ github.workspace }}` or `~` (home) which eventually evaluate to an absolute path that does not match across OSs.
|
||||
- Only cache those files which are compatible across OSs.
|
||||
- Caching symlinks might cause issues while restoration as they work differently on different OSs.
|
||||
- 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 and will not match across OSs.
|
||||
|
||||
## Force deletion of caches overriding default cache eviction policy
|
||||
|
||||
|
Reference in New Issue
Block a user