|
8 | 8 | branches: |
9 | 9 | - main |
10 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + actions: read |
| 14 | + checks: write |
| 15 | + |
11 | 16 | jobs: |
12 | 17 | test: |
13 | 18 | runs-on: ubuntu-latest |
@@ -49,19 +54,34 @@ jobs: |
49 | 54 | - name: Build packages |
50 | 55 | run: pnpm -r run build |
51 | 56 |
|
52 | | - - name: Run tests and lint |
53 | | - run: pnpm -r run test |
| 57 | + - name: Run SDK tests |
| 58 | + id: sdk-test |
| 59 | + working-directory: packages/b2c-tooling-sdk |
| 60 | + run: pnpm run test:ci && pnpm run lint |
| 61 | + |
| 62 | + - name: Run CLI tests |
| 63 | + id: cli-test |
| 64 | + if: always() && steps.sdk-test.conclusion != 'cancelled' |
| 65 | + working-directory: packages/b2c-cli |
| 66 | + run: pnpm run test:ci && pnpm run lint |
| 67 | + |
| 68 | + - name: Test Report |
| 69 | + uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2.3.0 |
| 70 | + if: always() && steps.sdk-test.conclusion != 'cancelled' |
| 71 | + with: |
| 72 | + name: Test Results (Node ${{ matrix.node-version }}) |
| 73 | + path: 'packages/*/test-results.json' |
| 74 | + reporter: mocha-json |
54 | 75 |
|
55 | 76 | - name: Generate coverage summary |
56 | | - if: always() |
| 77 | + if: always() && steps.sdk-test.conclusion != 'cancelled' |
57 | 78 | run: | |
58 | | - echo "## Code Coverage Report (Node ${{ matrix.node-version }})" >> $GITHUB_STEP_SUMMARY |
| 79 | + echo "## Coverage (Node ${{ matrix.node-version }})" >> $GITHUB_STEP_SUMMARY |
59 | 80 | echo "" >> $GITHUB_STEP_SUMMARY |
60 | 81 |
|
61 | 82 | # SDK Coverage |
62 | 83 | if [ -f "packages/b2c-tooling-sdk/coverage/lcov.info" ]; then |
63 | 84 | echo "### @salesforce/b2c-tooling-sdk" >> $GITHUB_STEP_SUMMARY |
64 | | - echo "" >> $GITHUB_STEP_SUMMARY |
65 | 85 | echo '```' >> $GITHUB_STEP_SUMMARY |
66 | 86 | cd packages/b2c-tooling-sdk && pnpm c8 report --reporter=text-summary 2>/dev/null | tail -n 6 >> $GITHUB_STEP_SUMMARY |
67 | 87 | cd ../.. |
|
72 | 92 | # CLI Coverage |
73 | 93 | if [ -f "packages/b2c-cli/coverage/lcov.info" ]; then |
74 | 94 | echo "### @salesforce/b2c-cli" >> $GITHUB_STEP_SUMMARY |
75 | | - echo "" >> $GITHUB_STEP_SUMMARY |
76 | 95 | echo '```' >> $GITHUB_STEP_SUMMARY |
77 | 96 | cd packages/b2c-cli && pnpm c8 report --reporter=text-summary 2>/dev/null | tail -n 6 >> $GITHUB_STEP_SUMMARY |
78 | 97 | cd ../.. |
79 | 98 | echo '```' >> $GITHUB_STEP_SUMMARY |
80 | 99 | fi |
| 100 | +
|
| 101 | + - name: Upload coverage reports |
| 102 | + if: always() && steps.sdk-test.conclusion != 'cancelled' |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: coverage-reports-node-${{ matrix.node-version }} |
| 106 | + path: | |
| 107 | + packages/b2c-tooling-sdk/coverage/ |
| 108 | + packages/b2c-cli/coverage/ |
| 109 | + retention-days: 30 |
0 commit comments