Sv443 4 місяців тому
батько
коміт
f7b80a5f7e
1 змінених файлів з 66 додано та 0 видалено
  1. 66 0
      .github/workflows/lint-and-test.yml

+ 66 - 0
.github/workflows/lint-and-test.yml

@@ -0,0 +1,66 @@
+name: "Lint and run tests"
+
+on:
+  push:
+    branches: [main]
+  pull_request:
+    branches: [main]
+  workflow_dispatch:
+
+jobs:
+  lint-and-test:
+    name: Lint and Test
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        node-version: [22]
+
+    env:
+      CI: "true"
+      STORE_PATH: ""
+      PNPM_VERSION: 9
+
+    environment: "Unit Tests"
+
+    steps:
+      - name: Check out the repository
+        uses: actions/checkout@v4
+        with:
+          submodules: recursive
+
+      - name: Set up Node.js v${{ matrix.node-version }}
+        uses: actions/setup-node@v4
+        with:
+          node-version: ${{ matrix.node-version }}
+
+      - name: Set up pnpm
+        uses: pnpm/action-setup@v4
+        with:
+          version: ${{ env.PNPM_VERSION }}
+          run_install: false
+
+      - name: Get pnpm store directory
+        shell: bash
+        run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
+
+      - name: Setup pnpm cache
+        uses: actions/cache@v4
+        with:
+          path: ${{ env.STORE_PATH }}
+          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
+          restore-keys: ${{ runner.os }}-pnpm-store-
+
+      - name: Install dependencies
+        shell: bash
+        run: pnpm install
+
+      - name: Lint the code
+        shell: bash
+        run: pnpm run lint
+
+      - name: Run unit tests
+        shell: bash
+        run: |
+          echo "${{ secrets.DOTENV_FILE }}" > .env
+          pnpm run test