Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6720f05bc4 | ||
|
|
5733786579 | ||
|
|
622616010e | ||
|
|
0497f9301f | ||
|
|
7b8626742a | ||
|
|
911d8e9e55 | ||
|
|
875be5ce2d | ||
|
|
07a2ee71bc | ||
|
|
7c190ef171 | ||
|
|
fffd6895b2 | ||
|
|
86bae2494f | ||
|
|
827b33fbd0 | ||
|
|
36af5cb1ae | ||
|
|
cb43a50800 | ||
|
|
f6e3aa3e12 | ||
|
|
11be10514b | ||
|
|
e1846a926d | ||
|
|
6ed4c28a7c | ||
|
|
5df06440c6 | ||
|
|
3fedbbb115 | ||
|
|
fc84c9d9a3 | ||
|
|
260a713186 | ||
|
|
fa61956921 | ||
|
|
81d053bdb0 | ||
|
|
5040f39404 | ||
|
|
2055a01dcd | ||
|
|
cb2cf0cc7c | ||
|
|
74e8e24b6d | ||
|
|
f8f67b7515 | ||
|
|
5b2b053862 | ||
|
|
3bb3a9a087 | ||
|
|
d127014599 | ||
|
|
801365cd81 | ||
|
|
c5ed9ba6b7 | ||
|
|
536c94f32c | ||
|
|
842ef286ff | ||
|
|
1b344a0a23 | ||
|
|
31c41a926e | ||
|
|
ebd95456c3 | ||
|
|
3b8bbcb11d | ||
|
|
f82d41bcc2 | ||
|
|
063471b9dd | ||
|
|
ce325b6065 | ||
|
|
da42bbe56d | ||
|
|
a9bca6b5a6 | ||
|
|
b17d52110e | ||
|
|
b495963495 | ||
|
|
83aad8d470 | ||
|
|
958028d559 | ||
|
|
27793b3b80 | ||
|
|
be44a3e6ff | ||
|
|
2639a56bb8 | ||
|
|
cbcc887094 | ||
|
|
ae893481e8 | ||
|
|
d7bda0e369 | ||
|
|
9c05405335 | ||
|
|
08d3994b7a | ||
|
|
9e10a44ea3 | ||
|
|
fb2efae33d | ||
|
|
da5df52d2f | ||
|
|
0eea7b85d4 | ||
|
|
645c6972a6 | ||
|
|
6ccf2463db | ||
|
|
9cc357c650 | ||
|
|
9de90d2338 | ||
|
|
292ef23e77 | ||
|
|
5f6034beb8 | ||
|
|
b740ae5d3a | ||
|
|
e8e3c57b3b | ||
|
|
f77cb1be47 | ||
|
|
2bcc375de8 |
30
.github/workflows/coverage.yml
vendored
Normal file
30
.github/workflows/coverage.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: coverage
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
coverage:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test `cargo-llvm-cov` on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview
|
||||||
|
|
||||||
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
|
||||||
|
- run: cargo llvm-cov --all-features --workspace
|
||||||
|
working-directory: tests
|
||||||
25
.github/workflows/install.yml
vendored
Normal file
25
.github/workflows/install.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: install
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test `cargo install` on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
|
||||||
|
- run: cargo install cargo-deny --locked
|
||||||
30
.github/workflows/simple.yml
vendored
Normal file
30
.github/workflows/simple.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: simple
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
simple:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test `cargo check/test` on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cargo check
|
||||||
|
cargo test
|
||||||
|
working-directory: tests
|
||||||
33
.github/workflows/sparse-registry.yml
vendored
Normal file
33
.github/workflows/sparse-registry.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: sparse-registry
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sparse-registry:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test `cargo check/test` with sparse registry on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
CARGO_UNSTABLE_SPARSE_REGISTRY: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
rustup toolchain install nightly --profile minimal
|
||||||
|
rustup default nightly
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cargo check
|
||||||
|
cargo test
|
||||||
|
working-directory: tests
|
||||||
29
.github/workflows/target-dir.yml
vendored
Normal file
29
.github/workflows/target-dir.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: target-dir
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
target-dir:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test custom target-dir on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal
|
||||||
|
|
||||||
|
# the `workspaces` option has the format `$workspace -> $target-dir`
|
||||||
|
# and the `$target-dir` is relative to the `$workspace`.
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests -> ../custom-target-dir
|
||||||
|
|
||||||
|
- run: cargo test --manifest-path tests/Cargo.toml --target-dir custom-target-dir
|
||||||
33
.github/workflows/workspaces.yml
vendored
Normal file
33
.github/workflows/workspaces.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: workspaces
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
workspaces:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test multiple workspaces on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: |
|
||||||
|
tests
|
||||||
|
tests/wasm-workspace
|
||||||
|
|
||||||
|
- run: cargo check
|
||||||
|
working-directory: tests
|
||||||
|
|
||||||
|
- run: cargo check
|
||||||
|
working-directory: tests/wasm-workspace
|
||||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1 +1,8 @@
|
|||||||
node_modules
|
node_modules/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Mac
|
||||||
|
.DS_Store
|
||||||
|
|||||||
31
CHANGELOG.md
31
CHANGELOG.md
@@ -1,5 +1,36 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.0.0
|
||||||
|
|
||||||
|
- The action code was refactored to allow for caching multiple workspaces and
|
||||||
|
different `target` directory layouts.
|
||||||
|
- The `working-directory` and `target-dir` input options were replaced by a
|
||||||
|
single `workspaces` option that has the form of `$workspace -> $target`.
|
||||||
|
- Support for considering `env-vars` as part of the cache key.
|
||||||
|
- The `sharedKey` input option was renamed to `shared-key` for consistency.
|
||||||
|
|
||||||
|
## 1.4.0
|
||||||
|
|
||||||
|
- Clean both `debug` and `release` target directories.
|
||||||
|
|
||||||
|
## 1.3.0
|
||||||
|
|
||||||
|
- Use Rust toolchain file as additional cache key.
|
||||||
|
- Allow for a configurable target-dir.
|
||||||
|
|
||||||
|
## 1.2.0
|
||||||
|
|
||||||
|
- Cache `~/.cargo/bin`.
|
||||||
|
- Support for custom `$CARGO_HOME`.
|
||||||
|
- Add a `cache-hit` output.
|
||||||
|
- Add a new `sharedKey` option that overrides the automatic job-name based key.
|
||||||
|
|
||||||
|
## 1.1.0
|
||||||
|
|
||||||
|
- Add a new `working-directory` input.
|
||||||
|
- Support caching git dependencies.
|
||||||
|
- Lots of other improvements.
|
||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
- Don’t prune targets that have a different name from the crate, but do prune targets from the workspace.
|
- Don’t prune targets that have a different name from the crate, but do prune targets from the workspace.
|
||||||
|
|||||||
165
LICENSE
Normal file
165
LICENSE
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
152
README.md
152
README.md
@@ -1,47 +1,143 @@
|
|||||||
# 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
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# selecting a toolchain either by action or manual `rustup` calls should happen
|
||||||
|
# before the plugin, as the cache uses the current rustc version as its cache key
|
||||||
|
- run: rustup toolchain install stable --profile minimal
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
key: test
|
# An explicit cache key that is used instead of the automatic `job`-based
|
||||||
|
# cache key and is thus stable across jobs.
|
||||||
|
# Default: empty
|
||||||
|
shared-key: ""
|
||||||
|
|
||||||
|
# An additional cache key that is added alongside the automatic `job`-based
|
||||||
|
# cache key and can be used to further differentiate jobs.
|
||||||
|
# Default: empty
|
||||||
|
key: ""
|
||||||
|
|
||||||
|
# A whitespace separated list of env-var *prefixes* who's value contributes
|
||||||
|
# to the environment cache key.
|
||||||
|
# The env-vars are matched by *prefix*, so the default `RUST` var will
|
||||||
|
# match all of `RUSTC`, `RUSTUP_*`, `RUSTFLAGS`, `RUSTDOC_*`, etc.
|
||||||
|
# Default: "CARGO CC CFLAGS CXX CMAKE RUST"
|
||||||
|
env-vars: ""
|
||||||
|
|
||||||
|
# The cargo workspaces and target directory configuration.
|
||||||
|
# These entries are separated by newlines and have the form
|
||||||
|
# `$workspace -> $target`. The `$target` part is treated as a directory
|
||||||
|
# relative to the `$workspace` and defaults to "target" if not explicitly given.
|
||||||
|
# Default: ". -> target"
|
||||||
|
workspaces: ""
|
||||||
|
|
||||||
|
# Determines if the cache should be saved even when the workflow has failed.
|
||||||
|
# Default: "false"
|
||||||
|
cache-on-failure: ""
|
||||||
```
|
```
|
||||||
|
|
||||||
## Specifics
|
Further examples are available in the [.github/workflows][] directory.
|
||||||
|
|
||||||
This action tries to be better than just caching the following directories:
|
## Outputs
|
||||||
|
|
||||||
```
|
**`cache-hit`**
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
```
|
|
||||||
|
|
||||||
It disables incremental compilation and only caches dependencies. The
|
This is a boolean flag that will be set to `true` when there was an exact cache hit.
|
||||||
assumption is that we will likely recompile the own crate(s) anyway.
|
|
||||||
|
|
||||||
It also separates the cache into 4 groups, each treated differently:
|
## Cache Effectiveness
|
||||||
|
|
||||||
- Registry Index: `~/.cargo/registry/index/<registry>`:
|
This action only caches the _dependencies_ of a crate, so is more effective if
|
||||||
|
the dependency / own code ratio is higher.
|
||||||
|
|
||||||
This is always restored from its latest snapshot, and persisted based on the
|
It is also most effective for repositories with a `Cargo.lock` file. Library
|
||||||
most recent revision.
|
repositories with only a `Cargo.toml` file have limited benefits, as cargo will
|
||||||
|
_always_ use the most up-to-date dependency versions, which may not be cached.
|
||||||
|
|
||||||
- Registry Cache: `~/.cargo/registry/cache/<registry>`:
|
Usage with Stable Rust is most effective, as a cache is tied to the Rust version.
|
||||||
|
Using it with Nightly Rust is less effective as it will throw away the cache every day.
|
||||||
|
|
||||||
Automatically keyed by the lockfile/toml hash, and is being pruned to only
|
## Versioning
|
||||||
persist the dependencies that are being used.
|
|
||||||
|
|
||||||
- target: `./target`
|
I use the `v1` branch similar to `master` development, so if you want to have
|
||||||
|
a more stable experience, please use a fixed revision or tag.
|
||||||
|
|
||||||
Automatically keyed by the lockfile/toml hash, and is being pruned to only
|
## Cache Details
|
||||||
persist the dependencies that are being used. This is especially throwing
|
|
||||||
away any intermediate artifacts.
|
This action currently caches the following files/directories:
|
||||||
|
|
||||||
|
- `~/.cargo` (installed binaries, the cargo registry, cache, and git dependencies)
|
||||||
|
- `./target` (build artifacts of dependencies)
|
||||||
|
|
||||||
|
This cache is automatically keyed by:
|
||||||
|
|
||||||
|
- the github [`job_id`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_id),
|
||||||
|
- the rustc release / host / hash,
|
||||||
|
- the value of some compiler-specific environment variables (eg. RUSTFLAGS, etc), and
|
||||||
|
- a hash of all `Cargo.lock` / `Cargo.toml` files found anywhere in the repository (if present).
|
||||||
|
- a hash of all `rust-toolchain` / `rust-toolchain.toml` files in the root of the repository (if present).
|
||||||
|
|
||||||
|
An additional input `key` can be provided if the builtin keys are not sufficient.
|
||||||
|
|
||||||
|
Before being persisted, the cache is cleaned of:
|
||||||
|
|
||||||
|
- Any files in `~/.cargo/bin` that were present before the action ran (for example `rustc`).
|
||||||
|
- Dependencies that are no longer used.
|
||||||
|
- Anything that is not a dependency.
|
||||||
|
- Incremental build artifacts.
|
||||||
|
- Any build artifacts with an `mtime` older than one week.
|
||||||
|
|
||||||
|
In particular, the workspace crates themselves are not cached since doing so is
|
||||||
|
[generally not effective](https://github.com/Swatinem/rust-cache/issues/37#issuecomment-944697938).
|
||||||
|
For this reason, this action automatically sets `CARGO_INCREMENTAL=0` to disable
|
||||||
|
incremental compilation, so that the Rust compiler doesn't waste time creating
|
||||||
|
the additional artifacts required for incremental builds.
|
||||||
|
|
||||||
|
The `~/.cargo/registry/src` directory is not cached since it is quicker for Cargo
|
||||||
|
to recreate it from the compressed crate archives in `~/.cargo/registry/cache`.
|
||||||
|
|
||||||
|
The action will try to restore from a previous `Cargo.lock` version as well, so
|
||||||
|
lockfile updates should only re-build changed dependencies.
|
||||||
|
|
||||||
|
The action invokes `cargo metadata` to determine the current set of dependencies.
|
||||||
|
|
||||||
|
Additionally, the action automatically works around
|
||||||
|
[cargo#8603](https://github.com/rust-lang/cargo/issues/8603) /
|
||||||
|
[actions/cache#403](https://github.com/actions/cache/issues/403) which would
|
||||||
|
otherwise corrupt the cache on macOS builds.
|
||||||
|
|
||||||
|
## Cache Limits and Control
|
||||||
|
|
||||||
|
This specialized cache action is built on top of the upstream cache action
|
||||||
|
maintained by GitHub. The same restrictions and limits apply, which are
|
||||||
|
documented here:
|
||||||
|
https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
|
||||||
|
|
||||||
|
In particular, caches are currently limited to 10 GB in total and exceeding that
|
||||||
|
limit will cause eviction of older caches.
|
||||||
|
|
||||||
|
Caches from base branches are available to PRs, but not across unrelated
|
||||||
|
branches.
|
||||||
|
|
||||||
|
The caches can be controlled using the [Cache API](https://docs.github.com/en/rest/actions/cache)
|
||||||
|
which allows listing existing caches and manually removing entries.
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
The action prints detailed information about which information it considers
|
||||||
|
for its cache key, and it outputs more debug-only information about which
|
||||||
|
cleanup steps it performs before persisting the cache.
|
||||||
|
|
||||||
|
You can read up on how to [enable debug logging](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging)
|
||||||
|
to see those details as well as further details related to caching operations.
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
|
||||||
|
- The cache cleaning process currently removes all the files from `~/.cargo/bin`
|
||||||
|
that were present before the action ran (for example `rustc`).
|
||||||
|
|||||||
4
TODO.md
Normal file
4
TODO.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
- better .cargo/bin handling:
|
||||||
|
- get a list of all the files on "pre"/"restore"
|
||||||
|
- move the files out of the way on "post"/"save" and move them back afterwards
|
||||||
|
- properly clean sparse registry
|
||||||
27
action.yml
27
action.yml
@@ -1,15 +1,30 @@
|
|||||||
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 <swatinem@swatinem.de>"
|
||||||
inputs:
|
inputs:
|
||||||
key:
|
shared-key:
|
||||||
description: "An explicit key for restoring and saving the target cache"
|
description: "An additional cache key that is stable over multiple jobs"
|
||||||
required: false
|
required: false
|
||||||
|
key:
|
||||||
|
description: "An additional key for the cache"
|
||||||
|
required: false
|
||||||
|
env-vars:
|
||||||
|
description: "Additional environment variables to include in the cache key, separated by spaces"
|
||||||
|
required: false
|
||||||
|
workspaces:
|
||||||
|
description: "Paths to multiple Cargo workspaces and their target directories, separated by newlines"
|
||||||
|
required: false
|
||||||
|
cache-on-failure:
|
||||||
|
description: "Cache even if the build fails. Defaults to false"
|
||||||
|
required: false
|
||||||
|
outputs:
|
||||||
|
cache-hit:
|
||||||
|
description: "A boolean value that indicates an exact match was found"
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node16"
|
||||||
main: "dist/restore/index.js"
|
main: "dist/restore/index.js"
|
||||||
post: "dist/save/index.js"
|
post: "dist/save/index.js"
|
||||||
post-if: "success()"
|
post-if: "success() || env.CACHE_ON_FAILURE == 'true'"
|
||||||
branding:
|
branding:
|
||||||
icon: "archive"
|
icon: "archive"
|
||||||
color: "gray-dark"
|
color: "gray-dark"
|
||||||
|
|||||||
55526
dist/restore/index.js
vendored
55526
dist/restore/index.js
vendored
File diff suppressed because one or more lines are too long
55681
dist/save/index.js
vendored
55681
dist/save/index.js
vendored
File diff suppressed because one or more lines are too long
1092
package-lock.json
generated
1092
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "rust-cache",
|
"name": "rust-cache",
|
||||||
"version": "1.0.2",
|
"version": "2.0.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": "^3.0.0",
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/glob": "^0.1.0",
|
"@actions/glob": "^0.3.0",
|
||||||
"@actions/io": "^1.0.2"
|
"@actions/io": "^1.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.24.1",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "4.7.4"
|
||||||
},
|
},
|
||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
226
src/cleanup.ts
Normal file
226
src/cleanup.ts
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as io from "@actions/io";
|
||||||
|
import fs from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
import { CARGO_HOME, STATE_BINS } from "./config";
|
||||||
|
import { Packages } from "./workspace";
|
||||||
|
|
||||||
|
export async function cleanTargetDir(targetDir: string, packages: Packages) {
|
||||||
|
let dir: fs.Dir;
|
||||||
|
// remove all *files* from the profile directory
|
||||||
|
dir = await fs.promises.opendir(targetDir);
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
if (dirent.isDirectory()) {
|
||||||
|
let dirName = path.join(dir.path, dirent.name);
|
||||||
|
// is it a profile dir, or a nested target dir?
|
||||||
|
let isNestedTarget =
|
||||||
|
(await exists(path.join(dirName, "CACHEDIR.TAG"))) || (await exists(path.join(dirName, ".rustc_info.json")));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isNestedTarget) {
|
||||||
|
await cleanTargetDir(dirName, packages);
|
||||||
|
} else {
|
||||||
|
await cleanProfileTarget(dirName, packages);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
} else if (dirent.name !== "CACHEDIR.TAG") {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cleanProfileTarget(profileDir: string, packages: Packages) {
|
||||||
|
await rmRF(path.join(profileDir, "examples"));
|
||||||
|
await rmRF(path.join(profileDir, "incremental"));
|
||||||
|
|
||||||
|
let dir: fs.Dir;
|
||||||
|
// remove all *files* from the profile directory
|
||||||
|
dir = await fs.promises.opendir(profileDir);
|
||||||
|
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(path.join(profileDir, "build"), keepPkg);
|
||||||
|
await rmExcept(path.join(profileDir, ".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(path.join(profileDir, "deps"), keepDeps);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getCargoBins(): Promise<Set<string>> {
|
||||||
|
const bins = new Set<string>();
|
||||||
|
try {
|
||||||
|
const { installs }: { installs: { [key: string]: { bins: Array<string> } } } = JSON.parse(
|
||||||
|
await fs.promises.readFile(path.join(CARGO_HOME, ".crates2.json"), "utf8"),
|
||||||
|
);
|
||||||
|
for (const pkg of Object.values(installs)) {
|
||||||
|
for (const bin of pkg.bins) {
|
||||||
|
bins.add(bin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return bins;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function cleanBin() {
|
||||||
|
const bins = await getCargoBins();
|
||||||
|
const oldBins = JSON.parse(core.getState(STATE_BINS));
|
||||||
|
|
||||||
|
for (const bin of oldBins) {
|
||||||
|
bins.delete(bin);
|
||||||
|
}
|
||||||
|
|
||||||
|
const dir = await fs.promises.opendir(path.join(CARGO_HOME, "bin"));
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
if (dirent.isFile() && !bins.has(dirent.name)) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function cleanRegistry(packages: Packages) {
|
||||||
|
// `.cargo/registry/src`
|
||||||
|
// we can remove this completely, as cargo will recreate this from `cache`
|
||||||
|
await rmRF(path.join(CARGO_HOME, "registry", "src"));
|
||||||
|
|
||||||
|
// `.cargo/registry/index`
|
||||||
|
const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));
|
||||||
|
for await (const dirent of indexDir) {
|
||||||
|
if (dirent.isDirectory()) {
|
||||||
|
// eg `.cargo/registry/index/github.com-1ecc6299db9ec823`
|
||||||
|
// or `.cargo/registry/index/index.crates.io-e139d0d48fed7772`
|
||||||
|
const dir = await fs.promises.opendir(path.join(indexDir.path, dirent.name));
|
||||||
|
|
||||||
|
// for a git registry, we can remove `.cache`, as cargo will recreate it from git
|
||||||
|
if (await exists(path.join(dir.path, ".git"))) {
|
||||||
|
await rmRF(path.join(dir.path, ".cache"));
|
||||||
|
}
|
||||||
|
// TODO: else, clean `.cache` based on the `packages`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pkgSet = new Set(packages.map((p) => `${p.name}-${p.version}.crate`));
|
||||||
|
|
||||||
|
// `.cargo/registry/cache`
|
||||||
|
const cacheDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "cache"));
|
||||||
|
for await (const dirent of cacheDir) {
|
||||||
|
if (dirent.isDirectory()) {
|
||||||
|
// eg `.cargo/registry/cache/github.com-1ecc6299db9ec823`
|
||||||
|
// or `.cargo/registry/cache/index.crates.io-e139d0d48fed7772`
|
||||||
|
const dir = await fs.promises.opendir(path.join(cacheDir.path, dirent.name));
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
// here we check that the downloaded `.crate` matches one from our dependencies
|
||||||
|
if (dirent.isFile() && !pkgSet.has(dirent.name)) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function cleanGit(packages: Packages) {
|
||||||
|
const coPath = path.join(CARGO_HOME, "git", "checkouts");
|
||||||
|
const dbPath = path.join(CARGO_HOME, "git", "db");
|
||||||
|
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;
|
||||||
|
// clean the db
|
||||||
|
dir = await fs.promises.opendir(dbPath);
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
if (!repos.has(dirent.name)) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean the checkouts
|
||||||
|
dir = await fs.promises.opendir(coPath);
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
const refs = repos.get(dirent.name);
|
||||||
|
if (!refs) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!dirent.isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const refsDir = await fs.promises.opendir(path.join(dir.path, dirent.name));
|
||||||
|
for await (const dirent of refsDir) {
|
||||||
|
if (!refs.has(dirent.name)) {
|
||||||
|
await rm(refsDir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ONE_WEEK = 7 * 24 * 3600 * 1000;
|
||||||
|
|
||||||
|
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 don’t really know
|
||||||
|
if (!keepPrefix.has(name) || Date.now() - mtime.getTime() > ONE_WEEK) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function rmRF(dirName: string) {
|
||||||
|
core.debug(`deleting "${dirName}"`);
|
||||||
|
await io.rmRF(dirName);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function exists(path: string) {
|
||||||
|
try {
|
||||||
|
await fs.promises.access(path);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
144
src/common.ts
144
src/common.ts
@@ -1,144 +0,0 @@
|
|||||||
import * as core from "@actions/core";
|
|
||||||
import * as exec from "@actions/exec";
|
|
||||||
import * as glob from "@actions/glob";
|
|
||||||
import crypto from "crypto";
|
|
||||||
import fs from "fs";
|
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
const home = os.homedir();
|
|
||||||
export const paths = {
|
|
||||||
index: path.join(home, ".cargo/registry/index"),
|
|
||||||
cache: path.join(home, ".cargo/registry/cache"),
|
|
||||||
git: path.join(home, ".cargo/git/db"),
|
|
||||||
target: "target",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface CacheConfig {
|
|
||||||
name: string;
|
|
||||||
path: string;
|
|
||||||
key: string;
|
|
||||||
restoreKeys?: Array<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Caches {
|
|
||||||
index: CacheConfig;
|
|
||||||
cache: CacheConfig;
|
|
||||||
// git: CacheConfig;
|
|
||||||
target: CacheConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RefKey = "GITHUB_REF";
|
|
||||||
|
|
||||||
export function isValidEvent(): boolean {
|
|
||||||
return RefKey in process.env && Boolean(process.env[RefKey]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getCaches(): Promise<Caches> {
|
|
||||||
const rustKey = await getRustKey();
|
|
||||||
let lockHash = core.getState("lockHash");
|
|
||||||
if (!lockHash) {
|
|
||||||
lockHash = await getLockfileHash();
|
|
||||||
core.saveState("lockHash", lockHash);
|
|
||||||
}
|
|
||||||
let targetKey = core.getInput("key");
|
|
||||||
if (targetKey) {
|
|
||||||
targetKey = `${targetKey}-`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const registryIndex = `v0-registry-index`;
|
|
||||||
const registryCache = `v0-registry-cache`;
|
|
||||||
const target = `v0-target-${targetKey}${rustKey}`;
|
|
||||||
return {
|
|
||||||
index: {
|
|
||||||
name: "Registry Index",
|
|
||||||
path: paths.index,
|
|
||||||
key: `${registryIndex}-`,
|
|
||||||
restoreKeys: [registryIndex],
|
|
||||||
},
|
|
||||||
cache: {
|
|
||||||
name: "Registry Cache",
|
|
||||||
path: paths.cache,
|
|
||||||
key: `${registryCache}-${lockHash}`,
|
|
||||||
restoreKeys: [registryCache],
|
|
||||||
},
|
|
||||||
// git: {
|
|
||||||
// name: "Git Dependencies",
|
|
||||||
// path: paths.git,
|
|
||||||
// key: "git-db",
|
|
||||||
// },
|
|
||||||
target: {
|
|
||||||
name: "Target",
|
|
||||||
path: paths.target,
|
|
||||||
key: `${target}-${lockHash}`,
|
|
||||||
restoreKeys: [target],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getRustKey(): Promise<string> {
|
|
||||||
const rustc = await getRustVersion();
|
|
||||||
return `${rustc.release}-${rustc.host}-${rustc["commit-hash"]}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RustVersion {
|
|
||||||
host: string;
|
|
||||||
release: string;
|
|
||||||
"commit-hash": string;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getRustVersion(): Promise<RustVersion> {
|
|
||||||
const stdout = await getCmdOutput("rustc", ["-vV"]);
|
|
||||||
let splits = stdout
|
|
||||||
.split(/[\n\r]+/)
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((s) => s.split(":").map((s) => s.trim()))
|
|
||||||
.filter((s) => s.length === 2);
|
|
||||||
return Object.fromEntries(splits);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getCmdOutput(
|
|
||||||
cmd: string,
|
|
||||||
args: Array<string> = [],
|
|
||||||
options: exec.ExecOptions = {},
|
|
||||||
): Promise<string> {
|
|
||||||
let stdout = "";
|
|
||||||
await exec.exec(cmd, args, {
|
|
||||||
silent: true,
|
|
||||||
listeners: {
|
|
||||||
stdout(data) {
|
|
||||||
stdout += data.toString();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...options,
|
|
||||||
});
|
|
||||||
return stdout;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getRegistryName() {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getLockfileHash() {
|
|
||||||
const globber = await glob.create("**/Cargo.toml\n**/Cargo.lock", { followSymbolicLinks: false });
|
|
||||||
const files = await globber.glob();
|
|
||||||
files.sort((a, b) => a.localeCompare(b));
|
|
||||||
|
|
||||||
const hasher = crypto.createHash("sha1");
|
|
||||||
for (const file of files) {
|
|
||||||
for await (const chunk of fs.createReadStream(file)) {
|
|
||||||
hasher.update(chunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasher.digest("hex");
|
|
||||||
}
|
|
||||||
205
src/config.ts
Normal file
205
src/config.ts
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as glob from "@actions/glob";
|
||||||
|
import crypto from "crypto";
|
||||||
|
import fs from "fs";
|
||||||
|
import os from "os";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
import { getCmdOutput } from "./utils";
|
||||||
|
import { Workspace } from "./workspace";
|
||||||
|
|
||||||
|
const HOME = os.homedir();
|
||||||
|
export const CARGO_HOME = process.env.CARGO_HOME || path.join(HOME, ".cargo");
|
||||||
|
|
||||||
|
const STATE_LOCKFILE_HASH = "RUST_CACHE_LOCKFILE_HASH";
|
||||||
|
const STATE_LOCKFILES = "RUST_CACHE_LOCKFILES";
|
||||||
|
export const STATE_BINS = "RUST_CACHE_BINS";
|
||||||
|
export const STATE_KEY = "RUST_CACHE_KEY";
|
||||||
|
|
||||||
|
export class CacheConfig {
|
||||||
|
/** All the paths we want to cache */
|
||||||
|
public cachePaths: Array<string> = [];
|
||||||
|
/** The primary cache key */
|
||||||
|
public cacheKey = "";
|
||||||
|
/** The secondary (restore) key that only contains the prefix and environment */
|
||||||
|
public restoreKey = "";
|
||||||
|
|
||||||
|
/** The workspace configurations */
|
||||||
|
public workspaces: Array<Workspace> = [];
|
||||||
|
|
||||||
|
/** The prefix portion of the cache key */
|
||||||
|
private keyPrefix = "";
|
||||||
|
/** The rust version considered for the cache key */
|
||||||
|
private keyRust = "";
|
||||||
|
/** The environment variables considered for the cache key */
|
||||||
|
private keyEnvs: Array<string> = [];
|
||||||
|
/** The files considered for the cache key */
|
||||||
|
private keyFiles: Array<string> = [];
|
||||||
|
|
||||||
|
private constructor() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a [`CacheConfig`] with all the paths and keys.
|
||||||
|
*
|
||||||
|
* This will read the action `input`s, and read and persist `state` as necessary.
|
||||||
|
*/
|
||||||
|
static async new(): Promise<CacheConfig> {
|
||||||
|
const self = new CacheConfig();
|
||||||
|
|
||||||
|
// Construct key prefix:
|
||||||
|
// This uses either the `shared-key` input,
|
||||||
|
// or the `key` input combined with the `job` key.
|
||||||
|
|
||||||
|
let key = `v0-rust`;
|
||||||
|
|
||||||
|
const sharedKey = core.getInput("shared-key");
|
||||||
|
if (sharedKey) {
|
||||||
|
key += `-${sharedKey}`;
|
||||||
|
} else {
|
||||||
|
const inputKey = core.getInput("key");
|
||||||
|
if (inputKey) {
|
||||||
|
key += `-${inputKey}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const job = process.env.GITHUB_JOB;
|
||||||
|
if (job) {
|
||||||
|
key += `-${job}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.keyPrefix = key;
|
||||||
|
|
||||||
|
// Construct environment portion of the key:
|
||||||
|
// This consists of a hash that considers the rust version
|
||||||
|
// as well as all the environment variables as given by a default list
|
||||||
|
// and the `env-vars` input.
|
||||||
|
// The env vars are sorted, matched by prefix and hashed into the
|
||||||
|
// resulting environment hash.
|
||||||
|
|
||||||
|
let hasher = crypto.createHash("sha1");
|
||||||
|
const rustVersion = await getRustVersion();
|
||||||
|
|
||||||
|
let keyRust = `${rustVersion.release} ${rustVersion.host}`;
|
||||||
|
hasher.update(keyRust);
|
||||||
|
hasher.update(rustVersion["commit-hash"]);
|
||||||
|
|
||||||
|
keyRust += ` (${rustVersion["commit-hash"]})`;
|
||||||
|
self.keyRust = keyRust;
|
||||||
|
|
||||||
|
// these prefixes should cover most of the compiler / rust / cargo keys
|
||||||
|
const envPrefixes = ["CARGO", "CC", "CFLAGS", "CXX", "CMAKE", "RUST"];
|
||||||
|
envPrefixes.push(...core.getInput("env-vars").split(/\s+/).filter(Boolean));
|
||||||
|
|
||||||
|
// sort the available env vars so we have a more stable hash
|
||||||
|
const keyEnvs = [];
|
||||||
|
const envKeys = Object.keys(process.env);
|
||||||
|
envKeys.sort((a, b) => a.localeCompare(b));
|
||||||
|
for (const key of envKeys) {
|
||||||
|
const value = process.env[key];
|
||||||
|
if (envPrefixes.some((prefix) => key.startsWith(prefix)) && value) {
|
||||||
|
hasher.update(`${key}=${value}`);
|
||||||
|
keyEnvs.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.keyEnvs = keyEnvs;
|
||||||
|
key += `-${hasher.digest("hex")}`;
|
||||||
|
|
||||||
|
self.restoreKey = key;
|
||||||
|
|
||||||
|
// Construct the lockfiles portion of the key:
|
||||||
|
// This considers all the files found via globbing for various manifests
|
||||||
|
// and lockfiles.
|
||||||
|
// This part is computed in the "pre"/"restore" part of the job and persisted
|
||||||
|
// into the `state`. That state is loaded in the "post"/"save" part of the
|
||||||
|
// job so we have consistent values even though the "main" actions run
|
||||||
|
// might create/overwrite lockfiles.
|
||||||
|
|
||||||
|
let lockHash = core.getState(STATE_LOCKFILE_HASH);
|
||||||
|
let keyFiles: Array<string> = JSON.parse(core.getState(STATE_LOCKFILES) || "[]");
|
||||||
|
|
||||||
|
if (!lockHash) {
|
||||||
|
const globber = await glob.create("**/Cargo.toml\n**/Cargo.lock\nrust-toolchain\nrust-toolchain.toml", {
|
||||||
|
followSymbolicLinks: false,
|
||||||
|
});
|
||||||
|
keyFiles = await globber.glob();
|
||||||
|
keyFiles.sort((a, b) => a.localeCompare(b));
|
||||||
|
|
||||||
|
hasher = crypto.createHash("sha1");
|
||||||
|
for (const file of keyFiles) {
|
||||||
|
for await (const chunk of fs.createReadStream(file)) {
|
||||||
|
hasher.update(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockHash = hasher.digest("hex");
|
||||||
|
|
||||||
|
core.saveState(STATE_LOCKFILE_HASH, lockHash);
|
||||||
|
core.saveState(STATE_LOCKFILES, JSON.stringify(keyFiles));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.keyFiles = keyFiles;
|
||||||
|
key += `-${lockHash}`;
|
||||||
|
self.cacheKey = key;
|
||||||
|
|
||||||
|
// Constructs the workspace config and paths to restore:
|
||||||
|
// The workspaces are given using a `$workspace -> $target` syntax.
|
||||||
|
|
||||||
|
const workspaces: Array<Workspace> = [];
|
||||||
|
const workspacesInput = core.getInput("workspaces") || ".";
|
||||||
|
for (const workspace of workspacesInput.trim().split("\n")) {
|
||||||
|
let [root, target = "target"] = workspace.split("->").map((s) => s.trim());
|
||||||
|
root = path.resolve(root);
|
||||||
|
target = path.join(root, target);
|
||||||
|
workspaces.push(new Workspace(root, target));
|
||||||
|
}
|
||||||
|
self.workspaces = workspaces;
|
||||||
|
|
||||||
|
self.cachePaths = [CARGO_HOME, ...workspaces.map((ws) => ws.target)];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
printInfo() {
|
||||||
|
core.startGroup("Cache Configuration");
|
||||||
|
core.info(`Workspaces:`);
|
||||||
|
for (const workspace of this.workspaces) {
|
||||||
|
core.info(` ${workspace.root}`);
|
||||||
|
}
|
||||||
|
core.info(`Cache Paths:`);
|
||||||
|
for (const path of this.cachePaths) {
|
||||||
|
core.info(` ${path}`);
|
||||||
|
}
|
||||||
|
core.info(`Restore Key:`);
|
||||||
|
core.info(` ${this.restoreKey}`);
|
||||||
|
core.info(`Cache Key:`);
|
||||||
|
core.info(` ${this.cacheKey}`);
|
||||||
|
core.info(`.. Prefix:`);
|
||||||
|
core.info(` - ${this.keyPrefix}`);
|
||||||
|
core.info(`.. Environment considered:`);
|
||||||
|
core.info(` - Rust Version: ${this.keyRust}`);
|
||||||
|
for (const env of this.keyEnvs) {
|
||||||
|
core.info(` - ${env}`);
|
||||||
|
}
|
||||||
|
core.info(`.. Lockfiles considered:`);
|
||||||
|
for (const file of this.keyFiles) {
|
||||||
|
core.info(` - ${file}`);
|
||||||
|
}
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RustVersion {
|
||||||
|
host: string;
|
||||||
|
release: string;
|
||||||
|
"commit-hash": string;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getRustVersion(): Promise<RustVersion> {
|
||||||
|
const stdout = await getCmdOutput("rustc", ["-vV"]);
|
||||||
|
let splits = stdout
|
||||||
|
.split(/[\n\r]+/)
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((s) => s.split(":").map((s) => s.trim()))
|
||||||
|
.filter((s) => s.length === 2);
|
||||||
|
return Object.fromEntries(splits);
|
||||||
|
}
|
||||||
@@ -1,41 +1,70 @@
|
|||||||
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 { cleanTargetDir, getCargoBins } from "./cleanup";
|
||||||
|
import { CacheConfig, STATE_BINS, STATE_KEY } from "./config";
|
||||||
|
|
||||||
|
process.on("uncaughtException", (e) => {
|
||||||
|
core.info(`[warning] ${e.message}`);
|
||||||
|
if (e.stack) {
|
||||||
|
core.info(e.stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
if (!isValidEvent()) {
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
setCacheHitOutput(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
var cacheOnFailure = core.getInput("cache-on-failure").toLowerCase();
|
||||||
|
if (cacheOnFailure !== "true") {
|
||||||
|
cacheOnFailure = "false";
|
||||||
|
}
|
||||||
|
core.exportVariable("CACHE_ON_FAILURE", cacheOnFailure);
|
||||||
core.exportVariable("CARGO_INCREMENTAL", 0);
|
core.exportVariable("CARGO_INCREMENTAL", 0);
|
||||||
|
|
||||||
const caches = await getCaches();
|
const config = await CacheConfig.new();
|
||||||
for (const [type, { name, path, key, restoreKeys }] of Object.entries(caches)) {
|
config.printInfo();
|
||||||
const start = Date.now();
|
core.info("");
|
||||||
core.startGroup(`Restoring ${name}…`);
|
|
||||||
core.info(`Restoring to path "${path}".`);
|
const bins = await getCargoBins();
|
||||||
core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
|
core.saveState(STATE_BINS, JSON.stringify([...bins]));
|
||||||
try {
|
|
||||||
const restoreKey = await cache.restoreCache([path], key, restoreKeys);
|
core.info(`... Restoring cache ...`);
|
||||||
if (restoreKey) {
|
const key = config.cacheKey;
|
||||||
core.info(`Restored from cache key "${restoreKey}".`);
|
const restoreKey = await cache.restoreCache(config.cachePaths, key, [config.restoreKey]);
|
||||||
core.saveState(type, restoreKey);
|
if (restoreKey) {
|
||||||
} else {
|
core.info(`Restored from cache key "${restoreKey}".`);
|
||||||
core.info("No cache found.");
|
core.saveState(STATE_KEY, restoreKey);
|
||||||
|
|
||||||
|
if (restoreKey !== key) {
|
||||||
|
// pre-clean the target directory on cache mismatch
|
||||||
|
for (const workspace of config.workspaces) {
|
||||||
|
try {
|
||||||
|
const packages = await workspace.getPackages();
|
||||||
|
|
||||||
|
await cleanTargetDir(workspace.target, packages);
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
core.info(`[warning] ${e.message}`);
|
|
||||||
}
|
}
|
||||||
const duration = Math.round((Date.now() - start) / 1000);
|
|
||||||
if (duration) {
|
setCacheHitOutput(restoreKey === key);
|
||||||
core.info(`Took ${duration}s.`);
|
} else {
|
||||||
}
|
core.info("No cache found.");
|
||||||
core.endGroup();
|
|
||||||
|
setCacheHitOutput(false);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info(`[warning] ${e.message}`);
|
setCacheHitOutput(false);
|
||||||
|
|
||||||
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCacheHitOutput(cacheHit: boolean): void {
|
||||||
|
core.setOutput("cache-hit", cacheHit.toString());
|
||||||
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|||||||
192
src/save.ts
192
src/save.ts
@@ -1,167 +1,77 @@
|
|||||||
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 exec from "@actions/exec";
|
||||||
import * as io from "@actions/io";
|
|
||||||
import fs from "fs";
|
import { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup";
|
||||||
import path from "path";
|
import { CacheConfig, STATE_KEY } from "./config";
|
||||||
import { getCaches, getCmdOutput, getRegistryName, isValidEvent, paths } from "./common";
|
|
||||||
|
process.on("uncaughtException", (e) => {
|
||||||
|
core.info(`[warning] ${e.message}`);
|
||||||
|
if (e.stack) {
|
||||||
|
core.info(e.stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
if (!isValidEvent()) {
|
if (!cache.isFeatureAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const caches = await getCaches();
|
const config = await CacheConfig.new();
|
||||||
const registryName = await getRegistryName();
|
config.printInfo();
|
||||||
const packages = await getPackages();
|
core.info("");
|
||||||
|
|
||||||
|
if (core.getState(STATE_KEY) === config.cacheKey) {
|
||||||
|
core.info(`Cache up-to-date.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: remove this once https://github.com/actions/toolkit/pull/553 lands
|
// TODO: remove this once https://github.com/actions/toolkit/pull/553 lands
|
||||||
await macOsWorkaround();
|
await macOsWorkaround();
|
||||||
|
|
||||||
await pruneTarget(packages);
|
const allPackages = [];
|
||||||
|
for (const workspace of config.workspaces) {
|
||||||
if (registryName) {
|
const packages = await workspace.getPackages();
|
||||||
// save the index based on its revision
|
allPackages.push(...packages);
|
||||||
const indexRef = await getIndexRef(registryName);
|
|
||||||
caches.index.key += indexRef;
|
|
||||||
await io.rmRF(path.join(paths.index, registryName, ".cache"));
|
|
||||||
|
|
||||||
await pruneRegistryCache(registryName, packages);
|
|
||||||
} else {
|
|
||||||
delete (caches as any).index;
|
|
||||||
delete (caches as any).cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [type, { name, path, key }] of Object.entries(caches)) {
|
|
||||||
if (core.getState(type) === key) {
|
|
||||||
core.info(`${name} up-to-date.`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const start = Date.now();
|
|
||||||
core.startGroup(`Saving ${name}…`);
|
|
||||||
core.info(`Saving path "${path}".`);
|
|
||||||
core.info(`Using key "${key}".`);
|
|
||||||
try {
|
try {
|
||||||
await cache.saveCache([path], key);
|
core.info(`... Cleaning ${workspace.target} ...`);
|
||||||
|
await cleanTargetDir(workspace.target, packages);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info(`[warning] ${e.message}`);
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
}
|
}
|
||||||
const duration = Math.round((Date.now() - start) / 1000);
|
|
||||||
if (duration) {
|
|
||||||
core.info(`Took ${duration}s.`);
|
|
||||||
}
|
|
||||||
core.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
core.info(`... Cleaning cargo registry ...`);
|
||||||
|
await cleanRegistry(allPackages);
|
||||||
|
} catch (e) {
|
||||||
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
core.info(`... Cleaning cargo/bin ...`);
|
||||||
|
await cleanBin();
|
||||||
|
} catch (e) {
|
||||||
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
core.info(`... Cleaning cargo git cache ...`);
|
||||||
|
await cleanGit(allPackages);
|
||||||
|
} catch (e) {
|
||||||
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`... Saving cache ...`);
|
||||||
|
await cache.saveCache(config.cachePaths, config.cacheKey);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info(`[warning] ${e.message}`);
|
core.info(`[warning] ${(e as any).stack}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|
||||||
async function getIndexRef(registryName: string) {
|
|
||||||
const cwd = path.join(paths.index, registryName);
|
|
||||||
return (await getCmdOutput("git", ["rev-parse", "--short", "origin/master"], { cwd })).trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PackageDefinition {
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
targets: Array<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Packages = Array<PackageDefinition>;
|
|
||||||
|
|
||||||
interface Meta {
|
|
||||||
packages: Array<{
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
manifest_path: string;
|
|
||||||
targets: Array<{ kind: Array<string>; name: string }>;
|
|
||||||
}>;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pruneRegistryCache(registryName: string, packages: Packages) {
|
|
||||||
const pkgSet = new Set(packages.map((p) => `${p.name}-${p.version}.crate`));
|
|
||||||
|
|
||||||
const dir = await fs.promises.opendir(path.join(paths.cache, registryName));
|
|
||||||
for await (const dirent of dir) {
|
|
||||||
if (dirent.isFile() && !pkgSet.has(dirent.name)) {
|
|
||||||
const fileName = path.join(dir.path, dirent.name);
|
|
||||||
await fs.promises.unlink(fileName);
|
|
||||||
core.debug(`deleting "${fileName}"`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pruneTarget(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()) {
|
|
||||||
const fileName = path.join(dir.path, dirent.name);
|
|
||||||
await fs.promises.unlink(fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 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) {
|
|
||||||
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);
|
|
||||||
if (!keepPrefix.has(name) || Date.now() - mtime.getTime() > twoWeeks) {
|
|
||||||
core.debug(`deleting "${fileName}"`);
|
|
||||||
if (dirent.isFile()) {
|
|
||||||
await fs.promises.unlink(fileName);
|
|
||||||
} else if (dirent.isDirectory()) {
|
|
||||||
await io.rmRF(fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function macOsWorkaround() {
|
async function macOsWorkaround() {
|
||||||
try {
|
try {
|
||||||
// Workaround for https://github.com/actions/cache/issues/403
|
// Workaround for https://github.com/actions/cache/issues/403
|
||||||
|
|||||||
30
src/utils.ts
Normal file
30
src/utils.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
|
||||||
|
export async function getCmdOutput(
|
||||||
|
cmd: string,
|
||||||
|
args: Array<string> = [],
|
||||||
|
options: exec.ExecOptions = {},
|
||||||
|
): Promise<string> {
|
||||||
|
let stdout = "";
|
||||||
|
let stderr = "";
|
||||||
|
try {
|
||||||
|
await exec.exec(cmd, args, {
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout(data) {
|
||||||
|
stdout += data.toString();
|
||||||
|
},
|
||||||
|
stderr(data) {
|
||||||
|
stderr += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
core.info(`[warning] Command failed: ${cmd} ${args.join(" ")}`);
|
||||||
|
core.info(`[warning] ${stderr}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
return stdout;
|
||||||
|
}
|
||||||
44
src/workspace.ts
Normal file
44
src/workspace.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import path from "path";
|
||||||
|
|
||||||
|
import { getCmdOutput } from "./utils";
|
||||||
|
|
||||||
|
export class Workspace {
|
||||||
|
constructor(public root: string, public target: string) {}
|
||||||
|
|
||||||
|
public async getPackages(): Promise<Packages> {
|
||||||
|
let packages: Packages = [];
|
||||||
|
try {
|
||||||
|
const meta: Meta = JSON.parse(
|
||||||
|
await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1"], {
|
||||||
|
cwd: this.root,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
for (const pkg of meta.packages) {
|
||||||
|
if (pkg.manifest_path.startsWith(this.root)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const targets = pkg.targets.filter((t) => t.kind[0] === "lib").map((t) => t.name);
|
||||||
|
packages.push({ name: pkg.name, version: pkg.version, targets, path: path.dirname(pkg.manifest_path) });
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return packages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 }>;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
927
tests/Cargo.lock
generated
Normal file
927
tests/Cargo.lock
generated
Normal file
@@ -0,0 +1,927 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytes"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.73"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding_rs"
|
||||||
|
version = "0.8.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "1.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||||
|
dependencies = [
|
||||||
|
"instant",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||||
|
dependencies = [
|
||||||
|
"foreign-types-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types-shared"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "form_urlencoded"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
|
||||||
|
dependencies = [
|
||||||
|
"matches",
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-channel"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-sink"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "h2"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"indexmap",
|
||||||
|
"slab",
|
||||||
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body"
|
||||||
|
version = "0.4.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "httparse"
|
||||||
|
version = "1.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "httpdate"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper"
|
||||||
|
version = "0.14.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"h2",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"httparse",
|
||||||
|
"httpdate",
|
||||||
|
"itoa",
|
||||||
|
"pin-project-lite",
|
||||||
|
"socket2",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
"want",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-tls"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"hyper",
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||||
|
dependencies = [
|
||||||
|
"matches",
|
||||||
|
"unicode-bidi",
|
||||||
|
"unicode-normalization",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "1.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "instant"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ipnet"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.58"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.126"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matches"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime"
|
||||||
|
version = "0.3.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mio"
|
||||||
|
version = "0.8.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"wasi",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "native-tls"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"openssl",
|
||||||
|
"openssl-probe",
|
||||||
|
"openssl-sys",
|
||||||
|
"schannel",
|
||||||
|
"security-framework",
|
||||||
|
"security-framework-sys",
|
||||||
|
"tempfile",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl"
|
||||||
|
version = "0.10.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cfg-if",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"openssl-macros",
|
||||||
|
"openssl-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-macros"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-probe"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.9.75"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "percent-encoding"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-utils"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.3.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proguard"
|
||||||
|
version = "5.0.0"
|
||||||
|
source = "git+https://github.com/getsentry/rust-proguard?rev=4bc2cddd79cc8f7c9d14dda2f9f4c431e10c9424#4bc2cddd79cc8f7c9d14dda2f9f4c431e10c9424"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.2.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "remove_dir_all"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "reqwest"
|
||||||
|
version = "0.11.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"bytes",
|
||||||
|
"encoding_rs",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"h2",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"hyper",
|
||||||
|
"hyper-tls",
|
||||||
|
"ipnet",
|
||||||
|
"js-sys",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"mime",
|
||||||
|
"native-tls",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
|
"tower-service",
|
||||||
|
"url",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"winreg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust-cache"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"proguard",
|
||||||
|
"reqwest",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schannel"
|
||||||
|
version = "0.1.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"core-foundation",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"security-framework-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework-sys"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.138"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_urlencoded"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempfile"
|
||||||
|
version = "3.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"fastrand",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"remove_dir_all",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec_macros"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio"
|
||||||
|
version = "1.19.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"libc",
|
||||||
|
"memchr",
|
||||||
|
"mio",
|
||||||
|
"once_cell",
|
||||||
|
"pin-project-lite",
|
||||||
|
"socket2",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-native-tls"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
|
||||||
|
dependencies = [
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-util"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tower-service"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing"
|
||||||
|
version = "0.1.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "try-lock"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-bidi"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-normalization"
|
||||||
|
version = "0.1.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "url"
|
||||||
|
version = "2.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"idna",
|
||||||
|
"matches",
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "want"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"try-lock",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-backend"
|
||||||
|
version = "0.2.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-futures"
|
||||||
|
version = "0.4.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.58"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winreg"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
10
tests/Cargo.toml
Normal file
10
tests/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
publish = false
|
||||||
|
name = "rust-cache"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Arpad Borsos <arpad.borsos@googlemail.com>"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
reqwest = "0.11.11"
|
||||||
|
proguard = { git = "https://github.com/getsentry/rust-proguard", rev = "4bc2cddd79cc8f7c9d14dda2f9f4c431e10c9424" }
|
||||||
18
tests/src/main.rs
Normal file
18
tests/src/main.rs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn some_fn(input: bool) -> usize {
|
||||||
|
if input {
|
||||||
|
2 + 4
|
||||||
|
} else {
|
||||||
|
3_usize.saturating_add(5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn some_test() {
|
||||||
|
assert_eq!(some_fn(true), 6);
|
||||||
|
assert_eq!(some_fn(false), 8);
|
||||||
|
}
|
||||||
2
tests/wasm-workspace/.cargo/config.toml
Normal file
2
tests/wasm-workspace/.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[build]
|
||||||
|
target = "wasm32-unknown-unknown"
|
||||||
1320
tests/wasm-workspace/Cargo.lock
generated
Normal file
1320
tests/wasm-workspace/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
5
tests/wasm-workspace/Cargo.toml
Normal file
5
tests/wasm-workspace/Cargo.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"crates/one",
|
||||||
|
"crates/two",
|
||||||
|
]
|
||||||
13
tests/wasm-workspace/crates/one/Cargo.toml
Normal file
13
tests/wasm-workspace/crates/one/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
publish = false
|
||||||
|
name = "wasm-one"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
reqwest = "0.11.0"
|
||||||
|
async-std = "1"
|
||||||
|
tracing = "0.1"
|
||||||
|
tracing-futures = "0.2"
|
||||||
|
serde = "1"
|
||||||
|
serde_json = "1"
|
||||||
3
tests/wasm-workspace/crates/one/src/main.rs
Normal file
3
tests/wasm-workspace/crates/one/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
8
tests/wasm-workspace/crates/two/Cargo.toml
Normal file
8
tests/wasm-workspace/crates/two/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
publish = false
|
||||||
|
name = "wasm-two"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = "3"
|
||||||
3
tests/wasm-workspace/crates/two/src/main.rs
Normal file
3
tests/wasm-workspace/crates/two/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"diagnostics": true,
|
"diagnostics": true,
|
||||||
"lib": ["esnext"],
|
"lib": ["esnext"],
|
||||||
|
|
||||||
"target": "es2017",
|
"target": "es2020",
|
||||||
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
|||||||
Reference in New Issue
Block a user