|
| 1 | +# This workflow will do a clean install of node dependencies, build the source |
| 2 | +# code and run tests in block on the latest version of node. |
| 3 | + |
| 4 | +name: test |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - new_testsuite |
| 10 | + - develop |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - develop |
| 14 | + |
| 15 | +jobs: |
| 16 | + setup: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + name: Compile SRE with locales |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - uses: pnpm/action-setup@v4 |
| 24 | + name: Install pnpm |
| 25 | + with: |
| 26 | + version: 10 |
| 27 | + run_install: false |
| 28 | + |
| 29 | + - name: Setup Speech Rule Engine |
| 30 | + run: pnpm i; pnpm build |
| 31 | + |
| 32 | + - name: Upload build |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: sre-library |
| 36 | + path: | |
| 37 | + lib |
| 38 | + js |
| 39 | + package.json |
| 40 | +
|
| 41 | + test: |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + block: [base, walker, semantic, en, en-ssml, ca, de, da, fr, es, it, hi, ko, nb, nn, sv] |
| 45 | + needs: setup |
| 46 | + runs-on: ubuntu-latest |
| 47 | + name: SRE jests tests for ${{ matrix.block }} |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - uses: pnpm/action-setup@v4 |
| 53 | + name: Install pnpm |
| 54 | + with: |
| 55 | + version: 10 |
| 56 | + run_install: false |
| 57 | + |
| 58 | + - name: Downloading the build |
| 59 | + uses: actions/download-artifact@v4 |
| 60 | + with: |
| 61 | + name: sre-library |
| 62 | + |
| 63 | + - name: Set up tests |
| 64 | + run: | |
| 65 | + pnpm -r i --ignore-scripts |
| 66 | + cd testsuite; pnpm build; |
| 67 | +
|
| 68 | + - name: Run tests for ${{ matrix.block }} |
| 69 | + run: pnpm actionTest tests/actions/${{ matrix.block }}.test.ts |
| 70 | + |
| 71 | + - name: Upload coverage artifact |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: coverage-${{ matrix.block }} |
| 75 | + path: coverage |
| 76 | + |
| 77 | + combine-coverage: |
| 78 | + # needs: test |
| 79 | + runs-on: ubuntu-latest |
| 80 | + name: Combine Coverage Reports |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - uses: pnpm/action-setup@v4 |
| 85 | + name: Install pnpm |
| 86 | + with: |
| 87 | + version: 10 |
| 88 | + run_install: false |
| 89 | + |
| 90 | + - name: Install merge tool |
| 91 | + run: pnpm add -g nyc |
| 92 | + |
| 93 | + - name: Download all coverage artifacts |
| 94 | + uses: actions/download-artifact@v4 |
| 95 | + with: |
| 96 | + path: coverage-artifacts |
| 97 | + |
| 98 | + - name: Merge coverage reports |
| 99 | + run: | |
| 100 | + mkdir -p combine |
| 101 | + cd coverage-artifacts |
| 102 | + for i in coverage-*; do cp $i/coverage-final.json ../combine/$i.json; done |
| 103 | + cd .. |
| 104 | + nyc merge ./combine/ coverage.json |
| 105 | + ls -l combine/ |
| 106 | + ls -l coverage.json |
| 107 | + # mkdir -p merged |
| 108 | + # ls -l coverage-artifacts/coverage-*/lcov.info |
| 109 | + # # find coverage-artifacts -name 'lcov.info' -print -exec cp {} merged/ \; |
| 110 | + # # ls -l merged |
| 111 | + # lcov-result-merger coverage-artifacts/coverage-*/lcov.info > lcov.info |
| 112 | + # # lcov-result-merger merged/*.info > lcov.info |
| 113 | + # ls -l lcov.info |
| 114 | +
|
| 115 | + - name: Upload final result |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: result |
| 119 | + path: coverage.json |
| 120 | + |
| 121 | + # - name: Output coverage summary |
| 122 | + # run: | |
| 123 | + # pnpm add -g coveralls # optional if uploading |
| 124 | + # cat lcov.info |
| 125 | + |
| 126 | + # Optional: Upload to Codecov or Coveralls |
| 127 | + - name: Upload to Codecov |
| 128 | + uses: codecov/codecov-action@v5 |
| 129 | + with: |
| 130 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 131 | + slug: speech-rule-engine/speech-rule-engine |
| 132 | + file: coverage.json |
| 133 | + name: codecov-$(date +%Y%m%d) |
0 commit comments