31 Commits

Author SHA1 Message Date
Arpad Borsos
9c05405335 1.1.0 2020-12-07 23:58:20 +01:00
Arpad Borsos
08d3994b7a rebuild 2020-12-07 23:58:13 +01:00
Arpad Borsos
9e10a44ea3 support working-directory input, cleanup 2020-12-07 23:56:50 +01:00
Arpad Borsos
fb2efae33d update readme 2020-11-21 12:21:26 +01:00
Arpad Borsos
da5df52d2f update deps 2020-11-21 12:11:25 +01:00
Arpad Borsos
0eea7b85d4 update dependencies and rebuild 2020-11-07 10:22:23 +01:00
Arpad Borsos
645c6972a6 update to npm v7 lockfile 2020-10-21 09:43:08 +02:00
Arpad Borsos
6ccf2463db deal with uncaught exceptions 2020-10-21 09:32:47 +02:00
Arpad Borsos
9cc357c650 update dependencies 2020-10-21 09:00:54 +02:00
Arpad Borsos
9de90d2338 only pre-clean when something was restored 2020-10-13 14:01:46 +02:00
Arpad Borsos
292ef23e77 avoid error when saving without git dependencies 2020-10-13 13:52:55 +02:00
Arpad Borsos
5f6034beb8 improve log output 2020-10-06 12:57:42 +02:00
Arpad Borsos
b740ae5d3a clean and persist the git db/checkouts 2020-10-05 18:18:59 +02:00
Arpad Borsos
e8e3c57b3b merge all the caches and simplify 2020-10-03 18:39:38 +02:00
Arpad Borsos
f77cb1be47 merge the registry caches together 2020-10-03 18:10:54 +02:00
Arpad Borsos
2bcc375de8 key target by job id automatically 2020-10-03 17:33:09 +02:00
Arpad Borsos
bd4d2a7017 1.0.2 2020-09-29 12:30:45 +02:00
Arpad Borsos
d38127a85b Improve target pruning
fixes #1
2020-09-29 12:30:19 +02:00
Arpad Borsos
a4a1d8e7a6 1.0.1 2020-09-28 13:06:41 +02:00
Arpad Borsos
33677a20f2 add changelog 2020-09-28 12:53:56 +02:00
Arpad Borsos
1d1bff80c5 update readme 2020-09-28 12:51:40 +02:00
Arpad Borsos
08ca2ff969 make macos workaround silent 2020-09-28 12:46:36 +02:00
Arpad Borsos
ef89c3a8eb typo 2020-09-28 12:30:40 +02:00
Arpad Borsos
d45cd2b045 rebuild 2020-09-28 12:26:12 +02:00
Arpad Borsos
271ff4b692 log individual timings 2020-09-28 12:26:11 +02:00
Arpad Borsos
a6b59fa340 clean up exports 2020-09-28 12:14:11 +02:00
Arpad Borsos
e0c07d2a65 work around macos cache corruption 2020-09-28 12:08:11 +02:00
Arpad Borsos
06ff70612d remove git-db for now 2020-09-28 12:06:51 +02:00
Arpad Borsos
1304a2ec8d add ability to version caches 2020-09-28 12:00:58 +02:00
Arpad Borsos
cfcc373039 improve logging 2020-09-28 11:54:24 +02:00
Arpad Borsos
8902a8fc6c collect packages with --all-features 2020-09-28 11:44:06 +02:00
11 changed files with 8061 additions and 6319 deletions

18
CHANGELOG.md Normal file
View File

@@ -0,0 +1,18 @@
# Changelog
## 1.1.0
- Add a new `working-directory` input.
- Support caching git dependencies.
- Lots of other improvements.
## 1.0.2
- Dont prune targets that have a different name from the crate, but do prune targets from the workspace.
## 1.0.1
- Improved logging output.
- Make sure to consider `all-features` dependencies when pruning.
- Work around macOS cache corruption.
- Remove git-db cache for now.

View File

