Update and upgrade package. #74
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
| # Node.js CI (plugin) v. 2.0.6 | |
| # Path: .github/workflows/build.yml | |
| name: Node.js CI | |
| on: | |
| push: | |
| paths-ignore: | |
| - '**/*.md' # any .md anywhere | |
| pull_request: | |
| paths-ignore: | |
| - '**/*.md' # any .md anywhere | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Node.js 20.19 is still supported in package.json, but it is not tested in CI as it has reached EOL. | |
| node-version: [22.x, 24.x, 26.x] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - name: Verify Node.js version | |
| run: node -v | |
| - name: Verify Npm version | |
| run: npm -v | |
| - name: Select matterbridge branch | |
| id: select_matterbridge_ref | |
| shell: pwsh | |
| run: | | |
| $ref = if ('${{ github.event_name }}' -eq 'push') { 'dev' } else { 'main' } | |
| "ref=$ref" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Clone matterbridge repo branch ${{ steps.select_matterbridge_ref.outputs.ref }} | |
| run: git clone --depth 1 --single-branch --no-tags -b ${{ steps.select_matterbridge_ref.outputs.ref }} 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 -- --testTimeout=30000 | |
| - 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 -- --testTimeout=30000 | |
| else | |
| npm run test -- --testTimeout=30000 | |
| fi |