mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-11 04:41:31 +02:00
Merge branch 'master' into rust-example
This commit is contained in:
commit
aea825e76e
6 changed files with 16 additions and 18 deletions
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
|
@ -5,7 +5,7 @@ on:
|
|||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
|
|
@ -59,7 +59,7 @@ See [Examples](examples.md)
|
|||
|
||||
## Cache Limits
|
||||
|
||||
Individual caches are limited to 200MB and a repository can have up to 2GB of caches. Once the 2GB limit is reached, older caches will be evicted based on when the cache was last accessed.
|
||||
Individual caches are limited to 200MB and a repository can have up to 2GB of caches. Once the 2GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.
|
||||
|
||||
## Skipping steps based on cache-hit
|
||||
|
||||
|
|
14
examples.md
14
examples.md
|
@ -8,6 +8,7 @@
|
|||
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
|
||||
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
||||
- [Ruby - Gem](#ruby---gem)
|
||||
- [Go - Modules](#go---modules)
|
||||
- [Rust - Cargo](#rust---cargo)
|
||||
|
||||
## Node - npm
|
||||
|
@ -98,6 +99,17 @@ uses: actions/cache@preview
|
|||
${{ runner.os }}-gem-
|
||||
```
|
||||
|
||||
## Go - Modules
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@preview
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
```
|
||||
|
||||
## Rust - Cargo
|
||||
|
||||
```
|
||||
|
@ -116,4 +128,4 @@ uses: actions/cache@preview
|
|||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
```
|
||||
```
|
|
@ -94,13 +94,6 @@ async function run() {
|
|||
core.info(
|
||||
`Cache restored from key:${cacheEntry && cacheEntry.cacheKey}`
|
||||
);
|
||||
|
||||
try {
|
||||
core.info("Cache Checksum:");
|
||||
await exec(`md5sum`, [`${archivePath}`]);
|
||||
} catch (error) {
|
||||
core.debug(`Failed to checkum with ${error}`);
|
||||
}
|
||||
} catch (error) {
|
||||
core.warning(error.message);
|
||||
utils.setCacheHitOutput(false);
|
||||
|
|
|
@ -66,13 +66,6 @@ async function run() {
|
|||
|
||||
const stream = fs.createReadStream(archivePath);
|
||||
await cacheHttpClient.saveCache(stream, primaryKey);
|
||||
|
||||
try {
|
||||
core.info("Cache Checksum:");
|
||||
await exec(`md5sum`, [`${archivePath}`]);
|
||||
} catch (error) {
|
||||
core.debug(`Failed to checkum with ${error}`);
|
||||
}
|
||||
} catch (error) {
|
||||
core.warning(error.message);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ export function resolvePath(filePath: string): string {
|
|||
if (filePath[0] === "~") {
|
||||
const home = os.homedir();
|
||||
if (!home) {
|
||||
throw new Error("Unable to resole `~` to HOME");
|
||||
throw new Error("Unable to resolve `~` to HOME");
|
||||
}
|
||||
return path.join(home, filePath.slice(1));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue