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

index 290c192321d13cc3a8f5e7d215fd567a87002e59..749ba7ed784e559b43ce4290591e230acd30e8d3 100644 (file)
@@ -17,24 +17,25 @@ jobs:
       - uses: actions/checkout@v3
         with:
           fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+      - 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: pnpm install
-        run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
-          pnpm install
-      - name: pnpm run lint
-        run: pnpm run lint
-      - name: pnpm run build
-        run: pnpm run build
+        run: pnpm install
+      - name: pnpm lint
+        run: pnpm lint
+      - name: pnpm build
+        run: pnpm build
       - name: pnpm test
         run: pnpm test
-      - name: pnpm run coverage
+      - name: pnpm coverage
         if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
-        run: pnpm run coverage
+        run: pnpm coverage
       - name: SonarCloud Scan
         if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
         uses: sonarsource/sonarcloud-github-action@v1.8
@@ -54,24 +55,25 @@ jobs:
       - uses: actions/checkout@v3
         with:
           fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+      - 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: pnpm install
-        run: |
-          corepack enable
-          corepack prepare pnpm@latest --activate
-          pnpm install
-      - name: pnpm run lint
-        run: pnpm run lint
-      - name: pnpm run build
-        run: pnpm run build
+        run: pnpm install
+      - name: pnpm lint
+        run: pnpm lint
+      - name: pnpm build
+        run: pnpm build
       - name: pnpm test
         run: pnpm test
-      # - name: pnpm run coverage
+      # - name: pnpm coverage
       #   if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
-      #   run: pnpm run coverage
+      #   run: pnpm coverage
       # - name: SonarCloud Scan
       #   if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
       #   uses: sonarsource/sonarcloud-github-action@v1.8