From 4b99ccfc8edc7d2ed70eccb037dd2e3ad24e3f0e Mon Sep 17 00:00:00 2001 From: Anthony Potdevin Date: Fri, 26 May 2023 16:05:01 +0200 Subject: [PATCH] ci: add caching --- .github/workflows/nodejs.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6c27abb9..ef241875 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,4 +1,4 @@ -name: Build +name: Test, lint and build on: push: @@ -14,6 +14,24 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Install modules run: npm ci @@ -23,6 +41,10 @@ jobs: - name: Run tests run: npm run test + - name: Setup Docker Buildx Driver + id: docker_driver_setup + uses: docker/setup-buildx-action@v1 + - name: Run docker build id: docker_build uses: docker/build-push-action@v2 @@ -30,3 +52,5 @@ jobs: context: ./ file: ./Dockerfile push: false + cache-from: type=gha + cache-to: type=gha,mode=max