From 95952de7fa539b58a7b59ea2817eb94d18b3ef9d Mon Sep 17 00:00:00 2001 From: SS-Jane Date: Wed, 3 Dec 2025 20:49:51 +0700 Subject: [PATCH] add CI test.yml to project --- .github/workflows/test.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/test.yml 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