chore: add debugging steps to CI workflow and update test command in … #249
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit-Test-CI | |
| on: | |
| push: | |
| branches: [ master, staging, development ] | |
| pull_request: | |
| branches: [ master, staging, development ] | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Check working directory after checkout | |
| run: pwd | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| - name: Check working directory after setup-node | |
| run: pwd | |
| - name: Install dependencies | |
| run: | | |
| pwd | |
| npm ci | |
| - name: Download regions.json | |
| run: | | |
| pwd | |
| ls -la | |
| mkdir -p dist/lib | |
| pwd | |
| npm run download-regions | |
| pwd | |
| ls -la dist/lib/ || echo "dist/lib does not exist" | |
| if [ ! -f dist/lib/regions.json ]; then | |
| echo "Error: regions.json was not downloaded successfully" | |
| exit 1 | |
| fi | |
| - name: Check working directory before tests | |
| run: | | |
| pwd | |
| ls -la | |
| - uses: ArtiomTr/jest-coverage-report-action@v2 | |
| id: coverage-utils-js | |
| continue-on-error: true | |
| with: | |
| output: comment, report-markdown | |
| test-script: npm test | |
| - uses: marocchino/sticky-pull-request-comment@v2 | |
| continue-on-error: true | |
| if: steps.coverage-utils-js.outputs.report != '' | |
| with: | |
| header: Contentstack Utils JS Coverage | |
| recreate: true | |
| message: ${{ steps.coverage-utils-js.outputs.report }} | |
| - name: Test Report | |
| uses: dorny/test-reporter@v1 | |
| if: success() || failure() | |
| with: | |
| name: JEST Tests | |
| path: reports/junit/jest-*.xml | |
| reporter: jest-junit | |
| fail-on-error: true |