Compare commits

..

7 Commits

Author SHA1 Message Date
345e0e411a Merge branch 'dhadka/update-cache-module' of https://github.com/actions/cache into dhadka/update-cache-module 2020-10-20 13:00:13 -05:00
def3a7d616 Update dist files 2020-10-20 12:59:57 -05:00
648a1f9e09 Real licenses 2020-10-20 12:55:59 -05:00
b32535486f Revert "Update licenses"
This reverts commit 97314e1d15.
2020-10-20 12:55:08 -05:00
97314e1d15 Update licenses 2020-10-20 12:30:03 -05:00
d74c9636bf Bump cache action version 2020-10-20 12:19:34 -05:00
0c7f3b7744 Update to @actions/cache 1.0.3 2020-10-20 12:15:13 -05:00
32 changed files with 16046 additions and 25068 deletions

1
.github/CODEOWNERS vendored
View File

@ -1 +0,0 @@
* @actions/artifacts-actions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/tslib-1.14.1.dep.yml generated Normal file

Binary file not shown.

View File

@ -19,6 +19,7 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/githu
path: | path: |
~/cache ~/cache
!~/cache/exclude !~/cache/exclude
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
``` ```
@ -99,7 +100,6 @@ See [Examples](examples.md) for a list of `actions/cache` implementations for us
- [OCaml/Reason - esy](./examples.md#ocamlreason---esy) - [OCaml/Reason - esy](./examples.md#ocamlreason---esy)
- [PHP - Composer](./examples.md#php---composer) - [PHP - Composer](./examples.md#php---composer)
- [Python - pip](./examples.md#python---pip) - [Python - pip](./examples.md#python---pip)
- [Python - pipenv](./examples.md#python---pipenv)
- [R - renv](./examples.md#r---renv) - [R - renv](./examples.md#r---renv)
- [Ruby - Bundler](./examples.md#ruby---bundler) - [Ruby - Bundler](./examples.md#ruby---bundler)
- [Rust - Cargo](./examples.md#rust---cargo) - [Rust - Cargo](./examples.md#rust---cargo)

18922
dist/restore/index.js vendored

File diff suppressed because one or more lines are too long

18923
dist/save/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,6 @@
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow) - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow)
- [Using pip to get cache location](#using-pip-to-get-cache-location) - [Using pip to get cache location](#using-pip-to-get-cache-location)
- [Using a script to get cache location](#using-a-script-to-get-cache-location) - [Using a script to get cache location](#using-a-script-to-get-cache-location)
- [Python - pipenv](#python---pipenv)
- [R - renv](#r---renv) - [R - renv](#r---renv)
- [Simple example](#simple-example-1) - [Simple example](#simple-example-1)
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow-1) - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow-1)
@ -100,9 +99,7 @@ steps:
```yaml ```yaml
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: | path: deps
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: | restore-keys: |
${{ runner.os }}-mix- ${{ runner.os }}-mix-
@ -142,7 +139,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
path: | path: |
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
``` ```
@ -197,13 +194,12 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
```yaml ```yaml
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache-dir id: npm-cache
run: | run: |
echo "::set-output name=dir::$(npm config get cache)" echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2 - uses: actions/cache@v2
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with: with:
path: ${{ steps.npm-cache-dir.outputs.dir }} path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-node- ${{ runner.os }}-node-
@ -348,31 +344,6 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
${{ runner.os }}-pip- ${{ runner.os }}-pip-
``` ```
### Multiple OS's in a workflow with a matrix
``` yaml
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
steps:
- uses: actions/cache@v2
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
```
### Using pip to get cache location ### Using pip to get cache location
> Note: This requires pip 20.1+ > Note: This requires pip 20.1+
@ -391,15 +362,21 @@ jobs:
${{ runner.os }}-pip- ${{ runner.os }}-pip-
``` ```
## Python - pipenv ### Using a script to get cache location
> Note: This uses an internal pip API and may not always work
```yaml ```yaml
- name: Get pip cache dir
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: ~/.local/share/virtualenvs path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pipenv- ${{ runner.os }}-pip-
``` ```
## R - renv ## R - renv
@ -453,18 +430,21 @@ Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
## Ruby - Bundler ## Ruby - Bundler
Caching gems with Bundler correctly is not trivial and just using `actions/cache` ```yaml
is [not enough](https://github.com/ruby/setup-ruby#caching-bundle-install-manually). - uses: actions/cache@v2
with:
Instead, it is recommended to use `ruby/setup-ruby`'s path: vendor/bundle
[`bundler-cache: true` option](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically) key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
whenever possible: restore-keys: |
${{ runner.os }}-gems-
```
When dependencies are installed later in the workflow, we must specify the same path for the bundler.
```yaml ```yaml
- uses: ruby/setup-ruby@v1 - name: Bundle install
with: run: |
ruby-version: ... bundle config path vendor/bundle
bundler-cache: true bundle install --jobs 4 --retry 3
``` ```
## Rust - Cargo ## Rust - Cargo

917
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "cache", "name": "cache",
"version": "2.1.5", "version": "2.1.3",
"private": true, "private": true,
"description": "Cache dependencies and build outputs", "description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js", "main": "dist/restore/index.js",
@ -23,29 +23,29 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^1.0.7", "@actions/core": "^1.2.0",
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/io": "^1.1.0" "@actions/io": "^1.0.1",
"@actions/cache": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^24.0.13", "@types/jest": "^24.0.13",
"@types/nock": "^11.1.0", "@types/nock": "^11.1.0",
"@types/node": "^12.20.7", "@types/node": "^12.0.4",
"@typescript-eslint/eslint-plugin": "^2.7.0", "@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0", "@typescript-eslint/parser": "^2.7.0",
"@zeit/ncc": "^0.20.5", "@zeit/ncc": "^0.20.5",
"eslint": "^6.6.0", "eslint": "^6.6.0",
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^6.5.0",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.20.0", "eslint-plugin-jest": "^23.0.3",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-simple-import-sort": "^5.0.2", "eslint-plugin-simple-import-sort": "^5.0.2",
"jest": "^24.8.0", "jest": "^24.8.0",
"jest-circus": "^24.7.1", "jest-circus": "^24.7.1",
"nock": "^11.7.0", "nock": "^11.7.0",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"ts-jest": "^26.5.4", "ts-jest": "^24.0.2",
"typescript": "^3.9.9" "typescript": "^3.7.3"
} }
} }

View File

@ -44,7 +44,6 @@ async function run(): Promise<void> {
await cache.saveCache(cachePaths, primaryKey, { await cache.saveCache(cachePaths, primaryKey, {
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
}); });
core.info(`Cache saved with key: ${primaryKey}`);
} catch (error) { } catch (error) {
if (error.name === cache.ValidationError.name) { if (error.name === cache.ValidationError.name) {
throw error; throw error;