mirror of
https://github.com/Swatinem/rust-cache
synced 2026-09-07 20:03:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6323deb102 | ||
|
|
b16e8d71b2 | ||
|
|
3bf42ac996 | ||
|
|
6e5b278ead | ||
|
|
5adc05f6aa | ||
|
|
66b1e95261 | ||
|
|
72d126e709 | ||
|
|
48968d2131 | ||
|
|
9f151aca7c | ||
|
|
0e24e5dcec | ||
|
|
7e35be21c2 | ||
|
|
0b5b468d98 | ||
|
|
a31add9f17 | ||
|
|
6dfd3c5062 | ||
|
|
b88d7b9a78 | ||
|
|
cb96ac76d8 | ||
|
|
3cd715cd54 | ||
|
|
2903027c68 | ||
|
|
7e2fe4383b | ||
|
|
baf1a810e9 | ||
|
|
f27557af97 | ||
|
|
c106961fee | ||
|
|
1fe0a60026 | ||
|
|
be9aa033ee | ||
|
|
874b06e0d3 | ||
|
|
8ba370a790 | ||
|
|
65012b4902 | ||
|
|
faada81aeb | ||
|
|
77fc9855f4 | ||
|
|
919333daf4 | ||
|
|
455db766b8 | ||
|
|
174de315c6 | ||
|
|
91cad52c87 | ||
|
|
3d9a6aef83 | ||
|
|
13b62626e8 | ||
|
|
bd17f4a47e | ||
|
|
469cb0e247 | ||
|
|
3a556350bd | ||
|
|
22de9d98ab | ||
|
|
ed5e89b8ff | ||
|
|
f51f967e15 | ||
|
|
85fb4247b7 | ||
|
|
5084d130b2 | ||
|
|
bc1860267c | ||
|
|
d7ac6f694d | ||
|
|
e18b497796 | ||
|
|
c19371144d | ||
|
|
781e8d91ab | ||
|
|
3d1fa4654a | ||
|
|
c676846f29 | ||
|
|
bf71d02c11 | ||
|
|
8a02ed5e29 | ||
|
|
390157d487 | ||
|
|
68500c182e | ||
|
|
1a8384176d | ||
|
|
11da8522bc | ||
|
|
5e4a767433 | ||
|
|
0aa729bb7a | ||
|
|
6cda4ba16e | ||
|
|
e73b99eeb0 | ||
|
|
42c55942cf | ||
|
|
73cfdf196a | ||
|
|
151eeee51b | ||
|
|
779680da71 | ||
|
|
2ea64efb25 | ||
|
|
8930d9c33e | ||
|
|
c071727fc9 | ||
|
|
f2a41b7c11 | ||
|
|
e306f83d21 | ||
|
|
c9119007a1 | ||
|
|
3aaed5547e | ||
|
|
972b315a82 | ||
|
|
07caf06f7a | ||
|
|
a84bfdc502 | ||
|
|
7ec422fc69 | ||
|
|
b28feea9c9 | ||
|
|
54f69366a5 | ||
|
|
27f6075dd2 | ||
|
|
94162284cf | ||
|
|
2245981121 | ||
|
|
51dda28b91 | ||
|
|
20d8423432 | ||
|
|
b08fc8f955 | ||
|
|
bf8c594800 | ||
|
|
a1f94902a6 | ||
|
|
eb57cd6af8 | ||
|
|
90fd0618bc | ||
|
|
2a0d153b42 | ||
|
|
14cb63c99f | ||
|
|
7bd5339b5b |
@@ -0,0 +1,34 @@
|
|||||||
|
name: binstall
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
binstall:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test `cargo binstall` on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
- uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
|
||||||
|
- run: cargo binstall -y cargo-deny
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -11,17 +11,21 @@ on:
|
|||||||
- "**.md"
|
- "**.md"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-dist:
|
check-dist:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
|
||||||
- name: Setup Node.js 20.x
|
|
||||||
uses: actions/setup-node@v5
|
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Setup Node.js 24.x
|
||||||
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
|
with:
|
||||||
|
node-version: 24.x
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -39,7 +43,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ name: coverage
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
coverage:
|
coverage:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -17,11 +19,15 @@ jobs:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update
|
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update
|
||||||
|
|
||||||
- uses: taiki-e/install-action@cargo-llvm-cov
|
- uses: taiki-e/install-action@6a1bd70eaac3c8bdf093356838d7ee09fda951cf # v2.85.5
|
||||||
|
with:
|
||||||
|
tool: cargo-llvm-cov
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -3,23 +3,25 @@
|
|||||||
name: Dependabot Automation
|
name: Dependabot Automation
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
permissions:
|
permissions: {}
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
automerge:
|
automerge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write # for pushing commits
|
||||||
|
pull-requests: write # for merging PRs
|
||||||
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'Swatinem/rust-cache'
|
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'Swatinem/rust-cache'
|
||||||
steps:
|
steps:
|
||||||
- name: Fetch metadata
|
- name: Fetch metadata
|
||||||
id: metadata
|
id: metadata
|
||||||
uses: dependabot/fetch-metadata@v2
|
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
||||||
with:
|
with:
|
||||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
persist-credentials: false
|
||||||
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
||||||
- name: Check if package-lock.json has been changed
|
- name: Check if package-lock.json has been changed
|
||||||
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
||||||
@@ -35,9 +37,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- name: Setup node if necessary
|
- name: Setup node if necessary
|
||||||
if: steps.npm.outputs.changed != ''
|
if: steps.npm.outputs.changed != ''
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 24.x
|
||||||
cache: npm
|
cache: npm
|
||||||
- name: Re-generate and commit dist/ if changed
|
- name: Re-generate and commit dist/ if changed
|
||||||
id: amend
|
id: amend
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ name: git-registry
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
git-registry:
|
git-registry:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -18,7 +20,9 @@ jobs:
|
|||||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ name: install
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
install:
|
install:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -17,7 +19,9 @@ jobs:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
name: multi-job-cache
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
multi-job-cache-1:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test multi-job cache (1) on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: install rust toolchain
|
||||||
|
run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update
|
||||||
|
|
||||||
|
- name: cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: |
|
||||||
|
tests
|
||||||
|
add-job-id-key: "false"
|
||||||
|
add-rust-environment-hash-key: "false"
|
||||||
|
|
||||||
|
- name: cargo check (tests)
|
||||||
|
working-directory: tests
|
||||||
|
run: cargo check
|
||||||
|
|
||||||
|
multi-job-cache-2:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Test multi-job cache (2) on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: install rust toolchain
|
||||||
|
run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update
|
||||||
|
|
||||||
|
- name: cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: |
|
||||||
|
tests/wasm-workspace
|
||||||
|
add-job-id-key: "false"
|
||||||
|
add-rust-environment-hash-key: "false"
|
||||||
|
|
||||||
|
- name: cargo check (tests/wasm-workspace)
|
||||||
|
working-directory: tests/wasm-workspace
|
||||||
|
run: cargo check
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
name: nix
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nix:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
|
||||||
|
name: Test Nix on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342 # v31.11.0
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
cmd-format: nix develop ./tests -c {0}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
nix develop -c cargo check
|
||||||
|
nix develop -c cargo test
|
||||||
|
working-directory: tests
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
name: save-restore
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
save:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Save a new cache on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
# Use a per-run key so this job always exercises the post-step save path.
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
shared-key: save-restore-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||||
|
|
||||||
|
- run: cargo check
|
||||||
|
working-directory: tests
|
||||||
|
|
||||||
|
restore:
|
||||||
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
name: Restore the newly saved cache on ${{ matrix.os }}
|
||||||
|
needs: save
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
- id: cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workspaces: tests
|
||||||
|
shared-key: save-restore-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||||
|
save-if: "false"
|
||||||
|
|
||||||
|
- name: Verify exact cache hit
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "The cache created by the save job could not be restored." >&2
|
||||||
|
exit 1
|
||||||
@@ -2,6 +2,8 @@ name: simple
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
simple:
|
simple:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -17,7 +19,9 @@ jobs:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ name: target-dir
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
target-dir:
|
target-dir:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -17,7 +19,9 @@ jobs:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,34 @@
|
|||||||
name: buildjet
|
name: warpbuild
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
buildjet:
|
warpbuild:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
name: Test buildjet provider on ${{ matrix.os }}
|
name: Test warpbuild provider on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
workspaces: tests
|
workspaces: tests
|
||||||
cache-provider: buildjet
|
cache-provider: warpbuild
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
cargo check
|
cargo check
|
||||||
@@ -2,6 +2,8 @@ name: workspaces
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
workspaces:
|
workspaces:
|
||||||
if: github.repository == 'Swatinem/rust-cache'
|
if: github.repository == 'Swatinem/rust-cache'
|
||||||
@@ -17,7 +19,9 @@ jobs:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update
|
- run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: GitHub Actions Security Analysis with zizmor 🌈
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
zizmor:
|
||||||
|
name: Run zizmor 🌈
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write # for uploading results to the Security tab
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Run zizmor 🌈
|
||||||
|
uses: zizmorcore/zizmor-action@6fc4b006235f201fdab3722e17240ab420d580e5 # v0.6.1
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
target/
|
target/
|
||||||
|
src/*.js
|
||||||
|
.build
|
||||||
|
|
||||||
# Editors
|
# Editors
|
||||||
.idea/
|
.idea/
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.9.2
|
||||||
|
|
||||||
|
- Fix `credentials.toml` cleanup
|
||||||
|
- Improvements to cleanup, preserving more valid targets
|
||||||
|
- Improvements to `cargo install` handling
|
||||||
|
- Correctly sort/dedupe Rust versions
|
||||||
|
|
||||||
|
## 2.9.1
|
||||||
|
|
||||||
|
- Fix regression in hash calculation
|
||||||
|
|
||||||
|
## 2.9.0
|
||||||
|
|
||||||
|
- Update to `node24`
|
||||||
|
- Support running from within a `nix` shell
|
||||||
|
- Consider all installed toolchains for cache key
|
||||||
|
- Use case-insensitive comparison to determine exact cache hit
|
||||||
|
|
||||||
|
## 2.8.2
|
||||||
|
|
||||||
|
- Don't overwrite env for cargo-metadata call
|
||||||
|
|
||||||
## 2.8.1
|
## 2.8.1
|
||||||
|
|
||||||
- Set empty `CARGO_ENCODED_RUSTFLAGS` when retrieving metadata
|
- Set empty `CARGO_ENCODED_RUSTFLAGS` when retrieving metadata
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sensible defaults.
|
|||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
# selecting a toolchain either by action or manual `rustup` calls should happen
|
# 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
|
# before the plugin, as the cache uses the current rustc version as its cache key
|
||||||
@@ -28,6 +28,16 @@ sensible defaults.
|
|||||||
# default: empty
|
# default: empty
|
||||||
key: ""
|
key: ""
|
||||||
|
|
||||||
|
# If the automatic `job`-based cache key should include the job id.
|
||||||
|
# default: "true"
|
||||||
|
add-job-id-key: ""
|
||||||
|
|
||||||
|
# Whether the a hash of the rust environment should be included in the cache key.
|
||||||
|
# This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files,
|
||||||
|
# and .cargo/config.toml files (if present), as well as the specified 'env-vars'.
|
||||||
|
# default: "true"
|
||||||
|
add-rust-environment-hash-key: ""
|
||||||
|
|
||||||
# A whitespace separated list of env-var *prefixes* who's value contributes
|
# A whitespace separated list of env-var *prefixes* who's value contributes
|
||||||
# to the environment cache key.
|
# to the environment cache key.
|
||||||
# The env-vars are matched by *prefix*, so the default `RUST` var will
|
# The env-vars are matched by *prefix*, so the default `RUST` var will
|
||||||
@@ -82,13 +92,23 @@ sensible defaults.
|
|||||||
lookup-only: ""
|
lookup-only: ""
|
||||||
|
|
||||||
# Specifies what to use as the backend providing cache
|
# Specifies what to use as the backend providing cache
|
||||||
# Can be set to "github", "buildjet", or "warpbuild"
|
# Can be set to "github", or "warpbuild"
|
||||||
# default: "github"
|
# default: "github"
|
||||||
cache-provider: ""
|
cache-provider: ""
|
||||||
|
|
||||||
# Determines whether to cache the ~/.cargo/bin directory.
|
# Determines whether to cache the ~/.cargo/bin directory.
|
||||||
# default: "true"
|
# default: "true"
|
||||||
cache-bin: ""
|
cache-bin: ""
|
||||||
|
|
||||||
|
# A format string used to format commands to be run, i.e. `rustc` and `cargo`.
|
||||||
|
# Must contain exactly one occurance of `{0}`, which is the formatting fragment
|
||||||
|
# that will be replaced with the `rustc` or `cargo` command. This is necessary
|
||||||
|
# when using Nix or other setup that requires running these commands within a
|
||||||
|
# specific shell, otherwise the system `rustc` and `cargo` will be run.
|
||||||
|
# default: "{0}"
|
||||||
|
cmd-format: ""
|
||||||
|
# To run within a Nix shell (using the default dev shell of a flake in the repo root):
|
||||||
|
cmd-format: nix develop -c {0}
|
||||||
```
|
```
|
||||||
|
|
||||||
Further examples are available in the [.github/workflows](./.github/workflows/) directory.
|
Further examples are available in the [.github/workflows](./.github/workflows/) directory.
|
||||||
@@ -121,12 +141,15 @@ This action currently caches the following files/directories:
|
|||||||
|
|
||||||
This cache is automatically keyed by:
|
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 github [`job_id`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_id)
|
||||||
- the rustc release / host / hash,
|
(if `add-job-id-key` is `"true"`),
|
||||||
- the value of some compiler-specific environment variables (eg. RUSTFLAGS, etc), and
|
- the rustc release / host / hash (for all installed toolchains when
|
||||||
- a hash of all `Cargo.lock` / `Cargo.toml` files found anywhere in the repository (if present).
|
available),
|
||||||
- a hash of all `rust-toolchain` / `rust-toolchain.toml` files in the root of the repository (if present).
|
- the following values, if `add-rust-environment-hash-key` is `"true"`:
|
||||||
- a hash of all `.cargo/config.toml` files in the root of the repository (if present).
|
- 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).
|
||||||
|
- a hash of all `.cargo/config.toml` files in the root of the repository (if present).
|
||||||
|
|
||||||
An additional input `key` can be provided if the builtin keys are not sufficient.
|
An additional input `key` can be provided if the builtin keys are not sufficient.
|
||||||
|
|
||||||
@@ -187,5 +210,5 @@ to see those details as well as further details related to caching operations.
|
|||||||
- The cache cleaning process currently removes all the files from `~/.cargo/bin`
|
- The cache cleaning process currently removes all the files from `~/.cargo/bin`
|
||||||
that were present before the action ran (for example `rustc`), by default.
|
that were present before the action ran (for example `rustc`), by default.
|
||||||
This can be an issue on long-running self-hosted runners, where such state
|
This can be an issue on long-running self-hosted runners, where such state
|
||||||
is expected to be preserved across runs. You can work around this by setting
|
is expected to be preserved across runs. You can work around this by setting
|
||||||
`cache-bin: "false"`.
|
`cache-bin: "false"`.
|
||||||
|
|||||||
+16
-4
@@ -12,6 +12,14 @@ inputs:
|
|||||||
key:
|
key:
|
||||||
description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs."
|
description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs."
|
||||||
required: false
|
required: false
|
||||||
|
add-job-id-key:
|
||||||
|
description: "If the automatic `job`-based cache key should include the job id. Defaults to true."
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
add-rust-environment-hash-key:
|
||||||
|
description: "Weather the a hash of the rust environment should be included in the cache key. This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files, and .cargo/config.toml files (if present), as well as the specified 'env-vars'. Defaults to true."
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
env-vars:
|
env-vars:
|
||||||
description: "Additional environment variables to include in the cache key, separated by spaces."
|
description: "Additional environment variables to include in the cache key, separated by spaces."
|
||||||
required: false
|
required: false
|
||||||
@@ -41,7 +49,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
cache-provider:
|
cache-provider:
|
||||||
description: "Determines which provider to use for caching. Options are github, buildjet, or warpbuild. Defaults to github."
|
description: "Determines which provider to use for caching. Options are github, or warpbuild. Defaults to github."
|
||||||
required: false
|
required: false
|
||||||
default: "github"
|
default: "github"
|
||||||
cache-bin:
|
cache-bin:
|
||||||
@@ -52,13 +60,17 @@ inputs:
|
|||||||
description: "Check if a cache entry exists without downloading the cache"
|
description: "Check if a cache entry exists without downloading the cache"
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
cmd-format:
|
||||||
|
description: "A format string used to format commands to be run, i.e. `rustc` and `cargo`."
|
||||||
|
required: false
|
||||||
|
default: "{0}"
|
||||||
outputs:
|
outputs:
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: "A boolean value that indicates an exact match was found."
|
description: "A boolean value that indicates an exact match was found."
|
||||||
runs:
|
runs:
|
||||||
using: "node20"
|
using: "node24"
|
||||||
main: "dist/restore/index.js"
|
main: "dist/restore.js"
|
||||||
post: "dist/save/index.js"
|
post: "dist/save.js"
|
||||||
post-if: "success() || env.CACHE_ON_FAILURE == 'true'"
|
post-if: "success() || env.CACHE_ON_FAILURE == 'true'"
|
||||||
branding:
|
branding:
|
||||||
icon: "archive"
|
icon: "archive"
|
||||||
|
|||||||
Vendored
+48677
File diff suppressed because it is too large
Load Diff
Vendored
+247742
File diff suppressed because one or more lines are too long
Vendored
+35163
File diff suppressed because one or more lines are too long
Vendored
+101
@@ -0,0 +1,101 @@
|
|||||||
|
import { e as error, g as getCacheProvider, a as getInput, b as exportVariable, C as CacheConfig, i as info, c as cleanTargetDir, r as reportError, s as setOutput } from './cleanup-BWEbZ6YT.js';
|
||||||
|
import 'os';
|
||||||
|
import 'crypto';
|
||||||
|
import 'fs';
|
||||||
|
import 'path';
|
||||||
|
import 'http';
|
||||||
|
import 'https';
|
||||||
|
import 'net';
|
||||||
|
import 'tls';
|
||||||
|
import 'events';
|
||||||
|
import 'assert';
|
||||||
|
import 'util';
|
||||||
|
import 'node:assert';
|
||||||
|
import 'node:net';
|
||||||
|
import 'node:http';
|
||||||
|
import 'node:stream';
|
||||||
|
import 'node:buffer';
|
||||||
|
import 'node:util';
|
||||||
|
import 'node:querystring';
|
||||||
|
import 'node:events';
|
||||||
|
import 'node:diagnostics_channel';
|
||||||
|
import 'node:tls';
|
||||||
|
import 'node:zlib';
|
||||||
|
import 'node:perf_hooks';
|
||||||
|
import 'node:util/types';
|
||||||
|
import 'node:worker_threads';
|
||||||
|
import 'node:url';
|
||||||
|
import 'node:async_hooks';
|
||||||
|
import 'node:console';
|
||||||
|
import 'node:dns';
|
||||||
|
import 'string_decoder';
|
||||||
|
import 'child_process';
|
||||||
|
import 'timers';
|
||||||
|
import 'stream';
|
||||||
|
import 'fs/promises';
|
||||||
|
|
||||||
|
process.on("uncaughtException", (e) => {
|
||||||
|
error(e.message);
|
||||||
|
if (e.stack) {
|
||||||
|
error(e.stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
async function run() {
|
||||||
|
const cacheProvider = await getCacheProvider();
|
||||||
|
if (!cacheProvider.cache.isFeatureAvailable()) {
|
||||||
|
setCacheHitOutput(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var cacheOnFailure = getInput("cache-on-failure").toLowerCase();
|
||||||
|
if (cacheOnFailure !== "true") {
|
||||||
|
cacheOnFailure = "false";
|
||||||
|
}
|
||||||
|
var lookupOnly = getInput("lookup-only").toLowerCase() === "true";
|
||||||
|
exportVariable("CACHE_ON_FAILURE", cacheOnFailure);
|
||||||
|
exportVariable("CARGO_INCREMENTAL", 0);
|
||||||
|
const config = await CacheConfig.new();
|
||||||
|
config.printInfo(cacheProvider);
|
||||||
|
info("");
|
||||||
|
info(`... ${lookupOnly ? "Checking" : "Restoring"} cache ...`);
|
||||||
|
const key = config.cacheKey;
|
||||||
|
// Pass a copy of cachePaths to avoid mutating the original array as reported by:
|
||||||
|
// https://github.com/actions/toolkit/pull/1378
|
||||||
|
// TODO: remove this once the underlying bug is fixed.
|
||||||
|
const restoreKey = await cacheProvider.cache.restoreCache(config.cachePaths.slice(), key, [config.restoreKey], {
|
||||||
|
lookupOnly,
|
||||||
|
});
|
||||||
|
if (restoreKey) {
|
||||||
|
const match = restoreKey.localeCompare(key, undefined, {
|
||||||
|
sensitivity: "accent",
|
||||||
|
}) === 0;
|
||||||
|
info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
||||||
|
if (!match) {
|
||||||
|
// pre-clean the target directory on cache mismatch
|
||||||
|
for (const workspace of config.workspaces) {
|
||||||
|
try {
|
||||||
|
await cleanTargetDir(workspace.target, [], true);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
// We restored the cache but it is not a full match.
|
||||||
|
config.saveState();
|
||||||
|
}
|
||||||
|
setCacheHitOutput(match);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
info("No cache found.");
|
||||||
|
config.saveState();
|
||||||
|
setCacheHitOutput(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
setCacheHitOutput(false);
|
||||||
|
reportError(e);
|
||||||
|
}
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
function setCacheHitOutput(cacheHit) {
|
||||||
|
setOutput("cache-hit", cacheHit.toString());
|
||||||
|
}
|
||||||
|
run();
|
||||||
Vendored
-149396
File diff suppressed because one or more lines are too long
Vendored
+121
@@ -0,0 +1,121 @@
|
|||||||
|
import { e as error, g as getCacheProvider, a as getInput, d as isCacheUpToDate, i as info, C as CacheConfig, c as cleanTargetDir, f as debug, h as cleanRegistry, j as cleanBin, k as cleanGit, r as reportError, l as exec } from './cleanup-BWEbZ6YT.js';
|
||||||
|
import 'os';
|
||||||
|
import 'crypto';
|
||||||
|
import 'fs';
|
||||||
|
import 'path';
|
||||||
|
import 'http';
|
||||||
|
import 'https';
|
||||||
|
import 'net';
|
||||||
|
import 'tls';
|
||||||
|
import 'events';
|
||||||
|
import 'assert';
|
||||||
|
import 'util';
|
||||||
|
import 'node:assert';
|
||||||
|
import 'node:net';
|
||||||
|
import 'node:http';
|
||||||
|
import 'node:stream';
|
||||||
|
import 'node:buffer';
|
||||||
|
import 'node:util';
|
||||||
|
import 'node:querystring';
|
||||||
|
import 'node:events';
|
||||||
|
import 'node:diagnostics_channel';
|
||||||
|
import 'node:tls';
|
||||||
|
import 'node:zlib';
|
||||||
|
import 'node:perf_hooks';
|
||||||
|
import 'node:util/types';
|
||||||
|
import 'node:worker_threads';
|
||||||
|
import 'node:url';
|
||||||
|
import 'node:async_hooks';
|
||||||
|
import 'node:console';
|
||||||
|
import 'node:dns';
|
||||||
|
import 'string_decoder';
|
||||||
|
import 'child_process';
|
||||||
|
import 'timers';
|
||||||
|
import 'stream';
|
||||||
|
import 'fs/promises';
|
||||||
|
|
||||||
|
process.on("uncaughtException", (e) => {
|
||||||
|
error(e.message);
|
||||||
|
if (e.stack) {
|
||||||
|
error(e.stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
async function run() {
|
||||||
|
const cacheProvider = await getCacheProvider();
|
||||||
|
const save = getInput("save-if").toLowerCase() || "true";
|
||||||
|
if (!(cacheProvider.cache.isFeatureAvailable() && save === "true")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (isCacheUpToDate()) {
|
||||||
|
info(`Cache up-to-date.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const config = CacheConfig.fromState();
|
||||||
|
config.printInfo(cacheProvider);
|
||||||
|
info("");
|
||||||
|
// TODO: remove this once https://github.com/actions/toolkit/pull/553 lands
|
||||||
|
if (process.env["RUNNER_OS"] == "macOS") {
|
||||||
|
await macOsWorkaround();
|
||||||
|
}
|
||||||
|
const workspaceCrates = getInput("cache-workspace-crates").toLowerCase() || "false";
|
||||||
|
const allPackages = [];
|
||||||
|
for (const workspace of config.workspaces) {
|
||||||
|
const packages = await workspace.getPackagesOutsideWorkspaceRoot(config.cmdFormat);
|
||||||
|
if (workspaceCrates === "true") {
|
||||||
|
const wsMembers = await workspace.getWorkspaceMembers(config.cmdFormat);
|
||||||
|
packages.push(...wsMembers);
|
||||||
|
}
|
||||||
|
allPackages.push(...packages);
|
||||||
|
try {
|
||||||
|
info(`... Cleaning ${workspace.target} ...`);
|
||||||
|
await cleanTargetDir(workspace.target, packages);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
debug(`${e.stack}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const crates = getInput("cache-all-crates").toLowerCase() || "false";
|
||||||
|
info(`... Cleaning cargo registry (cache-all-crates: ${crates}) ...`);
|
||||||
|
await cleanRegistry(allPackages, crates !== "true");
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
debug(`${e.stack}`);
|
||||||
|
}
|
||||||
|
if (config.cacheBin) {
|
||||||
|
try {
|
||||||
|
info(`... Cleaning cargo/bin ...`);
|
||||||
|
await cleanBin(config.cargoBins);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
debug(`${e.stack}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
info(`... Cleaning cargo git cache ...`);
|
||||||
|
await cleanGit(allPackages);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
debug(`${e.stack}`);
|
||||||
|
}
|
||||||
|
info(`... Saving cache ...`);
|
||||||
|
// Pass a copy of cachePaths to avoid mutating the original array as reported by:
|
||||||
|
// https://github.com/actions/toolkit/pull/1378
|
||||||
|
// TODO: remove this once the underlying bug is fixed.
|
||||||
|
await cacheProvider.cache.saveCache(config.cachePaths.slice(), config.cacheKey);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
reportError(e);
|
||||||
|
}
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
run();
|
||||||
|
async function macOsWorkaround() {
|
||||||
|
try {
|
||||||
|
// Workaround for https://github.com/actions/cache/issues/403
|
||||||
|
// Also see https://github.com/rust-lang/cargo/issues/8603
|
||||||
|
await exec("sudo", ["/usr/sbin/purge"], { silent: true });
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
Vendored
-149419
File diff suppressed because one or more lines are too long
Vendored
+1825
File diff suppressed because it is too large
Load Diff
Generated
+1736
-326
File diff suppressed because it is too large
Load Diff
+24
-12
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "rust-cache",
|
"name": "rust-cache",
|
||||||
"version": "2.8.1",
|
"version": "2.9.2",
|
||||||
"description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
|
"description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
@@ -21,23 +21,35 @@
|
|||||||
"url": "https://github.com/sponsors/Swatinem"
|
"url": "https://github.com/sponsors/Swatinem"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/Swatinem/rust-cache#readme",
|
"homepage": "https://github.com/Swatinem/rust-cache#readme",
|
||||||
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0",
|
"@actions/cache": "^6.2.0",
|
||||||
|
"@actions/core": "^3.0.1",
|
||||||
|
"@actions/exec": "^3.0.0",
|
||||||
|
"@actions/glob": "^0.7.0",
|
||||||
|
"@actions/io": "^3.0.2",
|
||||||
"@actions/warpbuild-cache": "npm:github-actions.warp-cache@1.4.7",
|
"@actions/warpbuild-cache": "npm:github-actions.warp-cache@1.4.7",
|
||||||
"@actions/cache": "^4.0.5",
|
"smol-toml": "^1.7.1"
|
||||||
"@actions/core": "^1.11.1",
|
},
|
||||||
"@actions/exec": "^1.1.1",
|
"overrides": {
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/cache": {
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/glob": "$@actions/glob"
|
||||||
"smol-toml": "^1.4.2"
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.3.0",
|
"@rollup/plugin-commonjs": "^29.0.3",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||||
|
"@types/node": "^26.1.2",
|
||||||
"linefix": "^0.1.1",
|
"linefix": "^0.1.1",
|
||||||
"typescript": "5.9.2"
|
"rollup": "^4.62.4",
|
||||||
|
"typescript": "7.0.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "ncc build --target es2020 -o dist/restore src/restore.ts && ncc build --target es2020 -o dist/save src/save.ts && linefix dist"
|
"clean": "node -e \"(async () => { try { await require('fs/promises').rm('dist', { recursive: true }); } catch {} })()\"",
|
||||||
|
"prebuild": "npm run clean",
|
||||||
|
"build": "tsc && rollup --config .build/rollup.config.js",
|
||||||
|
"prepublishOnly": "npm run test",
|
||||||
|
"prepare": "npm run build && linefix dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import commonjs from "@rollup/plugin-commonjs";
|
||||||
|
import json from "@rollup/plugin-json";
|
||||||
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||||
|
import type { RollupWatchOptions } from "rollup";
|
||||||
|
|
||||||
|
const config: RollupWatchOptions = {
|
||||||
|
input: ["./.build/src/restore.js", "./.build/src/save.js"],
|
||||||
|
output: { dir: "./dist", format: "es" },
|
||||||
|
plugins: [nodeResolve({ preferBuiltins: true }), commonjs(), json()],
|
||||||
|
};
|
||||||
|
export default config;
|
||||||
+36
-38
@@ -3,9 +3,9 @@ import * as io from "@actions/io";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
import { CARGO_HOME } from "./config";
|
import { CARGO_HOME } from "./config.js";
|
||||||
import { exists } from "./utils";
|
import { exists } from "./utils.js";
|
||||||
import { Packages } from "./workspace";
|
import { Packages } from "./workspace.js";
|
||||||
|
|
||||||
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp = false) {
|
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp = false) {
|
||||||
core.debug(`cleaning target directory "${targetDir}"`);
|
core.debug(`cleaning target directory "${targetDir}"`);
|
||||||
@@ -15,15 +15,19 @@ export async function cleanTargetDir(targetDir: string, packages: Packages, chec
|
|||||||
for await (const dirent of dir) {
|
for await (const dirent of dir) {
|
||||||
if (dirent.isDirectory()) {
|
if (dirent.isDirectory()) {
|
||||||
let dirName = path.join(dir.path, dirent.name);
|
let dirName = path.join(dir.path, dirent.name);
|
||||||
// is it a profile dir, or a nested target dir?
|
// Target-triple directories do not contain Cargo's target directory
|
||||||
let isNestedTarget =
|
// markers, so identify profiles by their artifact directories as well.
|
||||||
(await exists(path.join(dirName, "CACHEDIR.TAG"))) || (await exists(path.join(dirName, ".rustc_info.json")));
|
const isProfile =
|
||||||
|
dirent.name === "tests" ||
|
||||||
|
(await exists(path.join(dirName, "build"))) ||
|
||||||
|
(await exists(path.join(dirName, ".fingerprint"))) ||
|
||||||
|
(await exists(path.join(dirName, "deps")));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isNestedTarget) {
|
if (isProfile) {
|
||||||
await cleanTargetDir(dirName, packages, checkTimestamp);
|
|
||||||
} else {
|
|
||||||
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
||||||
|
} else {
|
||||||
|
await cleanTargetDir(dirName, packages, checkTimestamp);
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
} else if (dirent.name !== "CACHEDIR.TAG") {
|
} else if (dirent.name !== "CACHEDIR.TAG") {
|
||||||
@@ -58,7 +62,7 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||||
await rmExcept(profileDir, keepProfile);
|
await rmExcept(profileDir, keepProfile);
|
||||||
|
|
||||||
const keepPkg = new Set(packages.map((p) => p.name));
|
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
|
||||||
await rmExcept(path.join(profileDir, "build"), keepPkg, checkTimestamp);
|
await rmExcept(path.join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||||
await rmExcept(path.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
|
await rmExcept(path.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
|
||||||
|
|
||||||
@@ -75,21 +79,6 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||||||
await rmExcept(path.join(profileDir, "deps"), keepDeps, checkTimestamp);
|
await rmExcept(path.join(profileDir, "deps"), keepDeps, checkTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean the cargo bin directory, removing the binaries that existed
|
* Clean the cargo bin directory, removing the binaries that existed
|
||||||
* when the action started, as they were not created by the build.
|
* when the action started, as they were not created by the build.
|
||||||
@@ -97,15 +86,11 @@ export async function getCargoBins(): Promise<Set<string>> {
|
|||||||
* @param oldBins The binaries that existed when the action started.
|
* @param oldBins The binaries that existed when the action started.
|
||||||
*/
|
*/
|
||||||
export async function cleanBin(oldBins: Array<string>) {
|
export async function cleanBin(oldBins: Array<string>) {
|
||||||
const bins = await getCargoBins();
|
const binsToRemove = new Set<string>(oldBins);
|
||||||
|
|
||||||
for (const bin of oldBins) {
|
|
||||||
bins.delete(bin);
|
|
||||||
}
|
|
||||||
|
|
||||||
const dir = await fs.promises.opendir(path.join(CARGO_HOME, "bin"));
|
const dir = await fs.promises.opendir(path.join(CARGO_HOME, "bin"));
|
||||||
for await (const dirent of dir) {
|
for await (const dirent of dir) {
|
||||||
if (dirent.isFile() && !bins.has(dirent.name)) {
|
if (dirent.isFile() && binsToRemove.has(dirent.name)) {
|
||||||
await rm(dir.path, dirent);
|
await rm(dir.path, dirent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +99,7 @@ export async function cleanBin(oldBins: Array<string>) {
|
|||||||
export async function cleanRegistry(packages: Packages, crates = true) {
|
export async function cleanRegistry(packages: Packages, crates = true) {
|
||||||
// remove `.cargo/credentials.toml`
|
// remove `.cargo/credentials.toml`
|
||||||
try {
|
try {
|
||||||
const credentials = path.join(CARGO_HOME, ".cargo", "credentials.toml");
|
const credentials = path.join(CARGO_HOME, "credentials.toml");
|
||||||
core.debug(`deleting "${credentials}"`);
|
core.debug(`deleting "${credentials}"`);
|
||||||
await fs.promises.unlink(credentials);
|
await fs.promises.unlink(credentials);
|
||||||
} catch {}
|
} catch {}
|
||||||
@@ -264,6 +249,12 @@ const ONE_WEEK = 7 * 24 * 3600 * 1000;
|
|||||||
* Otherwise, it will remove everything that does not match any string in the
|
* Otherwise, it will remove everything that does not match any string in the
|
||||||
* `keepPrefix` set.
|
* `keepPrefix` set.
|
||||||
* The matching strips and trailing `-$hash` suffix.
|
* The matching strips and trailing `-$hash` suffix.
|
||||||
|
*
|
||||||
|
* Cargo's newer `build-dir` layout (rust-lang/cargo#17258) nests the hash as
|
||||||
|
* a subdirectory instead of appending it, so entries there are bare package
|
||||||
|
* names with no suffix to strip. Check for an exact match first so those
|
||||||
|
* names (which may themselves contain hyphens) aren't mistaken for a
|
||||||
|
* `<name>-<hash>` entry from the old layout and truncated incorrectly.
|
||||||
*/
|
*/
|
||||||
async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp = false) {
|
async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp = false) {
|
||||||
const dir = await fs.promises.opendir(dirName);
|
const dir = await fs.promises.opendir(dirName);
|
||||||
@@ -281,14 +272,21 @@ async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp
|
|||||||
|
|
||||||
let name = dirent.name;
|
let name = dirent.name;
|
||||||
|
|
||||||
// strip the trailing hash
|
// in Cargo's V1 layout, all packages are suffixed by their hash.
|
||||||
const idx = name.lastIndexOf("-");
|
// in V2, all package hashes are subdirectories instead.
|
||||||
if (idx !== -1) {
|
// Check both possible naming standards for packages and accept either.
|
||||||
name = name.slice(0, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// v2 package format
|
||||||
if (!keepPrefix.has(name)) {
|
if (!keepPrefix.has(name)) {
|
||||||
await rm(dir.path, dirent);
|
// now check for v1 package format
|
||||||
|
// strip the trailing hash
|
||||||
|
const idx = name.lastIndexOf("-");
|
||||||
|
if (idx !== -1) {
|
||||||
|
name = name.slice(0, idx);
|
||||||
|
}
|
||||||
|
if (!keepPrefix.has(name)) {
|
||||||
|
await rm(dir.path, dirent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+177
-109
@@ -1,15 +1,14 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as glob from "@actions/glob";
|
import * as glob from "@actions/glob";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import fs from "fs";
|
import fs from "fs/promises";
|
||||||
import fs_promises from "fs/promises";
|
import { createReadStream } from "fs";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import * as toml from "smol-toml";
|
import * as toml from "smol-toml";
|
||||||
|
|
||||||
import { getCargoBins } from "./cleanup";
|
import { CacheProvider, exists, getCmdOutput } from "./utils.js";
|
||||||
import { CacheProvider, exists, getCmdOutput } from "./utils";
|
import { Workspace } from "./workspace.js";
|
||||||
import { Workspace } from "./workspace";
|
|
||||||
|
|
||||||
const HOME = os.homedir();
|
const HOME = os.homedir();
|
||||||
export const CARGO_HOME = process.env.CARGO_HOME || path.join(HOME, ".cargo");
|
export const CARGO_HOME = process.env.CARGO_HOME || path.join(HOME, ".cargo");
|
||||||
@@ -18,6 +17,9 @@ const STATE_CONFIG = "RUST_CACHE_CONFIG";
|
|||||||
const HASH_LENGTH = 8;
|
const HASH_LENGTH = 8;
|
||||||
|
|
||||||
export class CacheConfig {
|
export class CacheConfig {
|
||||||
|
/** A format string for running commands */
|
||||||
|
public cmdFormat: string = "";
|
||||||
|
|
||||||
/** All the paths we want to cache */
|
/** All the paths we want to cache */
|
||||||
public cachePaths: Array<string> = [];
|
public cachePaths: Array<string> = [];
|
||||||
/** The primary cache key */
|
/** The primary cache key */
|
||||||
@@ -37,7 +39,7 @@ export class CacheConfig {
|
|||||||
/** The prefix portion of the cache key */
|
/** The prefix portion of the cache key */
|
||||||
private keyPrefix = "";
|
private keyPrefix = "";
|
||||||
/** The rust version considered for the cache key */
|
/** The rust version considered for the cache key */
|
||||||
private keyRust = "";
|
private keyRust: Array<string> = [];
|
||||||
/** The environment variables considered for the cache key */
|
/** The environment variables considered for the cache key */
|
||||||
private keyEnvs: Array<string> = [];
|
private keyEnvs: Array<string> = [];
|
||||||
/** The files considered for the cache key */
|
/** The files considered for the cache key */
|
||||||
@@ -53,6 +55,17 @@ export class CacheConfig {
|
|||||||
static async new(): Promise<CacheConfig> {
|
static async new(): Promise<CacheConfig> {
|
||||||
const self = new CacheConfig();
|
const self = new CacheConfig();
|
||||||
|
|
||||||
|
let cmdFormat = core.getInput("cmd-format");
|
||||||
|
if (cmdFormat) {
|
||||||
|
const placeholderMatches = cmdFormat.match(/\{0\}/g);
|
||||||
|
if (!placeholderMatches || placeholderMatches.length !== 1) {
|
||||||
|
cmdFormat = "{0}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cmdFormat = "{0}";
|
||||||
|
}
|
||||||
|
self.cmdFormat = cmdFormat;
|
||||||
|
|
||||||
// Construct key prefix:
|
// Construct key prefix:
|
||||||
// This uses either the `shared-key` input,
|
// This uses either the `shared-key` input,
|
||||||
// or the `key` input combined with the `job` key.
|
// or the `key` input combined with the `job` key.
|
||||||
@@ -69,7 +82,7 @@ export class CacheConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const job = process.env.GITHUB_JOB;
|
const job = process.env.GITHUB_JOB;
|
||||||
if (job) {
|
if (job && core.getInput("add-job-id-key").toLowerCase() == "true") {
|
||||||
key += `-${job}`;
|
key += `-${job}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,14 +102,10 @@ export class CacheConfig {
|
|||||||
// resulting environment hash.
|
// resulting environment hash.
|
||||||
|
|
||||||
let hasher = crypto.createHash("sha1");
|
let hasher = crypto.createHash("sha1");
|
||||||
const rustVersion = await getRustVersion();
|
const rustVersions = (self.keyRust = await getRustVersions(cmdFormat));
|
||||||
|
for (const rustVersion of rustVersions) {
|
||||||
let keyRust = `${rustVersion.release} ${rustVersion.host}`;
|
hasher.update(rustVersion);
|
||||||
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
|
// these prefixes should cover most of the compiler / rust / cargo keys
|
||||||
const envPrefixes = ["CARGO", "CC", "CFLAGS", "CXX", "CMAKE", "RUST"];
|
const envPrefixes = ["CARGO", "CC", "CFLAGS", "CXX", "CMAKE", "RUST"];
|
||||||
@@ -116,7 +125,10 @@ export class CacheConfig {
|
|||||||
|
|
||||||
self.keyEnvs = keyEnvs;
|
self.keyEnvs = keyEnvs;
|
||||||
|
|
||||||
key += `-${digest(hasher)}`;
|
// Add job hash suffix if 'add-rust-environment-hash-key' is true
|
||||||
|
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||||
|
key += `-${digest(hasher)}`;
|
||||||
|
}
|
||||||
|
|
||||||
self.restoreKey = key;
|
self.restoreKey = key;
|
||||||
|
|
||||||
@@ -139,111 +151,115 @@ export class CacheConfig {
|
|||||||
}
|
}
|
||||||
self.workspaces = workspaces;
|
self.workspaces = workspaces;
|
||||||
|
|
||||||
let keyFiles = await globFiles(".cargo/config.toml\nrust-toolchain\nrust-toolchain.toml");
|
// Add hash suffix of all rust environment lockfiles + manifests if
|
||||||
const parsedKeyFiles = []; // keyFiles that are parsed, pre-processed and hashed
|
// 'add-rust-environment-hash-key' is true
|
||||||
|
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||||
|
let keyFiles = await globFiles(".cargo/config.toml\nrust-toolchain\nrust-toolchain.toml");
|
||||||
|
const parsedKeyFiles = []; // keyFiles that are parsed, pre-processed and hashed
|
||||||
|
|
||||||
hasher = crypto.createHash("sha1");
|
hasher = crypto.createHash("sha1");
|
||||||
|
|
||||||
for (const workspace of workspaces) {
|
for (const workspace of workspaces) {
|
||||||
const root = workspace.root;
|
const root = workspace.root;
|
||||||
keyFiles.push(
|
keyFiles.push(
|
||||||
...(await globFiles(
|
...(await globFiles(
|
||||||
`${root}/**/.cargo/config.toml\n${root}/**/rust-toolchain\n${root}/**/rust-toolchain.toml`,
|
`${root}/**/.cargo/config.toml\n${root}/**/rust-toolchain\n${root}/**/rust-toolchain.toml`,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const workspaceMembers = await workspace.getWorkspaceMembers();
|
const workspaceMembers = await workspace.getWorkspaceMembers(cmdFormat);
|
||||||
|
|
||||||
const cargo_manifests = sort_and_uniq(workspaceMembers.map((member) => path.join(member.path, "Cargo.toml")));
|
const cargo_manifests = sort_and_uniq(workspaceMembers.map((member) => path.join(member.path, "Cargo.toml")));
|
||||||
|
|
||||||
for (const cargo_manifest of cargo_manifests) {
|
for (const cargo_manifest of cargo_manifests) {
|
||||||
try {
|
try {
|
||||||
const content = await fs_promises.readFile(cargo_manifest, { encoding: "utf8" });
|
const content = await fs.readFile(cargo_manifest, { encoding: "utf8" });
|
||||||
// Use any since TomlPrimitive is not exposed
|
// Use any since TomlPrimitive is not exposed
|
||||||
const parsed = toml.parse(content) as { [key: string]: any };
|
const parsed = toml.parse(content) as { [key: string]: any };
|
||||||
|
|
||||||
if ("package" in parsed) {
|
if ("package" in parsed) {
|
||||||
const pack = parsed.package;
|
const pack = parsed.package;
|
||||||
if ("version" in pack) {
|
if ("version" in pack) {
|
||||||
pack["version"] = "0.0.0";
|
pack["version"] = "0.0.0";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const prefix of ["", "build-", "dev-"]) {
|
|
||||||
const section_name = `${prefix}dependencies`;
|
|
||||||
if (!(section_name in parsed)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const deps = parsed[section_name];
|
|
||||||
|
|
||||||
for (const key of Object.keys(deps)) {
|
|
||||||
const dep = deps[key];
|
|
||||||
|
|
||||||
try {
|
|
||||||
if ("path" in dep) {
|
|
||||||
dep.version = "0.0.0";
|
|
||||||
dep.path = "";
|
|
||||||
}
|
|
||||||
} catch (_e) {
|
|
||||||
// Not an object, probably a string (version),
|
|
||||||
// continue.
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const prefix of ["", "build-", "dev-"]) {
|
||||||
|
const section_name = `${prefix}dependencies`;
|
||||||
|
if (!(section_name in parsed)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const deps = parsed[section_name];
|
||||||
|
|
||||||
|
for (const key of Object.keys(deps)) {
|
||||||
|
const dep = deps[key];
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ("path" in dep) {
|
||||||
|
dep.version = "0.0.0";
|
||||||
|
dep.path = "";
|
||||||
|
}
|
||||||
|
} catch (_e) {
|
||||||
|
// Not an object, probably a string (version),
|
||||||
|
// continue.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hasher.update(JSON.stringify(parsed));
|
||||||
|
|
||||||
|
parsedKeyFiles.push(cargo_manifest);
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback to caching them as regular file
|
||||||
|
core.warning(`Error parsing Cargo.toml manifest, fallback to caching entire file: ${e}`);
|
||||||
|
keyFiles.push(cargo_manifest);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasher.update(JSON.stringify(parsed));
|
|
||||||
|
|
||||||
parsedKeyFiles.push(cargo_manifest);
|
|
||||||
} catch (e) {
|
|
||||||
// Fallback to caching them as regular file
|
|
||||||
core.warning(`Error parsing Cargo.toml manifest, fallback to caching entire file: ${e}`);
|
|
||||||
keyFiles.push(cargo_manifest);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const cargo_lock = path.join(workspace.root, "Cargo.lock");
|
const cargo_lock = path.join(workspace.root, "Cargo.lock");
|
||||||
if (await exists(cargo_lock)) {
|
if (await exists(cargo_lock)) {
|
||||||
try {
|
try {
|
||||||
const content = await fs_promises.readFile(cargo_lock, { encoding: "utf8" });
|
const content = await fs.readFile(cargo_lock, { encoding: "utf8" });
|
||||||
const parsed = toml.parse(content);
|
const parsed = toml.parse(content);
|
||||||
|
|
||||||
if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) {
|
if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) {
|
||||||
// Fallback to caching them as regular file since this action
|
// Fallback to caching them as regular file since this action
|
||||||
// can only handle Cargo.lock format version 3
|
// can only handle Cargo.lock format version 3
|
||||||
core.warning("Unsupported Cargo.lock format, fallback to caching entire file");
|
core.warning("Unsupported Cargo.lock format, fallback to caching entire file");
|
||||||
|
keyFiles.push(cargo_lock);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Package without `[[package]].source` and `[[package]].checksum`
|
||||||
|
// are the one with `path = "..."` to crates within the workspace.
|
||||||
|
const packages = (parsed.package as any[]).filter((p: any) => "source" in p || "checksum" in p);
|
||||||
|
|
||||||
|
hasher.update(JSON.stringify(packages));
|
||||||
|
|
||||||
|
parsedKeyFiles.push(cargo_lock);
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback to caching them as regular file
|
||||||
|
core.warning(`Error parsing Cargo.lock manifest, fallback to caching entire file: ${e}`);
|
||||||
keyFiles.push(cargo_lock);
|
keyFiles.push(cargo_lock);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Package without `[[package]].source` and `[[package]].checksum`
|
|
||||||
// are the one with `path = "..."` to crates within the workspace.
|
|
||||||
const packages = (parsed.package as any[]).filter((p: any) => "source" in p || "checksum" in p);
|
|
||||||
|
|
||||||
hasher.update(JSON.stringify(packages));
|
|
||||||
|
|
||||||
parsedKeyFiles.push(cargo_lock);
|
|
||||||
} catch (e) {
|
|
||||||
// Fallback to caching them as regular file
|
|
||||||
core.warning(`Error parsing Cargo.lock manifest, fallback to caching entire file: ${e}`);
|
|
||||||
keyFiles.push(cargo_lock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
keyFiles = sort_and_uniq(keyFiles);
|
||||||
keyFiles = sort_and_uniq(keyFiles);
|
|
||||||
|
|
||||||
for (const file of keyFiles) {
|
for (const file of keyFiles) {
|
||||||
for await (const chunk of fs.createReadStream(file)) {
|
for await (const chunk of createReadStream(file)) {
|
||||||
hasher.update(chunk);
|
hasher.update(chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyFiles.push(...parsedKeyFiles);
|
||||||
|
self.keyFiles = sort_and_uniq(keyFiles);
|
||||||
|
|
||||||
|
let lockHash = digest(hasher);
|
||||||
|
key += `-${lockHash}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let lockHash = digest(hasher);
|
|
||||||
|
|
||||||
keyFiles.push(...parsedKeyFiles);
|
|
||||||
self.keyFiles = sort_and_uniq(keyFiles);
|
|
||||||
|
|
||||||
key += `-${lockHash}`;
|
|
||||||
self.cacheKey = key;
|
self.cacheKey = key;
|
||||||
|
|
||||||
self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
|
self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
|
||||||
@@ -314,7 +330,10 @@ export class CacheConfig {
|
|||||||
core.info(`.. Prefix:`);
|
core.info(`.. Prefix:`);
|
||||||
core.info(` - ${this.keyPrefix}`);
|
core.info(` - ${this.keyPrefix}`);
|
||||||
core.info(`.. Environment considered:`);
|
core.info(`.. Environment considered:`);
|
||||||
core.info(` - Rust Version: ${this.keyRust}`);
|
core.info(` - Rust Versions:`);
|
||||||
|
for (const rust of this.keyRust) {
|
||||||
|
core.info(` - ${rust}`);
|
||||||
|
}
|
||||||
for (const env of this.keyEnvs) {
|
for (const env of this.keyEnvs) {
|
||||||
core.info(` - ${env}`);
|
core.info(` - ${env}`);
|
||||||
}
|
}
|
||||||
@@ -353,30 +372,79 @@ function digest(hasher: crypto.Hash): string {
|
|||||||
return hasher.digest("hex").substring(0, HASH_LENGTH);
|
return hasher.digest("hex").substring(0, HASH_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getCargoBins(): Promise<Set<string>> {
|
||||||
|
const bins = new Set<string>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const dir = await fs.opendir(path.join(CARGO_HOME, "bin"));
|
||||||
|
for await (const dirent of dir) {
|
||||||
|
if (dirent.isFile()) {
|
||||||
|
bins.add(dirent.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
return bins;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getRustVersions(cmdFormat: string): Promise<Array<string>> {
|
||||||
|
const versions = new Set<string>();
|
||||||
|
|
||||||
|
versions.add(parseRustVersion(await getCmdOutput(cmdFormat, "rustc -vV")));
|
||||||
|
|
||||||
|
const stdout = await (async () => {
|
||||||
|
try {
|
||||||
|
return await getCmdOutput(cmdFormat, "rustup toolchain list --quiet");
|
||||||
|
} catch (e) {
|
||||||
|
core.warning(`Error running rustup toolchain list, falling back to default toolchain only: ${e}`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (stdout !== undefined) {
|
||||||
|
for (const toolchain of stdout.split(/[\n\r]+/)) {
|
||||||
|
const trimmed = toolchain.trim();
|
||||||
|
if (!trimmed) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
versions.add(parseRustVersion(await getCmdOutput(cmdFormat, `rustup run ${toolchain} rustc -vV`)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const rustVersions = Array.from(versions);
|
||||||
|
// Doesn't matter how they're sorted, just as long as it's deterministic.
|
||||||
|
rustVersions.sort();
|
||||||
|
return rustVersions;
|
||||||
|
}
|
||||||
|
|
||||||
interface RustVersion {
|
interface RustVersion {
|
||||||
host: string;
|
host: string;
|
||||||
release: string;
|
release: string;
|
||||||
"commit-hash": string;
|
"commit-hash": string;
|
||||||
}
|
}
|
||||||
|
function parseRustVersion(stdout: string): string {
|
||||||
async function getRustVersion(): Promise<RustVersion> {
|
const splits = stdout
|
||||||
const stdout = await getCmdOutput("rustc", ["-vV"]);
|
|
||||||
let splits = stdout
|
|
||||||
.split(/[\n\r]+/)
|
.split(/[\n\r]+/)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map((s) => s.split(":").map((s) => s.trim()))
|
.map((s) => s.split(":").map((s) => s.trim()))
|
||||||
.filter((s) => s.length === 2);
|
.filter((s) => s.length === 2);
|
||||||
return Object.fromEntries(splits);
|
const { release, host, "commit-hash": commitHash } = Object.fromEntries(splits) as RustVersion;
|
||||||
|
return `${release} ${host} ${commitHash}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function globFiles(pattern: string): Promise<string[]> {
|
async function globFiles(pattern: string): Promise<string[]> {
|
||||||
const globber = await glob.create(pattern, {
|
const globber = await glob.create(pattern, {
|
||||||
followSymbolicLinks: false,
|
followSymbolicLinks: false,
|
||||||
});
|
});
|
||||||
// fs.statSync resolve the symbolic link and returns stat for the
|
// fs.stat resolve the symbolic link and returns stat for the
|
||||||
// file it pointed to, so isFile would make sure the resolved
|
// file it pointed to, so isFile would make sure the resolved
|
||||||
// file is actually a regular file.
|
// file is actually a regular file.
|
||||||
return (await globber.glob()).filter((file) => fs.statSync(file).isFile());
|
const files = [];
|
||||||
|
for (const file of await globber.glob()) {
|
||||||
|
const stats = await fs.stat(file);
|
||||||
|
if (stats.isFile()) {
|
||||||
|
files.push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort_and_uniq(a: string[]) {
|
function sort_and_uniq(a: string[]) {
|
||||||
|
|||||||
+8
-5
@@ -1,8 +1,8 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
import { cleanTargetDir } from "./cleanup";
|
import { cleanTargetDir } from "./cleanup.js";
|
||||||
import { CacheConfig } from "./config";
|
import { CacheConfig } from "./config.js";
|
||||||
import { getCacheProvider, reportError } from "./utils";
|
import { getCacheProvider, reportError } from "./utils.js";
|
||||||
|
|
||||||
process.on("uncaughtException", (e) => {
|
process.on("uncaughtException", (e) => {
|
||||||
core.error(e.message);
|
core.error(e.message);
|
||||||
@@ -12,7 +12,7 @@ process.on("uncaughtException", (e) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const cacheProvider = getCacheProvider();
|
const cacheProvider = await getCacheProvider();
|
||||||
|
|
||||||
if (!cacheProvider.cache.isFeatureAvailable()) {
|
if (!cacheProvider.cache.isFeatureAvailable()) {
|
||||||
setCacheHitOutput(false);
|
setCacheHitOutput(false);
|
||||||
@@ -42,7 +42,10 @@ async function run() {
|
|||||||
lookupOnly,
|
lookupOnly,
|
||||||
});
|
});
|
||||||
if (restoreKey) {
|
if (restoreKey) {
|
||||||
const match = restoreKey === key;
|
const match =
|
||||||
|
restoreKey.localeCompare(key, undefined, {
|
||||||
|
sensitivity: "accent",
|
||||||
|
}) === 0;
|
||||||
core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// pre-clean the target directory on cache mismatch
|
// pre-clean the target directory on cache mismatch
|
||||||
|
|||||||
+6
-6
@@ -1,9 +1,9 @@
|
|||||||
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 { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup";
|
import { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup.js";
|
||||||
import { CacheConfig, isCacheUpToDate } from "./config";
|
import { CacheConfig, isCacheUpToDate } from "./config.js";
|
||||||
import { getCacheProvider, reportError } from "./utils";
|
import { getCacheProvider, reportError } from "./utils.js";
|
||||||
|
|
||||||
process.on("uncaughtException", (e) => {
|
process.on("uncaughtException", (e) => {
|
||||||
core.error(e.message);
|
core.error(e.message);
|
||||||
@@ -13,7 +13,7 @@ process.on("uncaughtException", (e) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const cacheProvider = getCacheProvider();
|
const cacheProvider = await getCacheProvider();
|
||||||
|
|
||||||
const save = core.getInput("save-if").toLowerCase() || "true";
|
const save = core.getInput("save-if").toLowerCase() || "true";
|
||||||
|
|
||||||
@@ -39,9 +39,9 @@ async function run() {
|
|||||||
const workspaceCrates = core.getInput("cache-workspace-crates").toLowerCase() || "false";
|
const workspaceCrates = core.getInput("cache-workspace-crates").toLowerCase() || "false";
|
||||||
const allPackages = [];
|
const allPackages = [];
|
||||||
for (const workspace of config.workspaces) {
|
for (const workspace of config.workspaces) {
|
||||||
const packages = await workspace.getPackagesOutsideWorkspaceRoot();
|
const packages = await workspace.getPackagesOutsideWorkspaceRoot(config.cmdFormat);
|
||||||
if (workspaceCrates === "true") {
|
if (workspaceCrates === "true") {
|
||||||
const wsMembers = await workspace.getWorkspaceMembers();
|
const wsMembers = await workspace.getWorkspaceMembers(config.cmdFormat);
|
||||||
packages.push(...wsMembers);
|
packages.push(...wsMembers);
|
||||||
}
|
}
|
||||||
allPackages.push(...packages);
|
allPackages.push(...packages);
|
||||||
|
|||||||
+9
-18
@@ -1,8 +1,5 @@
|
|||||||
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 buildjetCache from "@actions/buildjet-cache";
|
|
||||||
import * as warpbuildCache from "@actions/warpbuild-cache";
|
|
||||||
import * as ghCache from "@actions/cache";
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
export function reportError(e: any) {
|
export function reportError(e: any) {
|
||||||
@@ -15,15 +12,12 @@ export function reportError(e: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCmdOutput(
|
export async function getCmdOutput(cmdFormat: string, cmd: string, options: exec.ExecOptions = {}): Promise<string> {
|
||||||
cmd: string,
|
cmd = cmdFormat.replace("{0}", cmd);
|
||||||
args: Array<string> = [],
|
|
||||||
options: exec.ExecOptions = {},
|
|
||||||
): Promise<string> {
|
|
||||||
let stdout = "";
|
let stdout = "";
|
||||||
let stderr = "";
|
let stderr = "";
|
||||||
try {
|
try {
|
||||||
await exec.exec(cmd, args, {
|
await exec.exec(cmd, [], {
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout(data) {
|
stdout(data) {
|
||||||
@@ -37,7 +31,7 @@ export async function getCmdOutput(
|
|||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
(e as any).commandFailed = {
|
(e as any).commandFailed = {
|
||||||
command: `${cmd} ${args.join(" ")}`,
|
command: cmd,
|
||||||
stderr,
|
stderr,
|
||||||
};
|
};
|
||||||
throw e;
|
throw e;
|
||||||
@@ -46,8 +40,8 @@ export async function getCmdOutput(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GhCache {
|
export interface GhCache {
|
||||||
isFeatureAvailable: typeof ghCache.isFeatureAvailable;
|
isFeatureAvailable: typeof import("@actions/cache").isFeatureAvailable;
|
||||||
restoreCache: typeof ghCache.restoreCache;
|
restoreCache: typeof import("@actions/cache").restoreCache;
|
||||||
saveCache: (paths: string[], key: string) => Promise<string | number>;
|
saveCache: (paths: string[], key: string) => Promise<string | number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,18 +50,15 @@ export interface CacheProvider {
|
|||||||
cache: GhCache;
|
cache: GhCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCacheProvider(): CacheProvider {
|
export async function getCacheProvider(): Promise<CacheProvider> {
|
||||||
const cacheProvider = core.getInput("cache-provider");
|
const cacheProvider = core.getInput("cache-provider");
|
||||||
let cache: GhCache;
|
let cache: GhCache;
|
||||||
switch (cacheProvider) {
|
switch (cacheProvider) {
|
||||||
case "github":
|
case "github":
|
||||||
cache = ghCache;
|
cache = await import("@actions/cache");
|
||||||
break;
|
|
||||||
case "buildjet":
|
|
||||||
cache = buildjetCache;
|
|
||||||
break;
|
break;
|
||||||
case "warpbuild":
|
case "warpbuild":
|
||||||
cache = warpbuildCache;
|
cache = await import("@actions/warpbuild-cache");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`The \`cache-provider\` \`${cacheProvider}\` is not valid.`);
|
throw new Error(`The \`cache-provider\` \`${cacheProvider}\` is not valid.`);
|
||||||
|
|||||||
+18
-10
@@ -1,21 +1,29 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
import { getCmdOutput } from "./utils";
|
import { getCmdOutput } from "./utils.js";
|
||||||
|
|
||||||
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
|
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
|
||||||
|
|
||||||
export class Workspace {
|
export class Workspace {
|
||||||
constructor(public root: string, public target: string) {}
|
constructor(
|
||||||
|
public root: string,
|
||||||
|
public target: string,
|
||||||
|
) {}
|
||||||
|
|
||||||
async getPackages(filter: (p: Meta["packages"][0]) => boolean, ...extraArgs: string[]): Promise<Packages> {
|
async getPackages(
|
||||||
|
cmdFormat: string,
|
||||||
|
filter: (p: Meta["packages"][0]) => boolean,
|
||||||
|
extraArgs?: string,
|
||||||
|
): Promise<Packages> {
|
||||||
|
const cmd = "cargo metadata --all-features --format-version 1" + (extraArgs ? ` ${extraArgs}` : "");
|
||||||
let packages: Packages = [];
|
let packages: Packages = [];
|
||||||
try {
|
try {
|
||||||
core.debug(`collecting metadata for "${this.root}"`);
|
core.debug(`collecting metadata for "${this.root}"`);
|
||||||
const meta: Meta = JSON.parse(
|
const meta: Meta = JSON.parse(
|
||||||
await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1", ...extraArgs], {
|
await getCmdOutput(cmdFormat, cmd, {
|
||||||
cwd: this.root,
|
cwd: this.root,
|
||||||
env: { "CARGO_ENCODED_RUSTFLAGS": "" },
|
env: { ...process.env, CARGO_ENCODED_RUSTFLAGS: "" },
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
core.debug(`workspace "${this.root}" has ${meta.packages.length} packages`);
|
core.debug(`workspace "${this.root}" has ${meta.packages.length} packages`);
|
||||||
@@ -29,12 +37,12 @@ export class Workspace {
|
|||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getPackagesOutsideWorkspaceRoot(): Promise<Packages> {
|
public async getPackagesOutsideWorkspaceRoot(cmdFormat: string): Promise<Packages> {
|
||||||
return await this.getPackages((pkg) => !pkg.manifest_path.startsWith(this.root));
|
return await this.getPackages(cmdFormat, (pkg) => !pkg.manifest_path.startsWith(this.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getWorkspaceMembers(): Promise<Packages> {
|
public async getWorkspaceMembers(cmdFormat: string): Promise<Packages> {
|
||||||
return await this.getPackages((_) => true, "--no-deps");
|
return await this.getPackages(cmdFormat, (_) => true, "--no-deps");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs @ { self, nixpkgs, flake-utils, rust-overlay, ... }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system: let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in {
|
||||||
|
devShells.default = with pkgs; mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
autoconf
|
||||||
|
gcc
|
||||||
|
gnumake
|
||||||
|
openssl
|
||||||
|
pkg-config
|
||||||
|
rust-bin.stable.latest.minimal
|
||||||
|
];
|
||||||
|
CARGO_TERM_COLOR = "always";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
+10
-5
@@ -2,20 +2,25 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noEmitOnError": false,
|
"noEmitOnError": false,
|
||||||
"diagnostics": true,
|
"diagnostics": true,
|
||||||
"lib": ["esnext"],
|
"lib": ["es2024"],
|
||||||
|
"types": ["node"],
|
||||||
|
|
||||||
"target": "es2020",
|
"target": "es2024",
|
||||||
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"moduleResolution": "node",
|
|
||||||
"module": "esnext",
|
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|
||||||
|
"incremental": true,
|
||||||
|
"tsBuildInfoFile": ".build/tsconfig.build.tsbuildinfo",
|
||||||
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitReturns": true
|
"noImplicitReturns": true,
|
||||||
|
|
||||||
|
"outDir": ".build"
|
||||||
},
|
},
|
||||||
|
"include": ["src", "rollup.config.ts"],
|
||||||
"exclude": ["dist"]
|
"exclude": ["dist"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user