Codecov #42
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
| # Codecov (plugin) v. 2.0.6 | |
| # Path: .github/workflows/codecov.yml | |
| name: Codecov | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Run tests and collect coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup Node.js 24.x | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24.x' | |
| cache: npm | |
| - name: Verify Node.js version | |
| run: node -v | |
| - name: Verify Npm version | |
| run: npm -v | |
| - name: Clone matterbridge repo | |
| run: git clone --depth 1 --single-branch --no-tags https://github.com/Luligu/matterbridge.git ../matterbridge | |
| - name: Install matterbridge dependencies | |
| working-directory: ../matterbridge | |
| run: npm ci --no-fund --no-audit | |
| - name: Build matterbridge | |
| working-directory: ../matterbridge | |
| run: npm run build | |
| - name: Link matterbridge globally | |
| working-directory: ../matterbridge | |
| run: npm link --no-fund --no-audit | |
| - name: Install plugin dependencies | |
| run: npm ci --no-fund --no-audit | |
| - name: Link matterbridge in the plugin | |
| run: npm link matterbridge --no-fund --no-audit | |
| - name: Build the plugin | |
| run: npm run build | |
| - name: Typecheck the plugin | |
| run: npm run typecheck | |
| - name: Lint the plugin | |
| run: npm run lint | |
| - name: Check the plugin frontend | |
| id: check_frontend | |
| shell: bash | |
| run: echo "has_frontend=$(test -f apps/frontend/package.json && echo true || echo false)" >> $GITHUB_OUTPUT | |
| - name: Install the frontend dependencies | |
| if: steps.check_frontend.outputs.has_frontend == 'true' | |
| working-directory: apps/frontend | |
| run: npm ci --no-fund --no-audit | |
| - name: Build the frontend | |
| if: steps.check_frontend.outputs.has_frontend == 'true' | |
| working-directory: apps/frontend | |
| run: npm run build | |
| - name: Typecheck the frontend | |
| if: steps.check_frontend.outputs.has_frontend == 'true' | |
| working-directory: apps/frontend | |
| run: npm run typecheck | |
| - name: Lint the frontend | |
| if: steps.check_frontend.outputs.has_frontend == 'true' | |
| working-directory: apps/frontend | |
| run: npm run lint | |
| - name: Check config files | |
| id: check_configs | |
| shell: bash | |
| run: | | |
| echo "has_jest=$(test -f jest.config.js && echo true || echo false)" >> $GITHUB_OUTPUT | |
| echo "has_vitest=$(test -f vite.config.ts && echo true || echo false)" >> $GITHUB_OUTPUT | |
| - name: Run Jest tests | |
| if: steps.check_configs.outputs.has_jest == 'true' | |
| shell: bash | |
| run: | | |
| npm run test:coverage -- --testTimeout=30000 | |
| test -f ./coverage/jest/lcov.info || { echo "::error::Jest ran but lcov.info missing"; exit 1; } | |
| - name: Run Vitest tests | |
| if: steps.check_configs.outputs.has_vitest == 'true' | |
| shell: bash | |
| run: | | |
| if [ "${{ steps.check_configs.outputs.has_jest }}" == "true" ]; then | |
| npm run test:vitest:coverage -- --testTimeout=30000 | |
| else | |
| npm run test:coverage -- --testTimeout=30000 | |
| fi | |
| test -f ./coverage/vitest/lcov.info || { echo "::error::Vitest ran but lcov.info missing"; exit 1; } | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |