This repository was archived by the owner on Apr 13, 2026. It is now read-only.
refactor: extract SessionItem component and optimize store subscriptions #162
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: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| push: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check formatting | |
| run: npm run format | |
| - name: Type check | |
| run: npm run typecheck | |
| build-mac-dev: | |
| needs: typecheck | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| arch: arm64 | |
| - os: macos-15-intel | |
| arch: x64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build dev package | |
| run: npm run package:dev -- --${{ matrix.arch }} --publish=never | |
| - name: Calculate artifact sizes | |
| id: sizes | |
| run: | | |
| # Calculate sizes and format them | |
| echo "Calculating artifact sizes..." | |
| # Find DMG and ZIP files | |
| DMG_FILE=$(find release-dev -name "*-${{ matrix.arch }}.dmg" -type f | head -n 1) | |
| ZIP_FILE=$(find release-dev -name "*-${{ matrix.arch }}.zip" -type f | head -n 1) | |
| # Get sizes in bytes and convert to human-readable format | |
| if [ -f "$DMG_FILE" ]; then | |
| DMG_SIZE_BYTES=$(stat -f%z "$DMG_FILE" 2>/dev/null || stat -c%s "$DMG_FILE" 2>/dev/null) | |
| DMG_SIZE_MB=$(echo "scale=2; $DMG_SIZE_BYTES / 1048576" | bc) | |
| echo "dmg_size=${DMG_SIZE_MB} MB" >> $GITHUB_OUTPUT | |
| else | |
| echo "dmg_size=N/A" >> $GITHUB_OUTPUT | |
| fi | |
| if [ -f "$ZIP_FILE" ]; then | |
| ZIP_SIZE_BYTES=$(stat -f%z "$ZIP_FILE" 2>/dev/null || stat -c%s "$ZIP_FILE" 2>/dev/null) | |
| ZIP_SIZE_MB=$(echo "scale=2; $ZIP_SIZE_BYTES / 1048576" | bc) | |
| echo "zip_size=${ZIP_SIZE_MB} MB" >> $GITHUB_OUTPUT | |
| else | |
| echo "zip_size=N/A" >> $GITHUB_OUTPUT | |
| fi | |
| # Create a size info file for the comment job | |
| mkdir -p size-info | |
| echo "DMG: ${DMG_SIZE_MB:-N/A} MB" > size-info/${{ matrix.arch }}-sizes.txt | |
| echo "ZIP: ${ZIP_SIZE_MB:-N/A} MB" >> size-info/${{ matrix.arch }}-sizes.txt | |
| cat size-info/${{ matrix.arch }}-sizes.txt | |
| - name: Upload size info | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: size-info-${{ matrix.arch }} | |
| path: size-info/${{ matrix.arch }}-sizes.txt | |
| if-no-files-found: error | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: neovate-dev-${{ matrix.arch }} | |
| path: release-dev/*-${{ matrix.arch }}.* | |
| if-no-files-found: error | |
| comment: | |
| needs: build-mac-dev | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Download size info artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: size-info-* | |
| path: size-info | |
| - name: Post PR comment with artifact links | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const identifier = '<!-- neovate-build -->'; | |
| const readSizeInfo = (arch) => { | |
| try { | |
| const sizeFile = path.join('size-info', `size-info-${arch}`, `${arch}-sizes.txt`); | |
| const content = fs.readFileSync(sizeFile, 'utf8'); | |
| const lines = content.trim().split('\n'); | |
| const dmgLine = lines.find(l => l.startsWith('DMG:')); | |
| const zipLine = lines.find(l => l.startsWith('ZIP:')); | |
| const dmgSize = dmgLine ? dmgLine.split(':')[1].trim() : 'N/A'; | |
| const zipSize = zipLine ? zipLine.split(':')[1].trim() : 'N/A'; | |
| return { dmg: dmgSize, zip: zipSize }; | |
| } catch (error) { | |
| console.error(`Error reading size info for ${arch}:`, error); | |
| return { dmg: 'N/A', zip: 'N/A' }; | |
| } | |
| }; | |
| const arm64Sizes = readSizeInfo('arm64'); | |
| const x64Sizes = readSizeInfo('x64'); | |
| const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: context.runId, | |
| }); | |
| const arm64 = artifacts.find(a => a.name === 'neovate-dev-arm64'); | |
| const x64 = artifacts.find(a => a.name === 'neovate-dev-x64'); | |
| const artifactUrl = (artifact) => | |
| `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${artifact.id}`; | |
| const body = [ | |
| identifier, | |
| '## Build Ready', | |
| '', | |
| '| Architecture | Download | DMG Size | ZIP Size |', | |
| '|--------------|----------|----------|----------|', | |
| `| Apple Silicon | ${arm64 ? `[Download](${artifactUrl(arm64)})` : 'N/A'} | ${arm64Sizes.dmg} | ${arm64Sizes.zip} |`, | |
| `| Intel | ${x64 ? `[Download](${artifactUrl(x64)})` : 'N/A'} | ${x64Sizes.dmg} | ${x64Sizes.zip} |`, | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes(identifier)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }); | |
| } |