diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8b88fbf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: CI - Test Suite + +on: + push: + branches: + - main + - phase-1-critical-path + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18, 20] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # เพื่อให้ทางต้นทางดึง commit ก่อนหน้าได้ (ใช้ในหลายกรณี) + with: + fetch-depth: 0 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci + + - name: Run test suite + run: npm test + + - name: Report coverage + if: success() + run: | + echo "Test coverage summary:" + npm run test:coverage || true