From dd3632741dac2931a292c9d2f953de0bb9e51a3d Mon Sep 17 00:00:00 2001 From: "Thomas S." Date: Tue, 1 Oct 2024 12:24:12 +0200 Subject: [PATCH] ci: Add pip/npm cache in workflows (#418) --- .github/workflows/backend.yml | 14 ++++++++------ .github/workflows/frontend.yml | 12 +++++++++--- .github/workflows/lint.yml | 3 ++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 4b6e71ebf..af8f89418 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -5,10 +5,10 @@ on: paths: - 'src/**' - 'tests/**' - - pyproject.toml - - Makefile - - requirements*.txt - - .github/workflows/backend.yml + - 'pyproject.toml' + - 'Makefile' + - 'requirements*.txt' + - '.github/workflows/backend.yml' permissions: contents: read @@ -20,7 +20,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: '3.12' + cache: 'pip' - name: Lint backend run: | python -m pip install --upgrade pip @@ -34,7 +35,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: '3.12' + cache: 'pip' - name: Build frontend and share library shell: bash run: make build-frontend diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 96ad57ea4..841ecc490 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -18,7 +18,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "20" + node-version: '20' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json - name: Lint frontend run: | cd frontend @@ -35,7 +37,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "20" + node-version: '20' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json - name: Test frontend run: | cd frontend @@ -55,7 +59,9 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "20" + node-version: '20' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json - name: Build frontend shell: bash run: make build-frontend diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c5644586c..e8099edc0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: '3.12' + cache: 'pip' - name: Lint all files run: | python -m pip install --upgrade pip