Compare commits

..
27 Commits
Author SHA1 Message Date
Josh Gross 86dff562ab v1.0.1 release binaries 2019-11-05 15:43:33 -05:00
Josh Gross 0f810ad45a Release v1.0.1 2019-11-05 15:42:18 -05:00
Josh Gross 9d8c7b4041 Release v1 2019-11-04 15:13:15 -05:00
Josh Gross 21f72b1fcc Bump package version 2019-11-04 12:04:13 -05:00
Birunthan MohanathasandJosh Gross ce4a52af49 Stop warning when cache is not found (#40)
The cache not being found is a common situation so very visible warning
is a little too much.
2019-11-04 11:03:18 -05:00
Linda_ppandJosh Gross 57f889e86e Add cargo example for Rust project (#8)
* Add cargo example

* Add hash of Cargo.lock to keys of caches

* Move Rust example to examples.md
2019-11-04 10:15:02 -05:00
Ishizaka TomoyaandJosh Gross 8c4c641fa0 Add Elixir Mix example (#42)
* Add Elixir Mix example

* Fix typo
2019-11-03 22:44:06 -05:00
Brian SurowiecandJosh Gross fe98aa6782 Fix repo name in contact email (#41) 2019-11-03 09:38:45 -05:00
CrazyMaxandJosh Gross 87c0185d27 Add Go modules example (#18)
* Add Go modules example

* Fix TOC
2019-11-01 15:27:43 -04:00
Adam DobrawyandJosh Gross 25e0c8faac Remove cache checksum debug - close #24 (#26)
* Remove cache checksum debug - close #24

*  Remove cache checksum debug on save

* Fix formatting
2019-11-01 15:24:11 -04:00
Zach RennerandJosh Gross d384987622 Time based eviction interval is 1 week (#34) 2019-11-01 14:20:27 -04:00
Winter JungandJosh Gross 7058277028 Fix typo in error message (#29) 2019-11-01 10:35:38 -04:00
David HadkaandJosh Gross 2523667574 Add note about time-based eviction to README (#30) 2019-11-01 10:35:10 -04:00
Josh GrossandGitHub 0e86554410 Ignore all .md files 2019-11-01 10:22:36 -04:00
Josh GrossandGitHub aae1376422 Exclude documentation from CI tests (#28) 2019-10-31 17:22:35 -04:00
PeterandJosh Gross fc310d4670 Fix README.md (#25)
`restore-keys` had incorrect indentation.
2019-10-31 17:19:43 -04:00
Zach RennerandJosh Gross 287ee0671b Add trailing dash to Maven fallback key (#19) 2019-10-31 15:08:09 -04:00
Zach RennerandJosh Gross c401b561b2 Link to NuGet lock files documentation (#20) 2019-10-31 15:06:47 -04:00
Josh GrossandGitHub 526c940a94 Prevent commands from executing during tests (#21)
* Prevent commands from executing during tests

* Add newline at end of file

* Drop all commands from output
2019-10-31 15:05:59 -04:00
Chris PattersonandGitHub d676b6c354 Update README.md 2019-10-31 13:01:04 -04:00
M Akhyar Rahman HidayatandJosh Gross 6be35d19ef Minor typo in README (#15)
from `steps.[ID].outupts.cache-hit` to `steps.[ID].outputs.cache-hit`
2019-10-31 12:06:17 -04:00
Josh GrossandGitHub 3743276c66 Move examples to their own page (#13) 2019-10-31 11:36:50 -04:00
Ryoya ItoandJosh Gross 6e37fd16ea Add Carthage example (#10) 2019-10-31 10:52:32 -04:00
Kosuke OgawaandJosh Gross 83bb08ded3 Add Cocoapods example (#5) 2019-10-31 10:47:43 -04:00
Kosuke OgawaandJosh Gross 7611296bb3 Add Ruby Gem example (#4) 2019-10-31 10:45:47 -04:00
Josh GrossandGitHub 889c603691 Update workflow (#1)
* Run workflow on linux, mac, and windows

* Add status badge

* Use npm install instead

* Bump typescript version

* Use node 12.x
2019-10-31 10:37:00 -04:00
Josh GrossandGitHub b2cac08cff Create CODE_OF_CONDUCT.md 2019-10-30 15:34:55 -04:00
8 changed files with 104 additions and 93 deletions
+8 -4
View File
@@ -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
@@ -36,7 +40,7 @@ jobs:
- uses: actions/checkout@v1
- name: Cache node modules
uses: actions/cache@preview
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -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
@@ -70,7 +74,7 @@ Example:
steps:
- uses: actions/checkout@v1
- uses: actions/cache@preview
- uses: actions/cache@v1
id: cache
with:
path: path/to/dependencies
+5 -2
View File
@@ -2972,7 +2972,10 @@ function run() {
core.debug(`Cache Path: ${cachePath}`);
const primaryKey = core.getInput(constants_1.Inputs.Key, { required: true });
core.saveState(constants_1.State.CacheKey, primaryKey);
const restoreKeys = core.getInput(constants_1.Inputs.RestoreKeys).split("\n");
const restoreKeys = core
.getInput(constants_1.Inputs.RestoreKeys)
.split("\n")
.filter(x => x !== "");
const keys = [primaryKey, ...restoreKeys];
core.debug("Resolved Keys:");
core.debug(JSON.stringify(keys));
@@ -2994,7 +2997,7 @@ function run() {
try {
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys);
if (!cacheEntry) {
core.info(`Cache not found for input keys: ${JSON.stringify(keys)}.`);
core.info(`Cache not found for input keys: ${keys.join(", ")}.`);
return;
}
let archivePath = path.join(yield utils.createTempDirectory(), "cache.tgz");
+2 -2
View File
@@ -2889,11 +2889,11 @@ function run() {
const tarPath = yield io.which("tar", true);
core.debug(`Tar Path: ${tarPath}`);
yield exec_1.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.`);
core.warning(`Cache size of ${archiveFileSize} bytes is over the 400MB limit, not saving cache.`);
return;
}
const stream = fs.createReadStream(archivePath);
+70 -69
View File
@@ -1,43 +1,22 @@
# 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)
- [Node - npm](#node---npm)
- [Node - Yarn](#node---yarn)
- [Ruby - Gem](#ruby---gem)
- [Rust - Cargo](#rust---cargo)
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
- [Ruby - Gem](#ruby---gem)
- [Go - Modules](#go---modules)
- [Elixir - Mix](#elixir---mix)
- [Rust - Cargo](#rust---cargo)
## Node - npm
```yaml
- uses: actions/cache@preview
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
```
## Node - Yarn
```yaml
- uses: actions/cache@preview
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-yarn-
```
## C# - Nuget
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
```yaml
- uses: actions/cache@preview
- uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -45,10 +24,31 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
${{ runner.os }}-nuget-
```
## 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-
```
## Go - Modules
```yaml
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
```
## Java - Gradle
```yaml
- uses: actions/cache@preview
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
@@ -59,7 +59,7 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
## Java - Maven
```yaml
- uses: actions/cache@preview
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -67,32 +67,32 @@ 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@preview
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@preview
- 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
```yaml
- uses: actions/cache@preview
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
@@ -100,43 +100,44 @@ 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-
```
## Elixir - Mix
```yaml
- uses: actions/cache@preview
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@preview
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@preview
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@preview
uses: actions/cache@v1
with:
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-
```
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "cache",
"version": "0.0.1",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1105,9 +1105,9 @@
}
},
"commander": {
"version": "2.20.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz",
"integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==",
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true,
"optional": true
},
@@ -2318,9 +2318,9 @@
"dev": true
},
"handlebars": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz",
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==",
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
@@ -4981,13 +4981,13 @@
"dev": true
},
"uglify-js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
"version": "3.6.7",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.7.tgz",
"integrity": "sha512-4sXQDzmdnoXiO+xvmTzQsfIiwrjUCSA95rSP4SEd8tDb51W2TiDOlL76Hl+Kw0Ie42PSItCW8/t6pBNCF2R48A==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.20.0",
"commander": "~2.20.3",
"source-map": "~0.6.1"
}
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cache",
"version": "0.0.2",
"version": "1.0.1",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
+5 -2
View File
@@ -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:");
@@ -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;
}
+2 -2
View File
@@ -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;
}