From 10973de66bfa332de3138e76469529a12463b762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Fri, 21 May 2021 02:09:05 +0200 Subject: [PATCH] Setup CI cache for Elixir and Node dependencies --- .github/workflows/assets.yaml | 16 ++++++++++++++++ .github/workflows/test.yaml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/.github/workflows/assets.yaml b/.github/workflows/assets.yaml index cdc087169..90c01383b 100644 --- a/.github/workflows/assets.yaml +++ b/.github/workflows/assets.yaml @@ -13,6 +13,15 @@ jobs: with: otp-version: '24.0' elixir-version: '1.12.0' + - name: Cache Mix + uses: actions/cache@v2 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix- # Note: we need to get Phoenix and LV because package.json points to them directly - name: Install mix dependencies run: mix deps.get @@ -20,6 +29,13 @@ jobs: uses: actions/setup-node@v2 with: node-version: '14.x' + - name: Cache npm dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install npm dependencies run: npm ci --prefix assets - name: Build assets diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fbf0afec8..81c388300 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,6 +14,15 @@ jobs: with: otp-version: '24.0' elixir-version: '1.12.0' + - name: Cache Mix + uses: actions/cache@v2 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix- - name: Install mix dependencies run: mix deps.get - name: Check formatting @@ -26,6 +35,13 @@ jobs: uses: actions/setup-node@v2 with: node-version: '14.x' + - name: Cache npm dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install npm dependencies run: npm ci --prefix assets - name: Check assets formatting