build(ci): enable dependencies caching with pnpm
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 22 Apr 2023 22:04:25 +0000 (00:04 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 22 Apr 2023 22:04:25 +0000 (00:04 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.github/workflows/ci.yml
.github/workflows/generate-documentation.yml
.github/workflows/npmpublish.yml

index 7854d04d9fc84dafbf2d5b60b46646fe69534184..72782830b1bf9394605ecc7a057315f32ed95e6b 100644 (file)
@@ -28,29 +28,32 @@ jobs:
         with:
           fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar
 
+      - name: Setup pnpm
+        uses: pnpm/action-setup@v2
+        with:
+          version: 8
+
       - name: Setup node ${{ matrix.node }}
         uses: actions/setup-node@v3
         with:
           node-version: ${{ matrix.node }}
+          cache: 'pnpm'
 
       - name: Install
-        run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
-          pnpm install
+        run: pnpm install
 
       - name: Build
-        run: pnpm run build
+        run: pnpm build
 
       - name: Lint
-        run: pnpm run lint
+        run: pnpm lint
 
       - name: Tests
-        run: pnpm run test
+        run: pnpm test
 
       - name: Coverage Report
         if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
-        run: pnpm run coverage
+        run: pnpm coverage
 
       - name: Sonar Code Analysis
         if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
@@ -61,4 +64,4 @@ jobs:
 
       - name: Benchmark
         if: github.event.inputs.withBenchmark
-        run: pnpm run benchmark
+        run: pnpm benchmark
index 82553b24e3a3cdd23c7bc6e582b565050e77ce58..2ba7833ec6290849ea47aeed5b7b3deff1154b7d 100644 (file)
@@ -11,17 +11,21 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v3
 
+      - name: Setup pnpm
+        uses: pnpm/action-setup@v2
+        with:
+          version: 8
+
       - name: Setup node
         uses: actions/setup-node@v3
         with:
           node-version: '18.x'
+          cache: 'pnpm'
 
       - name: Generate documentation
         run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
           pnpm install
-          pnpm run typedoc
+          pnpm typedoc
 
       - name: Commit files
         if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'"
index d124eed3c81052a29f4898ba4d5894d488ca4f70..17eb40ed01ee38e287add3601b85240df92cca15 100644 (file)
@@ -12,27 +12,30 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v3
 
+      - name: Setup pnpm
+        uses: pnpm/action-setup@v2
+        with:
+          version: 8
+
       - name: Setup Node
         uses: actions/setup-node@v3
         with:
           node-version: '18.x'
+          cache: 'pnpm'
 
       - name: Install
-        run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
-          pnpm install
+        run: pnpm install
 
       - name: Tests & Coverage
         run: |
-          pnpm run test
-          pnpm run coverage
+          pnpm test
+          pnpm coverage
 
       - name: Lint
-        run: pnpm run lint
+        run: pnpm lint
 
       - name: Production Build
-        run: pnpm run build:prod
+        run: pnpm build:prod
 
   publish:
     needs: build
@@ -42,21 +45,24 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v3
 
+      - name: Setup pnpm
+        uses: pnpm/action-setup@v2
+        with:
+          version: 8
+
       - name: Setup Node
         uses: actions/setup-node@v3
         with:
           node-version: '18.x'
           registry-url: https://registry.npmjs.org/
+          cache: 'pnpm'
 
       - name: Read package.json version
         id: package-version
         uses: jaywcjlove/github-action-package@main
 
       - name: Install
-        run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
-          pnpm install
+        run: pnpm install
 
       - name: Publish Release
         if: ${{ contains(steps.package-version.outputs.version, '-') == false }}