Browse Source

added pnpm test

Shahed Nasser 10 months ago
parent
commit
6e94372f8e
1 changed files with 69 additions and 0 deletions
  1. 69 0
      .github/workflows/test-cli.yml

+ 69 - 0
.github/workflows/test-cli.yml

@@ -152,4 +152,73 @@ jobs:
       - name: Kill server
       - name: Kill server
         shell: "bash"
         shell: "bash"
         run: kill -9 $(lsof -t -i :9000)
         run: kill -9 $(lsof -t -i :9000)
+          
+  test-cli-pnpm:
+    name: "Test CLI (pnpm)"
+    env:
+      NODE_ENV: CI
+      REDIS_URL: redis://localhost:6379
+      DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
+      POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
+    services: 
+      postgres:
+        image: postgres
+        env:
+          POSTGRES_PASSWORD: postgres
+          POSTGRES_USER: postgres
+          POSTGRES_DB: cli-test
+        options: >-
+          --health-cmd pg_isready
+          --health-interval 10s
+          --health-timeout 5s
+          --health-retries 5
+        ports:
+          - 5432:5432
+ 
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Cancel Previous Runs
+        uses: styfle/cancel-workflow-action@0.11.0
+        with:
+          access_token: ${{ github.token }}
+
+      - name: Setup Node.js environment
+        uses: actions/setup-node@v3
+        with:
+          node-version: 20
+          cache: "pnpm"
+  
+      - name: Install Dependencies
+        run: pnpm install
+
+      - name: Check CLI tool is installed
+        run: ./node_modules/.bin/medusa -v
+
+      - name: run medusa build
+        run: pnpm run build
+
+      - name: Run migrations
+        run: npx medusa migrations run
+
+      - name: Sync links
+        run: npx medusa links sync
+
+      - name: Run seed
+        run: pnpm run seed
+
+      - name: Run development server
+        run: pnpm run dev -- &
+
+      - name: Wait for live server response
+        shell: "bash"
+        run: ./.github/scripts/wait-for-server-live.sh
+
+      - name: Kill server
+        shell: "bash"
+        run: kill -9 $(lsof -t -i :9000)