268: ci: caching updates r=aphelionz a=koivunej

node_modules: It's quite slow on windows (about 3min), linux (50s) and mac is in the between. This is a bit hacky given the patching and whatnot, but I think the hashFiles combination is good.

~/.cargo: this was never cached, but now it should be cached correctly `hashFiles(Cargo.lock)`.

Co-authored-by: Joonas Koivunen <joonas@equilibrium.co>
This commit is contained in:
bors[bot] 2020-07-31 12:55:10 +00:00 committed by GitHub
commit 9b316a3e27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -63,10 +63,27 @@ jobs:
uses: actions/checkout@v2
- name: Cache cargo folder
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cargo
key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }}
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.platform.target }}-dot-cargo-parts-${{ hashFiles('Cargo.lock') }}
- name: Get npm cache directory
id: npm-cache
if: matrix.platform.cross == false
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm (non-cross targets)
uses: actions/cache@v2
if: matrix.platform.cross == false
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json', '**/setup.sh', '**/*.patch') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies ubuntu
if: matrix.platform.host == 'ubuntu-latest'
@ -151,10 +168,10 @@ jobs:
uses: actions/checkout@v2
- name: Cache cargo folder
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cargo
key: lint-cargo
key: lint-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install rust toolchain
uses: hecrj/setup-rust-action@v1
@ -175,10 +192,10 @@ jobs:
uses: actions/checkout@v2
- name: Cache cargo folder
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cargo
key: readme-doctest
key: readme-doctest-${{ hashFiles('Cargo.lock') }}
- name: Install rust toolchain
uses: hecrj/setup-rust-action@v1

View File

@ -8,6 +8,11 @@ if ! [ -f "./package.json" ]; then
exit 1
fi
if [ -d "node_modules" ]; then
echo "Directory exists already: node_modules/" >&2
exit 1
fi
# production will skip the dev dependencies
npm install --production
@ -16,9 +21,6 @@ if [ -d "patches" ]; then
# as we want to apply the patches create in a js-ipfs checkout to our node_modules
# we'll need to remove a few leading path segments to match
# a/packages/interface-ipfs-core/src/refs.js to node_modules/interface-ipfs-core/src/refs.js
#
# cannot use git automation any longer as it will skip any ignored file apparently,
# and node_modules are ignored.
for p in patches/*; do
echo "Applying $(basename "$p")..." >&2
patch -d node_modules/ -p1 < "$p"