| # This workflow will do a clean install of node dependencies, build the source |
| # code and run tests in block on the latest version of node. |
| |
| name: test |
| |
| on: |
| pull_request: |
| branches: |
| - develop |
| |
| jobs: |
| setup: |
| runs-on: ubuntu-latest |
| name: Compile SRE with locales |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v6 |
| with: |
| node-version: 'latest' |
| |
| - uses: pnpm/action-setup@v4 |
| name: Install pnpm |
| with: |
| version: 'latest' |
| run_install: false |
| |
| - name: Setup Speech Rule Engine |
| run: | |
| pnpm -r i |
| pnpm build |
| cd testsuite |
| pnpm compile |
| |
| - name: Upload build |
| uses: actions/upload-artifact@v4 |
| with: |
| name: sre-library |
| path: | |
| lib |
| js |
| package.json |
| testsuite/js |
| testsuite/tests |
| |
| test: |
| strategy: |
| matrix: |
| block: [base, walker, semantic, en, en-ssml, ca, de, da, fr, es, it, hi, ko, nb, nn, sv] |
| needs: setup |
| runs-on: ubuntu-latest |
| name: SRE jests tests for ${{ matrix.block }} |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v6 |
| with: |
| node-version: 'latest' |
| |
| - uses: pnpm/action-setup@v4 |
| name: Install pnpm |
| with: |
| version: 'latest' |
| run_install: false |
| |
| - name: Downloading the build |
| uses: actions/download-artifact@v4 |
| with: |
| name: sre-library |
| |
| - name: Set up tests |
| run: | |
| pnpm -r i --ignore-scripts |
| |
| - name: Run tests for ${{ matrix.block }} |
| run: pnpm test:action tests/actions/${{ matrix.block }}.test.ts --coverageReporters=json |
| |
| - name: Upload coverage artifact |
| uses: actions/upload-artifact@v4 |
| with: |
| name: coverage-${{ matrix.block }} |
| path: coverage/coverage-final.json |
| |
| unit: |
| needs: setup |
| runs-on: ubuntu-latest |
| name: SRE jests tests for ${{ matrix.block }} |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v6 |
| with: |
| node-version: 'latest' |
| |
| - uses: pnpm/action-setup@v4 |
| name: Install pnpm |
| with: |
| version: 'latest' |
| run_install: false |
| |
| - name: Downloading the build |
| uses: actions/download-artifact@v4 |
| with: |
| name: sre-library |
| |
| - name: Set up tests |
| run: | |
| pnpm -r i --ignore-scripts |
| |
| - name: Run unit tests |
| run: pnpm test:action unit-tests --coverageReporters=json |
| |
| - name: Upload coverage artifact |
| uses: actions/upload-artifact@v4 |
| with: |
| name: coverage-unit |
| path: coverage/coverage-final.json |
| |
| combine-coverage: |
| needs: [test, unit] |
| runs-on: ubuntu-latest |
| name: Combine Coverage Reports |
| steps: |
| - uses: actions/checkout@v4 |
| |
| - uses: pnpm/action-setup@v4 |
| name: Install pnpm |
| with: |
| version: 10 |
| run_install: false |
| |
| - name: Install merge tool |
| run: pnpm add -g nyc |
| |
| - name: Download all coverage artifacts |
| uses: actions/download-artifact@v4 |
| with: |
| path: coverage-artifacts |
| |
| - name: Merge coverage reports |
| run: | |
| mkdir -p combine |
| cd coverage-artifacts |
| for i in coverage-*; do cp $i/coverage-final.json ../combine/$i.json; done |
| cd .. |
| nyc merge ./combine/ coverage.json |
| |
| - name: Upload to Codecov |
| uses: codecov/codecov-action@v5 |
| with: |
| token: ${{ secrets.CODECOV_TOKEN }} |
| slug: speech-rule-engine/speech-rule-engine |
| file: coverage.json |
| name: codecov-$(date +%Y%m%d) |