Skip to content

Commit

Permalink
Release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Gross committed Nov 5, 2019
1 parent 9d8c7b4 commit 0f810ad
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 71 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

This GitHub Action allows caching dependencies and build outputs to improve workflow execution time.

<a href="https://github.com/actions/cache"><img alt="GitHub Actions status" src="https://github.com/actions/cache/workflows/Tests/badge.svg"></a>
<a href="https://github.com/actions/cache"><img alt="GitHub Actions status" src="https://github.com/actions/cache/workflows/Tests/badge.svg?branch=master&event=push"></a>

## Documentation

See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows).

## Usage

Expand Down Expand Up @@ -59,7 +63,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. Caches that are not accessed within the last week will also be evicted.
Individual caches are limited to 400MB 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
Expand Down
107 changes: 54 additions & 53 deletions examples.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# Examples

- [Node - npm](#node---npm)
- [Node - Yarn](#node---yarn)
- [C# - Nuget](#c---nuget)
- [Elixir - Mix](#elixir---mix)
- [Go - Modules](#go---modules)
- [Java - Gradle](#java---gradle)
- [Java - Maven](#java---maven)
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
- [Node - npm](#node---npm)
- [Node - Yarn](#node---yarn)
- [Ruby - Gem](#ruby---gem)
- [Go - Modules](#go---modules)
- [Elixir - Mix](#elixir---mix)
- [Rust - Cargo](#rust---cargo)
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)

## Node - npm
## C# - Nuget
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):

```yaml
- uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-nuget-
```
## Node - Yarn
## Elixir - Mix
```yaml
- uses: actions/cache@v1
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-mix-
```
## C# - Nuget
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
## Go - Modules
```yaml
- uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-nuget-
${{ runner.os }}-go-
```
## Java - Gradle
Expand All @@ -67,26 +67,26 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
${{ runner.os }}-maven-
```
## Swift, Objective-C - Carthage
## Node - npm
```yaml
uses: actions/cache@v1
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
restore-keys: |
${{ runner.os }}-carthage-
- uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
```
## Swift, Objective-C - CocoaPods
## Node - Yarn
```yaml
- uses: actions/cache@v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-pods-
${{ runner.os }}-yarn-
```
## Ruby - Gem
Expand All @@ -100,30 +100,9 @@ uses: actions/cache@v1
${{ runner.os }}-gem-
```
## Go - Modules
```yaml
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
```
## Elixir - Mix
```yaml
- uses: actions/cache@v1
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-
```
## Rust - Cargo
```
```yaml
- name: Cache cargo registry
uses: actions/cache@v1
with:
Expand All @@ -140,3 +119,25 @@ uses: actions/cache@v1
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
```
## Swift, Objective-C - Carthage
```yaml
- uses: actions/cache@v1
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
restore-keys: |
${{ runner.os }}-carthage-
```
## Swift, Objective-C - CocoaPods
```yaml
- uses: actions/cache@v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
```
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cache",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
Expand Down
7 changes: 5 additions & 2 deletions src/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ async function run() {
const primaryKey = core.getInput(Inputs.Key, { required: true });
core.saveState(State.CacheKey, primaryKey);

const restoreKeys = core.getInput(Inputs.RestoreKeys).split("\n");
const restoreKeys = core
.getInput(Inputs.RestoreKeys)
.split("\n")
.filter(x => x !== "");
const keys = [primaryKey, ...restoreKeys];

core.debug("Resolved Keys:");
Expand Down Expand Up @@ -52,7 +55,7 @@ async function run() {
const cacheEntry = await cacheHttpClient.getCacheEntry(keys);
if (!cacheEntry) {
core.info(
`Cache not found for input keys: ${JSON.stringify(keys)}.`
`Cache not found for input keys: ${keys.join(", ")}.`
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ async function run() {
core.debug(`Tar Path: ${tarPath}`);
await exec(`"${tarPath}"`, args);

const fileSizeLimit = 200 * 1024 * 1024; // 200MB
const fileSizeLimit = 400 * 1024 * 1024; // 400MB
const archiveFileSize = fs.statSync(archivePath).size;
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
core.warning(
`Cache size of ${archiveFileSize} bytes is over the 200MB limit, not saving cache.`
`Cache size of ${archiveFileSize} bytes is over the 400MB limit, not saving cache.`
);
return;
}
Expand Down

0 comments on commit 0f810ad

Please sign in to comment.