Ver código fonte

ci: split build and tests

Nicolas Meienberger 2 anos atrás
pai
commit
be4a4f0aa0
1 arquivos alterados com 45 adições e 7 exclusões
  1. 45 7
      .github/workflows/ci.yml

+ 45 - 7
.github/workflows/ci.yml

@@ -15,7 +15,7 @@ env:
   TIPI_VERSION: 0.0.1
 
 jobs:
-  ci:
+  tests:
     runs-on: ubuntu-latest
     services:
       postgres:
@@ -62,12 +62,6 @@ jobs:
       - name: Install dependencies
         run: pnpm install
 
-      - name: Build client
-        run: pnpm build:next
-
-      - name: Run linter
-        run: pnpm lint
-
       - name: Get number of CPU cores
         id: cpu-cores
         uses: SimenB/github-actions-cpu-cores@v1
@@ -78,3 +72,47 @@ jobs:
       - uses: codecov/codecov-action@v3
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
+
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Install Node.js
+        uses: actions/setup-node@v3
+        with:
+          node-version: 18
+
+      - uses: pnpm/action-setup@v2.2.4
+        name: Install pnpm
+        id: pnpm-install
+        with:
+          version: 8
+          run_install: false
+
+      - name: Get pnpm store directory
+        id: pnpm-cache
+        run: |
+          echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
+
+      - uses: actions/cache@v3
+        name: Setup pnpm cache
+        with:
+          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
+          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+          restore-keys: |
+            ${{ runner.os }}-pnpm-store-
+
+      - name: Install dependencies
+        run: pnpm install
+
+      - uses: actions/download-artifact@v3
+        with:
+          name: node_modules
+
+      - name: Build client
+        run: npm run build:next
+
+      - name: Run linter
+        run: npm run lint