This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch chore/actions-improve-caching
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 7943c0cdb017bf5118ff16d04d8669997844da2e
Author: bossenti <[email protected]>
AuthorDate: Sat Feb 18 22:19:27 2023 +0100

    chore(ci): improve caching for dependencies in pr-validation workflow
---
 .github/workflows/pr-validation.yml | 77 +++++++++++++++++++------------------
 1 file changed, 39 insertions(+), 38 deletions(-)

diff --git a/.github/workflows/pr-validation.yml 
b/.github/workflows/pr-validation.yml
index ad8df6074..fac4add0b 100644
--- a/.github/workflows/pr-validation.yml
+++ b/.github/workflows/pr-validation.yml
@@ -30,6 +30,7 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+          cache: 'maven'
 
       - name: Validate java code
         run: mvn clean verify
@@ -45,12 +46,20 @@ jobs:
         with:
           node-version: '16.x'
 
+      - name: Cache dependencies
+        working-directory: ./ui
+        uses: actions/cache@v3
+        env:
+          cache-name: cache-npm-modules
+        with:
+          path: ~/.npm
+          key: npm-${{ hashFiles('package-lock.json') }}
+          restore-keys: npm-
+
       - name: Install dependencies
         working-directory: ./ui
         run: |
-          NODE_PATH=/cache/node_modules
-          NODE_OPTIONS=--max_old_space_size=6096
-          npm install --unsafe-perm --legacy-peer-deps
+          npm install
 
       - name: Format and Lint all files
         working-directory: ./ui
@@ -70,18 +79,31 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+          cache: 'maven'
 
       - name: Set up Node
         uses: actions/setup-node@v3
         with:
           node-version: '16.x'
 
+      - name: Cache NPM dependencies
+        working-directory: ./ui
+        uses: actions/cache@v3
+        env:
+          cache-name: cache-npm-modules
+        with:
+          path: ~/.npm
+          key: npm-${{ hashFiles('package-lock.json') }}
+          restore-keys: npm-
+
+      - name: Install NPM dependencies
+        working-directory: ./ui
+        run: |
+          npm install
+
       - name: Build UI
         working-directory: ./ui
         run: |
-          NODE_PATH=/cache/node_modules
-          NODE_OPTIONS=--max_old_space_size=6096
-          npm install --unsafe-perm --legacy-peer-deps
           npm run build
 
       - name: Build with Maven
@@ -112,25 +134,18 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: 3.8
-
-      - name: Cache Python dependencies
-        uses: actions/cache@v3
-        with:
-          path: ~/.cache/pip
-          key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
-          restore-keys: |
-            ${{ runner.os }}-pip-
+          cache: 'pip'
 
       - name: Install Python dependencies
+        working-directory: ./streampipes-client-python
         run: |
-          cd ./streampipes-client-python
           python -m pip install --upgrade pip
           pip install wheel
           pip install -e ".[dev]"
 
       - name: Run style & code checks
+        working-directory: ./streampipes-client-python
         run: |
-          cd ./streampipes-client-python
           make pre-commit
           make mypy
           make lint
@@ -150,25 +165,18 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python }}
-
-      - name: Cache Python dependencies
-        uses: actions/cache@v3
-        with:
-          path: ~~.cache/pip
-          key: ${{ runner.os }}-${{ matrix.python }}-pip-${{ 
hashFiles('**/setup.py') }}
-          restore-keys: |
-            ${{ runner.os }}-${{ matrix.python }}-pip-
+          cache: 'pip'
 
       - name: Install Python dependencies
+        working-directory: ./streampipes-client-python
         run: |
-          cd ./streampipes-client-python
           python -m pip install --upgrade pip
           pip install wheel
           pip install -e ".[dev]"
 
       - name: Run unit-tests
-        run: |
-          cd ./streampipes-client-python
+        working-directory: ./streampipes-client-python
+        run:
           make unit-tests
 
   python-doc-checks:
@@ -180,23 +188,16 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: 3.8
-
-      - name: Cache Python dependencies
-        uses: actions/cache@v3
-        with:
-          path: ~/.cache/pip
-          key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
-          restore-keys: |
-            ${{ runner.os }}-pip-
+          cache: 'pip'
 
       - name: Install Python dependencies
+        working-directory: ./streampipes-client-python
         run: |
-          cd ./streampipes-client-python
           python -m pip install --upgrade pip
           pip install wheel
           pip install -e ".[docs]"
 
       - name: Build MkDocs
-        run: |
-          cd ./streampipes-client-python
+        working-directory: ./streampipes-client-python
+        run:
           make doc
\ No newline at end of file

Reply via email to