From de1773575a041e61e8849b48aab33e8b7f516996 Mon Sep 17 00:00:00 2001 From: tarunsinghofficial Date: Mon, 15 Jul 2024 21:29:32 +0530 Subject: [PATCH] added the test file to run tests as part of CI --- .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 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..0e40174 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: Test + +on: + push: + branches: + - main + - 'feature/*' + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache npm install artifacts + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm run test + env: + CI: true + + - name: Display test results + if: failure() + run: | + echo "Tests failed. Please check the test output for more details." + continue-on-error: true