🔧 Restore Node after SDK release notes (#289) #382
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
| name: SDK Unit Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| # Detect which SDKs have changes | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ruby: ${{ steps.filter.outputs.ruby }} | |
| storybook: ${{ steps.filter.outputs.storybook }} | |
| static-site: ${{ steps.filter.outputs.static-site }} | |
| vitest: ${{ steps.filter.outputs.vitest }} | |
| swift: ${{ steps.filter.outputs.swift }} | |
| ember: ${{ steps.filter.outputs.ember }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4 | |
| id: filter | |
| with: | |
| filters: | | |
| ruby: | |
| - 'clients/ruby/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| storybook: | |
| - 'clients/storybook/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| static-site: | |
| - 'clients/static-site/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| vitest: | |
| - 'clients/vitest/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| swift: | |
| - 'clients/swift/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| ember: | |
| - 'clients/ember/**' | |
| - '.github/workflows/sdk-unit.yml' | |
| # Ruby SDK - runs on multiple Ruby versions | |
| ruby: | |
| name: Ruby SDK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.ruby == 'true' | |
| strategy: | |
| matrix: | |
| ruby-version: ['3.0', '3.1', '3.2', '3.3'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - name: Use Node.js 22.13.1 | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: '22.13.1' | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack@latest | |
| corepack enable | |
| corepack prepare pnpm@11.3.0 --activate | |
| - name: Install CLI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm run build | |
| - name: Install Ruby dependencies | |
| working-directory: ./clients/ruby | |
| run: | | |
| gem install bundler | |
| bundle install | |
| - name: Run RuboCop | |
| working-directory: ./clients/ruby | |
| run: bundle exec rubocop | |
| - name: Run Ruby unit tests | |
| working-directory: ./clients/ruby | |
| run: ruby -Ilib:test test/vizzly_test.rb | |
| # Storybook SDK - runs on multiple Node versions | |
| storybook: | |
| name: Storybook SDK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.storybook == 'true' | |
| strategy: | |
| matrix: | |
| node-version: ['22.13.1', 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack@latest | |
| corepack enable | |
| corepack prepare pnpm@11.3.0 --activate | |
| - name: Install CLI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm run build | |
| - name: Install Storybook client dependencies | |
| working-directory: ./clients/storybook | |
| run: pnpm install --frozen-lockfile | |
| - name: Run linter | |
| working-directory: ./clients/storybook | |
| run: pnpm run lint | |
| - name: Run tests | |
| working-directory: ./clients/storybook | |
| run: pnpm test | |
| env: | |
| CI: true | |
| - name: Build package | |
| working-directory: ./clients/storybook | |
| run: pnpm run build | |
| # Static-Site SDK - runs on multiple Node versions | |
| static-site: | |
| name: Static-Site SDK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.static-site == 'true' | |
| strategy: | |
| matrix: | |
| node-version: ['22.13.1', 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack@latest | |
| corepack enable | |
| corepack prepare pnpm@11.3.0 --activate | |
| - name: Install CLI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm run build | |
| - name: Install Static-Site client dependencies | |
| working-directory: ./clients/static-site | |
| run: pnpm install --frozen-lockfile | |
| - name: Run linter | |
| working-directory: ./clients/static-site | |
| run: pnpm run lint | |
| - name: Run tests | |
| working-directory: ./clients/static-site | |
| run: pnpm test | |
| env: | |
| CI: true | |
| - name: Build package | |
| working-directory: ./clients/static-site | |
| run: pnpm run build | |
| # Vitest SDK - runs on multiple Node versions | |
| vitest: | |
| name: Vitest SDK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.vitest == 'true' | |
| strategy: | |
| matrix: | |
| node-version: ['22.13.1', 24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack@latest | |
| corepack enable | |
| corepack prepare pnpm@11.3.0 --activate | |
| - name: Install CLI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm run build | |
| - name: Install Vitest client dependencies | |
| working-directory: ./clients/vitest | |
| run: pnpm install --frozen-lockfile | |
| - name: Get installed Playwright version | |
| working-directory: ./clients/vitest | |
| id: playwright-version | |
| run: echo "version=$(pnpm exec playwright --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ steps.playwright-version.outputs.version }}-chromium | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| working-directory: ./clients/vitest | |
| run: pnpm exec playwright install chromium --with-deps | |
| - name: Run Vitest client linter | |
| working-directory: ./clients/vitest | |
| run: pnpm run lint | |
| - name: Run Vitest client unit tests | |
| working-directory: ./clients/vitest | |
| run: pnpm run test:unit | |
| env: | |
| CI: true | |
| # Swift SDK - runs on multiple Xcode versions | |
| swift: | |
| name: Swift SDK | |
| runs-on: macos-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.swift == 'true' | |
| strategy: | |
| matrix: | |
| xcode-version: ['16.2', '16.4'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app | |
| - name: Build Swift package | |
| working-directory: ./clients/swift | |
| run: swift build | |
| - name: Run Swift tests | |
| working-directory: ./clients/swift | |
| run: swift test | |
| # Ember SDK - runs unit and integration tests | |
| ember: | |
| name: Ember SDK | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| needs: changes | |
| if: needs.changes.outputs.ember == 'true' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js 22.13.1 | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: '22.13.1' | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack@latest | |
| corepack enable | |
| corepack prepare pnpm@11.3.0 --activate | |
| - name: Install CLI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build CLI | |
| run: pnpm run build | |
| - name: Install Ember client dependencies | |
| working-directory: ./clients/ember | |
| run: pnpm install --frozen-lockfile | |
| - name: Get installed Playwright version | |
| working-directory: ./clients/ember | |
| id: playwright-version | |
| run: echo "version=$(pnpm exec playwright --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ steps.playwright-version.outputs.version }}-chromium | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| working-directory: ./clients/ember | |
| run: pnpm exec playwright install chromium --with-deps | |
| - name: Run linter | |
| working-directory: ./clients/ember | |
| run: pnpm run lint | |
| - name: Run unit tests | |
| working-directory: ./clients/ember | |
| run: pnpm test | |
| env: | |
| CI: true | |
| # Status check for branch protection | |
| check: | |
| name: SDK Unit Status | |
| runs-on: ubuntu-latest | |
| needs: [changes, ruby, storybook, static-site, vitest, swift, ember] | |
| if: always() | |
| steps: | |
| - name: Check SDK unit tests | |
| run: | | |
| # Only check jobs that were supposed to run | |
| if [[ "${{ needs.changes.outputs.ruby }}" == "true" && "${{ needs.ruby.result }}" == "failure" ]]; then | |
| echo "Ruby SDK tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.storybook }}" == "true" && "${{ needs.storybook.result }}" == "failure" ]]; then | |
| echo "Storybook SDK tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.static-site }}" == "true" && "${{ needs.static-site.result }}" == "failure" ]]; then | |
| echo "Static-Site SDK tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.vitest }}" == "true" && "${{ needs.vitest.result }}" == "failure" ]]; then | |
| echo "Vitest SDK tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.swift }}" == "true" && "${{ needs.swift.result }}" == "failure" ]]; then | |
| echo "Swift SDK tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.changes.outputs.ember }}" == "true" && "${{ needs.ember.result }}" == "failure" ]]; then | |
| echo "Ember SDK tests failed" | |
| exit 1 | |
| fi | |
| echo "All SDK unit tests passed (or skipped)" |