@@ -1,51 +1,57 @@
# Rust Cache Action # Rust Cache Action
A GitHub Action that implements smart caching for rust/cargo projects A GitHub Action that implements smart caching for rust/cargo projects with
sensible defaults.
## Inputs
- `key` - An optional key for the `target` cache. This is useful in case you
have different jobs for test / check / clippy, etc
## Example usage ## Example usage
```yaml ```yaml
- uses: Swatinem/rust-cache@v1 # selecting a toolchain either by action or manual `rustup` calls should happen
# before the plugin, as it uses the current rustc version as its cache key
- uses: actions-rs/toolchain@v1
with: with:
key: test profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
``` ```
## Specifics ## Inputs
This action tries to be better than just caching the following directories: : `key`
An optional key that is added to the automatic cache key.
``` : `working-directory`
~/.cargo/registry The working directory the action operates in, is case the cargo project is not
~/.cargo/git located in the repo root.
target
```
It disables incremental compilation and only caches dependencies. The ## Cache Details
assumption is that we will likely recompile the own crate(s) anyway.
It also separates the cache into 4 groups, each treated differently: The cache currently caches the following directories:
- Index: `~/.cargo/registry/index/<registry>`: - `~/.cargo/registry/index`
- `~/.cargo/registry/cache`
- `~/.cargo/git`
- `./target`
This is always restored from its latest snapshot, and persisted based on the This cache is automatically keyed by:
most recent revision.
- Registry / Cache: `~/.cargo/registry/cache/<registry>`: - the github `job`,
- the rustc release / host / hash, and
- a hash of the `Cargo.lock` / `Cargo.toml` files.
Automatically keyed by the lockfile/toml hash, and is being pruned to only An additional input `key` can be provided if the builtin keys are not sufficient.
persist the dependencies that are being used.
- Registry / Git: `~/.cargo/registry/git/<registry>`: Before persisting, the cache is cleaned of intermediate artifacts and
anything that is not a workspace dependency.
In particular, no caching of workspace crates will be done. For
this reason, this action will automatically set `CARGO_INCREMENTAL=0` to
disable incremental compilation.
Automatically keyed by the lockfile/toml hash. Pruning is still TODO. The action will try to restore from a previous `Cargo.lock` version as well, so
lockfile updates should only re-build changed dependencies.
- target: `./target` Additionally, the action automatically works around
[cargo#8603](https://github.com/rust-lang/cargo/issues/8603) /
Automatically keyed by the lockfile/toml hash, and is being pruned to only [actions/cache#403](https://github.com/actions/cache/issues/403) which would
persist the dependencies that are being used. This is especially throwing otherwise corrupt the cache on macOS builds.
away any intermediate artifacts.

View File

@@ -1,9 +1,12 @@
name: "Rust Cache" name: "Rust Cache"
description: "A GitHub Action that implements smart caching for rust/cargo projects" description: "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults."
author: "Arpad Borsos <arpad.borsos@googlemail.com>" author: "Arpad Borsos <arpad.borsos@googlemail.com>"
inputs: inputs:
key: key:
description: "An explicit key for restoring and saving the target cache" description: "An additional key for the cache"
required: false
working-directory:
description: "The working directory this action should operate in"
required: false required: false
runs: runs:
using: "node12" using: "node12"

6466
dist/restore/index.js vendored

File diff suppressed because it is too large Load Diff

6676
dist/save/index.js vendored

File diff suppressed because it is too large Load Diff

736
package-lock.json generated
View File

@@ -1,18 +1,614 @@
{ {
"name": "rust-cache", "name": "rust-cache",
"version": "1.0.0", "version": "1.1.0",
"lockfileVersion": 1, "lockfileVersion": 2,
"requires": true, "requires": true,
"dependencies": { "packages": {
"@actions/cache": { "": {
"version": "1.0.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.2.tgz", "license": "LGPL-3.0",
"integrity": "sha512-CzAseaJ4cKmOI58EIWUb/LfeYdM7Y25s39OEMtWAhEPrPPzrbSEjGHCLaYjJ0V8C4iojo8vBYh5B3OIJ37EiJw==", "dependencies": {
"requires": { "@actions/cache": "^1.0.4",
"@actions/core": "^1.2.4", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"@actions/glob": "^0.1.1",
"@actions/io": "^1.0.2"
},
"devDependencies": {
"@vercel/ncc": "^0.25.1",
"typescript": "^4.1.2"
},
"funding": {
"url": "https://github.com/sponsors/Swatinem"
}
},
"node_modules/@actions/cache": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.4.tgz",
"integrity": "sha512-1grYfbu8P6JDDHc40eOI5tQDRcAxMwq5HBWhaCqEg9o/ixDRZfwPHlQvQAop2ZzFCjF2ns0ENQOIBAH8GNn+zA==",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0", "@actions/glob": "^0.1.0",
"@actions/http-client": "^1.0.8", "@actions/http-client": "^1.0.9",
"@actions/io": "^1.0.1",
"@azure/ms-rest-js": "^2.0.7",
"@azure/storage-blob": "^12.1.2",
"semver": "^6.1.0",
"uuid": "^3.3.3"
}
},
"node_modules/@actions/core": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
},
"node_modules/@actions/exec": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
"integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==",
"dependencies": {
"@actions/io": "^1.0.1"
}
},
"node_modules/@actions/glob": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz",
"integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==",
"dependencies": {
"@actions/core": "^1.2.6",
"minimatch": "^3.0.4"
}
},
"node_modules/@actions/http-client": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz",
"integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==",
"dependencies": {
"tunnel": "0.0.6"
}
},
"node_modules/@actions/io": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
"integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg=="
},
"node_modules/@azure/abort-controller": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.1.tgz",
"integrity": "sha512-wP2Jw6uPp8DEDy0n4KNidvwzDjyVV2xnycEIq7nPzj1rHyb/r+t3OPeNT1INZePP2wy5ZqlwyuyOMTi0ePyY1A==",
"dependencies": {
"tslib": "^1.9.3"
}
},
"node_modules/@azure/core-asynciterator-polyfill": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0.tgz",
"integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg=="
},
"node_modules/@azure/core-auth": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.1.3.tgz",
"integrity": "sha512-A4xigW0YZZpkj1zK7dKuzbBpGwnhEcRk6WWuIshdHC32raR3EQ1j6VA9XZqE+RFsUgH6OAmIK5BWIz+mZjnd6Q==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.8",
"@opentelemetry/api": "^0.6.1",
"tslib": "^2.0.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-auth/node_modules/@azure/core-tracing": {
"version": "1.0.0-preview.8",
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.8.tgz",
"integrity": "sha512-ZKUpCd7Dlyfn7bdc+/zC/sf0aRIaNQMDuSj2RhYRFe3p70hVAnYGp3TX4cnG2yoEALp/LTj/XnZGQ8Xzf6Ja/Q==",
"dependencies": {
"@opencensus/web-types": "0.0.7",
"@opentelemetry/api": "^0.6.1",
"tslib": "^1.10.0"
}
},
"node_modules/@azure/core-auth/node_modules/@azure/core-tracing/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/@azure/core-auth/node_modules/@opentelemetry/api": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.6.1.tgz",
"integrity": "sha512-wpufGZa7tTxw7eAsjXJtiyIQ42IWQdX9iUQp7ACJcKo1hCtuhLU+K2Nv1U6oRwT1oAlZTE6m4CgWKZBhOiau3Q==",
"dependencies": {
"@opentelemetry/context-base": "^0.6.1"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-auth/node_modules/@opentelemetry/context-base": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.6.1.tgz",
"integrity": "sha512-5bHhlTBBq82ti3qPT15TRxkYTFPPQWbnkkQkmHPtqiS1XcTB69cEKd3Jm7Cfi/vkPoyxapmePE9tyA7EzLt8SQ==",
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-auth/node_modules/tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"node_modules/@azure/core-http": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.0.tgz",
"integrity": "sha512-SQmyI1tpstWKePNmTseEUp8PMq1uNBslvGBrYF2zNM/fEfLD1q64XCatoH8nDQtSmDydEPsqlyyLSjjnuXrlOQ==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-auth": "^1.1.3",
"@azure/core-tracing": "1.0.0-preview.9",
"@azure/logger": "^1.0.0",
"@opentelemetry/api": "^0.10.2",
"@types/node-fetch": "^2.5.0",
"@types/tunnel": "^0.0.1",
"form-data": "^3.0.0",
"node-fetch": "^2.6.0",
"process": "^0.11.10",
"tough-cookie": "^4.0.0",
"tslib": "^2.0.0",
"tunnel": "^0.0.6",
"uuid": "^8.3.0",
"xml2js": "^0.4.19"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-http/node_modules/form-data": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
"integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/@azure/core-http/node_modules/tough-cookie": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
"integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==",
"dependencies": {
"psl": "^1.1.33",
"punycode": "^2.1.1",
"universalify": "^0.1.2"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@azure/core-http/node_modules/tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"node_modules/@azure/core-http/node_modules/uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/@azure/core-lro": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-1.0.2.tgz",
"integrity": "sha512-Yr0JD7GKryOmbcb5wHCQoQ4KCcH5QJWRNorofid+UvudLaxnbCfvKh/cUfQsGUqRjO9L/Bw4X7FP824DcHdMxw==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^1.1.1",
"events": "^3.0.0",
"tslib": "^1.10.0"
}
},
"node_modules/@azure/core-paging": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.3.tgz",
"integrity": "sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A==",
"dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-tracing": {
"version": "1.0.0-preview.9",
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.9.tgz",
"integrity": "sha512-zczolCLJ5QG42AEPQ+Qg9SRYNUyB+yZ5dzof4YEc+dyWczO9G2sBqbAjLB7IqrsdHN2apkiB2oXeDKCsq48jug==",
"dependencies": {
"@opencensus/web-types": "0.0.7",
"@opentelemetry/api": "^0.10.2",
"tslib": "^2.0.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@azure/core-tracing/node_modules/tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"node_modules/@azure/logger": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.0.tgz",
"integrity": "sha512-g2qLDgvmhyIxR3JVS8N67CyIOeFRKQlX/llxYJQr1OSGQqM3HTpVP8MjmjcEKbL/OIt2N9C9UFaNQuKOw1laOA==",
"dependencies": {
"tslib": "^1.9.3"
}
},
"node_modules/@azure/ms-rest-js": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.1.0.tgz",
"integrity": "sha512-4BXLVImYRt+jcUmEJ5LUWglI8RBNVQndY6IcyvQ4U8O4kIXdmlRz3cJdA/RpXf5rKT38KOoTO2T6Z1f6Z1HDBg==",
"dependencies": {
"@types/node-fetch": "^2.3.7",
"@types/tunnel": "0.0.1",
"abort-controller": "^3.0.0",
"form-data": "^2.5.0",
"node-fetch": "^2.6.0",
"tough-cookie": "^3.0.1",
"tslib": "^1.10.0",
"tunnel": "0.0.6",
"uuid": "^3.3.2",
"xml2js": "^0.4.19"
}
},
"node_modules/@azure/storage-blob": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.3.0.tgz",
"integrity": "sha512-nCySzNfm782pEW3sg9GHj1zE4gBeVVMeEBdWb4MefifrCwQQOoz5cXZTNFiUJAJqAO+/72r2UjZcUwHk/QmzkA==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^1.2.0",
"@azure/core-lro": "^1.0.2",
"@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.9",
"@azure/logger": "^1.0.0",
"@opentelemetry/api": "^0.10.2",
"events": "^3.0.0",
"tslib": "^2.0.0"
}
},
"node_modules/@azure/storage-blob/node_modules/tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"node_modules/@opencensus/web-types": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@opencensus/web-types/-/web-types-0.0.7.tgz",
"integrity": "sha512-xB+w7ZDAu3YBzqH44rCmG9/RlrOmFuDPt/bpf17eJr8eZSrLt7nc7LnWdxM9Mmoj/YKMHpxRg28txu3TcpiL+g==",
"engines": {
"node": ">=6.0"
}
},
"node_modules/@opentelemetry/api": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.10.2.tgz",
"integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==",
"dependencies": {
"@opentelemetry/context-base": "^0.10.2"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@opentelemetry/context-base": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz",
"integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw==",
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@types/node": {
"version": "14.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.9.tgz",
"integrity": "sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw=="
},
"node_modules/@types/node-fetch": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz",
"integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==",
"dependencies": {
"@types/node": "*",
"form-data": "^3.0.0"
}
},
"node_modules/@types/node-fetch/node_modules/form-data": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
"integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/@types/tunnel": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz",
"integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@vercel/ncc": {
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.25.1.tgz",
"integrity": "sha512-dGecC5+1wLof1MQpey4+6i2KZv4Sfs6WfXkl9KfO32GED4ZPiKxRfvtGPjbjZv0IbqMl6CxtcV1RotXYfd5SSA==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"node_modules/balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
"engines": {
"node": ">=6"
}
},
"node_modules/events": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
"integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==",
"engines": {
"node": ">=0.8.x"
}
},
"node_modules/form-data": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 0.12"
}
},
"node_modules/ip-regex": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
"integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=",
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"dependencies": {
"mime-db": "1.44.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"engines": {
"node": "4.x || >=6.0.0"
}
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
},
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"engines": {
"node": ">=6"
}
},
"node_modules/sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/tough-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
"integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
"dependencies": {
"ip-regex": "^2.1.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/typescript": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
"integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
"engines": {
"node": ">=4.0"
}
}
},
"dependencies": {
"@actions/cache": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-1.0.4.tgz",
"integrity": "sha512-1grYfbu8P6JDDHc40eOI5tQDRcAxMwq5HBWhaCqEg9o/ixDRZfwPHlQvQAop2ZzFCjF2ns0ENQOIBAH8GNn+zA==",
"requires": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0",
"@actions/http-client": "^1.0.9",
"@actions/io": "^1.0.1", "@actions/io": "^1.0.1",
"@azure/ms-rest-js": "^2.0.7", "@azure/ms-rest-js": "^2.0.7",
"@azure/storage-blob": "^12.1.2", "@azure/storage-blob": "^12.1.2",
@@ -34,18 +630,18 @@
} }
}, },
"@actions/glob": { "@actions/glob": {
"version": "0.1.0", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz",
"integrity": "sha512-lx8SzyQ2FE9+UUvjqY1f28QbTJv+w8qP7kHHbfQRhphrlcx0Mdmm1tZdGJzfxv1jxREa/sLW4Oy8CbGQKCJySA==", "integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==",
"requires": { "requires": {
"@actions/core": "^1.2.0", "@actions/core": "^1.2.6",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
} }
}, },
"@actions/http-client": { "@actions/http-client": {
"version": "1.0.8", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz",
"integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", "integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==",
"requires": { "requires": {
"tunnel": "0.0.6" "tunnel": "0.0.6"
} }
@@ -90,9 +686,9 @@
}, },
"dependencies": { "dependencies": {
"tslib": { "tslib": {
"version": "1.13.0", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
} }
} }
}, },
@@ -104,17 +700,22 @@
"@opentelemetry/context-base": "^0.6.1" "@opentelemetry/context-base": "^0.6.1"
} }
}, },
"@opentelemetry/context-base": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.6.1.tgz",
"integrity": "sha512-5bHhlTBBq82ti3qPT15TRxkYTFPPQWbnkkQkmHPtqiS1XcTB69cEKd3Jm7Cfi/vkPoyxapmePE9tyA7EzLt8SQ=="
},
"tslib": { "tslib": {
"version": "2.0.1", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
} }
} }
}, },
"@azure/core-http": { "@azure/core-http": {
"version": "1.1.8", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.1.8.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.0.tgz",
"integrity": "sha512-hJ9ZblU99sY2dTD6U5EqZ5zjd0QmwwvSp8RYp2zS9s5mhsNobLQFI09bIE6yo891bOySCEepNCE5tL15dLYhIA==", "integrity": "sha512-SQmyI1tpstWKePNmTseEUp8PMq1uNBslvGBrYF2zNM/fEfLD1q64XCatoH8nDQtSmDydEPsqlyyLSjjnuXrlOQ==",
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-auth": "^1.1.3", "@azure/core-auth": "^1.1.3",
@@ -129,7 +730,7 @@
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"uuid": "^8.1.0", "uuid": "^8.3.0",
"xml2js": "^0.4.19" "xml2js": "^0.4.19"
}, },
"dependencies": { "dependencies": {
@@ -154,14 +755,14 @@
} }
}, },
"tslib": { "tslib": {
"version": "2.0.1", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
}, },
"uuid": { "uuid": {
"version": "8.3.0", "version": "8.3.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg=="
} }
} }
}, },
@@ -177,9 +778,9 @@
} }
}, },
"@azure/core-paging": { "@azure/core-paging": {
"version": "1.1.2", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.3.tgz",
"integrity": "sha512-6wZ+LrF8zwAuukvYsiff+uMNkVu9HZt8gRs/1o5377Cz9354y23QI7eZM0iwTfO38c8LZUSvzLJSqdM4T1QXxA==", "integrity": "sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A==",
"requires": { "requires": {
"@azure/core-asynciterator-polyfill": "^1.0.0" "@azure/core-asynciterator-polyfill": "^1.0.0"
} }
@@ -195,9 +796,9 @@
}, },
"dependencies": { "dependencies": {
"tslib": { "tslib": {
"version": "2.0.1", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
} }
} }
}, },
@@ -210,9 +811,9 @@
} }
}, },
"@azure/ms-rest-js": { "@azure/ms-rest-js": {
"version": "2.0.8", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.0.8.tgz", "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.1.0.tgz",
"integrity": "sha512-PO4pnYaF66IAB/RWbhrTprGyhOzDzsgcbT7z8k3O38JKlwifbrhW+8M0fzx0ScZnaacP8rZyBazYMUF9P12c0g==", "integrity": "sha512-4BXLVImYRt+jcUmEJ5LUWglI8RBNVQndY6IcyvQ4U8O4kIXdmlRz3cJdA/RpXf5rKT38KOoTO2T6Z1f6Z1HDBg==",
"requires": { "requires": {
"@types/node-fetch": "^2.3.7", "@types/node-fetch": "^2.3.7",
"@types/tunnel": "0.0.1", "@types/tunnel": "0.0.1",
@@ -227,12 +828,12 @@
} }
}, },
"@azure/storage-blob": { "@azure/storage-blob": {
"version": "12.2.1", "version": "12.3.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.2.1.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.3.0.tgz",
"integrity": "sha512-erqCSmDL8b/AHZi94nq+nCE+2whQmvBDkAv4N9uic0MRac/gRyZqnsqkfrun/gr2rZo+qVtnMenwkkE3roXn8Q==", "integrity": "sha512-nCySzNfm782pEW3sg9GHj1zE4gBeVVMeEBdWb4MefifrCwQQOoz5cXZTNFiUJAJqAO+/72r2UjZcUwHk/QmzkA==",
"requires": { "requires": {
"@azure/abort-controller": "^1.0.0", "@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^1.1.6", "@azure/core-http": "^1.2.0",
"@azure/core-lro": "^1.0.2", "@azure/core-lro": "^1.0.2",
"@azure/core-paging": "^1.1.1", "@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.9", "@azure/core-tracing": "1.0.0-preview.9",
@@ -243,9 +844,9 @@
}, },
"dependencies": { "dependencies": {
"tslib": { "tslib": {
"version": "2.0.1", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
} }
} }
}, },
@@ -260,24 +861,17 @@
"integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==", "integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==",
"requires": { "requires": {
"@opentelemetry/context-base": "^0.10.2" "@opentelemetry/context-base": "^0.10.2"
},
"dependencies": {
"@opentelemetry/context-base": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz",
"integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw=="
}
} }
}, },
"@opentelemetry/context-base": { "@opentelemetry/context-base": {
"version": "0.6.1", "version": "0.10.2",
"resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.6.1.tgz", "resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz",
"integrity": "sha512-5bHhlTBBq82ti3qPT15TRxkYTFPPQWbnkkQkmHPtqiS1XcTB69cEKd3Jm7Cfi/vkPoyxapmePE9tyA7EzLt8SQ==" "integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw=="
}, },
"@types/node": { "@types/node": {
"version": "14.11.2", "version": "14.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.9.tgz",
"integrity": "sha512-jiE3QIxJ8JLNcb1Ps6rDbysDhN4xa8DJJvuC9prr6w+1tIh+QAbYyNF3tyiZNLDBIuBCf4KEcV2UvQm/V60xfA==" "integrity": "sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw=="
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.5.7", "version": "2.5.7",
@@ -309,9 +903,9 @@
} }
}, },
"@vercel/ncc": { "@vercel/ncc": {
"version": "0.24.1", "version": "0.25.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.1.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.25.1.tgz",
"integrity": "sha512-r9m7brz2hNmq5TF3sxrK4qR/FhXn44XIMglQUir4sT7Sh5GOaYXlMYikHFwJStf8rmQGTlvOoBXt4yHVonRG8A==", "integrity": "sha512-dGecC5+1wLof1MQpey4+6i2KZv4Sfs6WfXkl9KfO32GED4ZPiKxRfvtGPjbjZv0IbqMl6CxtcV1RotXYfd5SSA==",
"dev": true "dev": true
}, },
"abort-controller": { "abort-controller": {
@@ -446,9 +1040,9 @@
} }
}, },
"tslib": { "tslib": {
"version": "1.13.0", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"tunnel": { "tunnel": {
"version": "0.0.6", "version": "0.0.6",
@@ -456,9 +1050,9 @@
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
}, },
"typescript": { "typescript": {
"version": "4.0.3", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
"integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==", "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
"dev": true "dev": true
}, },
"universalify": { "universalify": {

View File

@@ -1,8 +1,8 @@
{ {
"private": true, "private": true,
"name": "rust-cache", "name": "rust-cache",
"version": "1.0.0", "version": "1.1.0",
"description": "A GitHub Action that implements smart caching for rust/cargo projects", "description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
"keywords": [ "keywords": [
"actions", "actions",
"rust", "rust",
@@ -17,20 +17,22 @@
"bugs": { "bugs": {
"url": "https://github.com/Swatinem/rust-cache/issues" "url": "https://github.com/Swatinem/rust-cache/issues"
}, },
"funding": "https://github.com/sponsors/Swatinem", "funding": {
"url": "https://github.com/sponsors/Swatinem"
},
"homepage": "https://github.com/Swatinem/rust-cache#readme", "homepage": "https://github.com/Swatinem/rust-cache#readme",
"dependencies": { "dependencies": {
"@actions/cache": "^1.0.2", "@actions/cache": "^1.0.4",
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/glob": "^0.1.0", "@actions/glob": "^0.1.1",
"@actions/io": "^1.0.2" "@actions/io": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.24.1", "@vercel/ncc": "^0.25.1",
"typescript": "^4.0.3" "typescript": "^4.1.2"
}, },
"scripts": { "scripts": {
"prepare": "ncc build -o dist/restore src/restore.ts && ncc build -o dist/save src/save.ts" "prepare": "ncc build --target es2020 -o dist/restore src/restore.ts && ncc build --target es2020 -o dist/save src/save.ts"
} }
} }

View File

@@ -1,30 +1,36 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as exec from "@actions/exec"; import * as exec from "@actions/exec";
import * as glob from "@actions/glob"; import * as glob from "@actions/glob";
import * as io from "@actions/io";
import crypto from "crypto"; import crypto from "crypto";
import fs from "fs"; import fs from "fs";
import os from "os"; import os from "os";
import path from "path"; import path from "path";
process.on("uncaughtException", (e) => {
core.info(`[warning] ${e.message}`);
});
const cwd = core.getInput("working-directory");
if (cwd) {
process.chdir(cwd);
}
export const stateKey = "RUST_CACHE_KEY";
const stateHash = "RUST_CACHE_HASH";
const home = os.homedir(); const home = os.homedir();
export const paths = { export const paths = {
index: path.join(home, ".cargo/registry/index"), index: path.join(home, ".cargo/registry/index"),
cache: path.join(home, ".cargo/registry/cache"), cache: path.join(home, ".cargo/registry/cache"),
git: path.join(home, ".cargo/git/db"), git: path.join(home, ".cargo/git"),
target: "target", target: "target",
}; };
export interface CacheConfig { interface CacheConfig {
path: string; paths: Array<string>;
key: string; key: string;
restoreKeys?: Array<string>; restoreKeys: Array<string>;
}
export interface Caches {
index: CacheConfig;
cache: CacheConfig;
git: CacheConfig;
target: CacheConfig;
} }
const RefKey = "GITHUB_REF"; const RefKey = "GITHUB_REF";
@@ -33,32 +39,37 @@ export function isValidEvent(): boolean {
return RefKey in process.env && Boolean(process.env[RefKey]); return RefKey in process.env && Boolean(process.env[RefKey]);
} }
export async function getCaches(): Promise<Caches> { export async function getCacheConfig(): Promise<CacheConfig> {
const rustKey = await getRustKey(); let lockHash = core.getState(stateHash);
let lockHash = core.getState("lockHash");
if (!lockHash) { if (!lockHash) {
lockHash = await getLockfileHash(); lockHash = await getLockfileHash();
core.saveState("lockHash", lockHash); core.saveState(stateHash, lockHash);
} }
let targetKey = core.getInput("key");
if (targetKey) { let key = `v0-rust-`;
targetKey = `${targetKey}-`;
let inputKey = core.getInput("key");
if (inputKey) {
key += `${inputKey}-`;
} }
const job = process.env.GITHUB_JOB;
if (job) {
key += `${job}-`;
}
key += await getRustKey();
return { return {
index: { path: paths.index, key: "registry-index-XXX", restoreKeys: ["registry-index"] }, paths: [paths.index, paths.cache, paths.git, paths.target],
cache: { path: paths.cache, key: `registry-cache-${lockHash}`, restoreKeys: ["registry-cache"] }, key: `${key}-${lockHash}`,
git: { path: paths.git, key: "git-db" }, restoreKeys: [key],
target: {
path: paths.target,
key: `target-${targetKey}${rustKey}-${lockHash}`,
restoreKeys: [`target-${targetKey}${rustKey}`],
},
}; };
} }
export async function getRustKey(): Promise<string> { async function getRustKey(): Promise<string> {
const rustc = await getRustVersion(); const rustc = await getRustVersion();
return `${rustc.release}-${rustc.host}-${rustc["commit-hash"]}`; return `${rustc.release}-${rustc.host}-${rustc["commit-hash"].slice(0, 12)}`;
} }
interface RustVersion { interface RustVersion {
@@ -67,7 +78,7 @@ interface RustVersion {
"commit-hash": string; "commit-hash": string;
} }
export async function getRustVersion(): Promise<RustVersion> { async function getRustVersion(): Promise<RustVersion> {
const stdout = await getCmdOutput("rustc", ["-vV"]); const stdout = await getCmdOutput("rustc", ["-vV"]);
let splits = stdout let splits = stdout
.split(/[\n\r]+/) .split(/[\n\r]+/)
@@ -95,21 +106,7 @@ export async function getCmdOutput(
return stdout; return stdout;
} }
export async function getRegistryName() { async function getLockfileHash(): Promise<string> {
const globber = await glob.create(`${paths.index}/**/.last-updated`, { followSymbolicLinks: false });
const files = await globber.glob();
if (files.length > 1) {
core.debug(`got multiple registries: "${files.join('", "')}"`);
}
const first = files.shift();
if (!first) {
return;
}
return path.basename(path.dirname(first));
}
export async function getLockfileHash() {
const globber = await glob.create("**/Cargo.toml\n**/Cargo.lock", { followSymbolicLinks: false }); const globber = await glob.create("**/Cargo.toml\n**/Cargo.lock", { followSymbolicLinks: false });
const files = await globber.glob(); const files = await globber.glob();
files.sort((a, b) => a.localeCompare(b)); files.sort((a, b) => a.localeCompare(b));
@@ -120,5 +117,97 @@ export async function getLockfileHash() {
hasher.update(chunk); hasher.update(chunk);
} }
} }
return hasher.digest("hex"); return hasher.digest("hex").slice(0, 20);
}
export interface PackageDefinition {
name: string;
version: string;
path: string;
targets: Array<string>;
}
export type Packages = Array<PackageDefinition>;
interface Meta {
packages: Array<{
name: string;
version: string;
manifest_path: string;
targets: Array<{ kind: Array<string>; name: string }>;
}>;
}
export async function getPackages(): Promise<Packages> {
const cwd = process.cwd();
const meta: Meta = JSON.parse(await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1"]));
return meta.packages
.filter((p) => !p.manifest_path.startsWith(cwd))
.map((p) => {
const targets = p.targets.filter((t) => t.kind[0] === "lib").map((t) => t.name);
return { name: p.name, version: p.version, targets, path: path.dirname(p.manifest_path) };
});
}
export async function cleanTarget(packages: Packages) {
await fs.promises.unlink("./target/.rustc_info.json");
await io.rmRF("./target/debug/examples");
await io.rmRF("./target/debug/incremental");
let dir: fs.Dir;
// remove all *files* from debug
dir = await fs.promises.opendir("./target/debug");
for await (const dirent of dir) {
if (dirent.isFile()) {
await rm(dir.path, dirent);
}
}
const keepPkg = new Set(packages.map((p) => p.name));
await rmExcept("./target/debug/build", keepPkg);
await rmExcept("./target/debug/.fingerprint", keepPkg);
const keepDeps = new Set(
packages.flatMap((p) => {
const names = [];
for (const n of [p.name, ...p.targets]) {
const name = n.replace(/-/g, "_");
names.push(name, `lib${name}`);
}
return names;
}),
);
await rmExcept("./target/debug/deps", keepDeps);
}
const oneWeek = 7 * 24 * 3600 * 1000;
export async function rmExcept(dirName: string, keepPrefix: Set<string>) {
const dir = await fs.promises.opendir(dirName);
for await (const dirent of dir) {
let name = dirent.name;
const idx = name.lastIndexOf("-");
if (idx !== -1) {
name = name.slice(0, idx);
}
const fileName = path.join(dir.path, dirent.name);
const { mtime } = await fs.promises.stat(fileName);
// we dont really know
if (!keepPrefix.has(name) || Date.now() - mtime.getTime() > oneWeek) {
await rm(dir.path, dirent);
}
}
}
export async function rm(parent: string, dirent: fs.Dirent) {
try {
const fileName = path.join(parent, dirent.name);
core.debug(`deleting "${fileName}"`);
if (dirent.isFile()) {
await fs.promises.unlink(fileName);
} else if (dirent.isDirectory()) {
await io.rmRF(fileName);
}
} catch {}
} }

View File

@@ -1,31 +1,28 @@
import * as cache from "@actions/cache"; import * as cache from "@actions/cache";
import * as core from "@actions/core"; import * as core from "@actions/core";
import { getCaches, isValidEvent } from "./common"; import { cleanTarget, getCacheConfig, getPackages, stateKey } from "./common";
async function run() { async function run() {
if (!isValidEvent()) {
return;
}
try { try {
core.exportVariable("CARGO_INCREMENTAL", 0); core.exportVariable("CARGO_INCREMENTAL", 0);
const caches = await getCaches(); const { paths, key, restoreKeys } = await getCacheConfig();
for (const [name, { path, key, restoreKeys }] of Object.entries(caches)) {
try { core.info(`Restoring paths:\n ${paths.join("\n ")}`);
core.startGroup(`Restoring "${path}" from "${key}"…`); core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
const restoreKey = await cache.restoreCache([path], key, restoreKeys); const restoreKey = await cache.restoreCache(paths, key, restoreKeys);
if (restoreKey) { if (restoreKey) {
core.info(`Restored "${path}" from cache key "${restoreKey}".`); core.info(`Restored from cache key "${restoreKey}".`);
core.saveState(name, restoreKey); core.saveState(stateKey, restoreKey);
} else {
core.info("No cache found."); if (restoreKey !== key) {
} // pre-clean the target directory on cache mismatch
} catch (e) { const packages = await getPackages();
core.info(`[warning] ${e.message}`);
} finally { await cleanTarget(packages);
core.endGroup();
} }
} else {
core.info("No cache found.");
} }
} catch (e) { } catch (e) {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);

View File

@@ -1,49 +1,42 @@
import * as cache from "@actions/cache"; import * as cache from "@actions/cache";
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as glob from "@actions/glob";
import * as io from "@actions/io"; import * as io from "@actions/io";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { getCaches, getCmdOutput, getRegistryName, isValidEvent, paths } from "./common"; import { cleanTarget, getCacheConfig, getPackages, Packages, paths, rm, stateKey } from "./common";
async function run() { async function run() {
if (!isValidEvent()) {
//return;
}
try { try {
const caches = await getCaches(); const { paths: savePaths, key } = await getCacheConfig();
if (core.getState(stateKey) === key) {
core.info(`Cache up-to-date.`);
return;
}
// TODO: remove this once https://github.com/actions/toolkit/pull/553 lands
await macOsWorkaround();
const registryName = await getRegistryName(); const registryName = await getRegistryName();
const packages = await getPackages(); const packages = await getPackages();
await pruneTarget(packages); try {
if (registryName) { await cleanRegistry(registryName, packages);
// save the index based on its revision } catch {}
const indexRef = await getIndexRef(registryName);
caches.index.key = `registry-index-${indexRef}`;
await io.rmRF(path.join(paths.index, registryName, ".cache"));
await pruneRegistryCache(registryName, packages); try {
} else { await cleanGit(packages);
delete (caches as any).index; } catch {}
delete (caches as any).cache;
}
for (const [name, { path, key }] of Object.entries(caches)) { try {
if (core.getState(name) === key) { await cleanTarget(packages);
core.info(`Cache for "${path}" up-to-date.`); } catch {}
continue;
} core.info(`Saving paths:\n ${savePaths.join("\n ")}`);
try { core.info(`Using key "${key}".`);
core.startGroup(`Saving "${path}" to cache key "${key}"…`); await cache.saveCache(savePaths, key);
if (await cache.saveCache([path], key)) {
core.info(`Saved "${path}" to cache key "${key}".`);
}
} catch (e) {
core.info(`[warning] ${e.message}`);
} finally {
core.endGroup();
}
}
} catch (e) { } catch (e) {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);
} }
@@ -51,83 +44,83 @@ async function run() {
run(); run();
async function getIndexRef(registryName: string) { async function getRegistryName(): Promise<string> {
const cwd = path.join(paths.index, registryName); const globber = await glob.create(`${paths.index}/**/.last-updated`, { followSymbolicLinks: false });
return (await getCmdOutput("git", ["rev-parse", "--short", "origin/master"], { cwd })).trim(); const files = await globber.glob();
if (files.length > 1) {
core.warning(`got multiple registries: "${files.join('", "')}"`);
}
const first = files.shift()!;
return path.basename(path.dirname(first));
} }
interface PackageDefinition { async function cleanRegistry(registryName: string, packages: Packages) {
name: string; await io.rmRF(path.join(paths.index, registryName, ".cache"));
version: string;
}
type Packages = Array<PackageDefinition>;
async function getPackages(): Promise<Packages> {
const meta = JSON.parse(await getCmdOutput("cargo", ["metadata", "--format-version", "1"]));
return meta.packages.map(({ name, version }: any) => ({ name, version }));
}
async function pruneRegistryCache(registryName: string, packages: Packages) {
const pkgSet = new Set(packages.map((p) => `${p.name}-${p.version}.crate`)); const pkgSet = new Set(packages.map((p) => `${p.name}-${p.version}.crate`));
const dir = await fs.promises.opendir(path.join(paths.cache, registryName)); const dir = await fs.promises.opendir(path.join(paths.cache, registryName));
for await (const dirent of dir) { for await (const dirent of dir) {
if (dirent.isFile() && !pkgSet.has(dirent.name)) { if (dirent.isFile() && !pkgSet.has(dirent.name)) {
const fileName = path.join(dir.path, dirent.name); await rm(dir.path, dirent);
await fs.promises.unlink(fileName);
core.debug(`deleting "${fileName}"`);
} }
} }
} }
async function pruneTarget(packages: Packages) { async function cleanGit(packages: Packages) {
await fs.promises.unlink("./target/.rustc_info.json"); const coPath = path.join(paths.git, "checkouts");
await io.rmRF("./target/debug/examples"); const dbPath = path.join(paths.git, "db");
await io.rmRF("./target/debug/incremental"); const repos = new Map<string, Set<string>>();
for (const p of packages) {
if (!p.path.startsWith(coPath)) {
continue;
}
const [repo, ref] = p.path.slice(coPath.length + 1).split(path.sep);
const refs = repos.get(repo);
if (refs) {
refs.add(ref);
} else {
repos.set(repo, new Set([ref]));
}
}
// we have to keep both the clone, and the checkout, removing either will
// trigger a rebuild
let dir: fs.Dir; let dir: fs.Dir;
// clean the db
// remove all *files* from debug dir = await fs.promises.opendir(dbPath);
dir = await fs.promises.opendir("./target/debug");
for await (const dirent of dir) { for await (const dirent of dir) {
if (dirent.isFile()) { if (!repos.has(dirent.name)) {
const fileName = path.join(dir.path, dirent.name); await rm(dir.path, dirent);
await fs.promises.unlink(fileName);
} }
} }
const keepPkg = new Set(packages.map((p) => p.name)); // clean the checkouts
await rmExcept("./target/debug/build", keepPkg); dir = await fs.promises.opendir(coPath);
await rmExcept("./target/debug/.fingerprint", keepPkg);
const keepDeps = new Set(
packages.flatMap((p) => {
const name = p.name.replace(/-/g, "_");
return [name, `lib${name}`];
}),
);
await rmExcept("./target/debug/deps", keepDeps);
}
const twoWeeks = 14 * 24 * 3600 * 1000;
async function rmExcept(dirName: string, keepPrefix: Set<string>) {
const dir = await fs.promises.opendir(dirName);
for await (const dirent of dir) { for await (const dirent of dir) {
let name = dirent.name; const refs = repos.get(dirent.name);
const idx = name.lastIndexOf("-"); if (!refs) {
if (idx !== -1) { await rm(dir.path, dirent);
name = name.slice(0, idx); continue;
} }
const fileName = path.join(dir.path, dirent.name); if (!dirent.isDirectory()) {
const { mtime } = await fs.promises.stat(fileName); continue;
if (!keepPrefix.has(name) || Date.now() - mtime.getTime() > twoWeeks) { }
core.debug(`deleting "${fileName}"`); const refsDir = await fs.promises.opendir(path.join(dir.path, dirent.name));
if (dirent.isFile()) { for await (const dirent of refsDir) {
await fs.promises.unlink(fileName); if (!refs.has(dirent.name)) {
} else if (dirent.isDirectory()) { await rm(refsDir.path, dirent);
await io.rmRF(fileName);
} }
} }
} }
} }
async function macOsWorkaround() {
try {
// Workaround for https://github.com/actions/cache/issues/403
// Also see https://github.com/rust-lang/cargo/issues/8603
await exec.exec("sudo", ["/usr/sbin/purge"], { silent: true });
} catch {}
}

View File

@@ -4,7 +4,7 @@
"diagnostics": true, "diagnostics": true,
"lib": ["esnext"], "lib": ["esnext"],
"target": "es2017", "target": "es2020",
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "node", "moduleResolution": "node",