Merge pull request #9 from oxura/feat/cross-platform-live-mouse #46
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 | |
| env: | |
| APP_NAME: gpuix-native | |
| MACOSX_DEPLOYMENT_TARGET: "10.13" | |
| "on": | |
| push: | |
| branches: | |
| - main | |
| tags-ignore: | |
| - "**" | |
| paths-ignore: | |
| - "**/*.md" | |
| - LICENSE | |
| - "**/*.gitignore" | |
| - docs/** | |
| pull_request: null | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| # ── macOS (Metal) ────────────────────────────────────────── | |
| # default features include test-support (TestGpuixRenderer) | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| build: bun run build --target aarch64-apple-darwin | |
| - host: macos-latest | |
| target: x86_64-apple-darwin | |
| build: bun run build --target x86_64-apple-darwin | |
| # ── Linux (Vulkan/wgpu) ──────────────────────────────────── | |
| # build:release skips test-support (pulls gpui_macos, macOS-only) | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| build: bun run build:release --target x86_64-unknown-linux-gnu | |
| - host: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| build: bun run build:release --target aarch64-unknown-linux-gnu | |
| # ── Windows (Direct3D/wgpu) ──────────────────────────────── | |
| - host: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| build: bun run build:release --target x86_64-pc-windows-msvc | |
| - host: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| build: bun run build:release --target aarch64-pc-windows-msvc | |
| name: build - ${{ matrix.settings.target }} | |
| runs-on: ${{ matrix.settings.host }} | |
| defaults: | |
| run: | |
| working-directory: packages/native | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| # Reads the channel from rust-toolchain.toml, which must match zed's | |
| # pin for the gpui revision in packages/native/Cargo.toml. | |
| - name: Install Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: ${{ matrix.settings.target }} | |
| # this workflow caches cargo explicitly in the next step | |
| cache: false | |
| # the action defaults to RUSTFLAGS="-D warnings"; keep lint policy | |
| # in the crate instead of letting CI deny every warning | |
| rustflags: "" | |
| # gpui_apple compiles shaders with `metal`, which Xcode 26 no longer | |
| # ships by default. Without this the build fails with | |
| # "cannot execute tool 'metal' due to missing Metal Toolchain". | |
| - name: Install Metal toolchain | |
| if: contains(matrix.settings.target, 'apple-darwin') | |
| run: xcodebuild -downloadComponent MetalToolchain | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| packages/native/target/ | |
| key: ${{ matrix.settings.target }}-cargo-${{ hashFiles('packages/native/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ matrix.settings.target }}-cargo- | |
| # Linux system deps for GPUI (Vulkan, Wayland, X11, fonts) | |
| # Based on longbridge/gpui-component and Zed's script/linux | |
| - name: Install Linux dependencies | |
| if: contains(matrix.settings.target, 'linux') | |
| working-directory: . | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y \ | |
| gcc g++ clang \ | |
| libfontconfig-dev \ | |
| libwayland-dev \ | |
| libxkbcommon-x11-dev \ | |
| libx11-xcb-dev \ | |
| libssl-dev \ | |
| libzstd-dev \ | |
| libvulkan1 \ | |
| vulkan-validationlayers | |
| - name: Install dependencies | |
| working-directory: . | |
| run: bun install | |
| - name: Build native | |
| run: ${{ matrix.settings.build }} | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: packages/native/${{ env.APP_NAME }}.*.node | |
| if-no-files-found: error | |
| test: | |
| name: test | |
| needs: build | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Download macOS arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-aarch64-apple-darwin | |
| path: packages/native/ | |
| - name: Run React tests | |
| run: bun run test | |
| working-directory: packages/react | |
| - name: Build React package | |
| run: bun run build | |
| working-directory: packages/react | |
| - name: Run example tests | |
| run: bun run test | |
| working-directory: examples | |
| test-windows: | |
| name: test-windows-load | |
| needs: build | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Download Windows x64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-x86_64-pc-windows-msvc | |
| path: packages/native/ | |
| - name: Load native binding with Bun | |
| run: bun -e "require('./packages/native'); console.log('Windows native binding OK (bun)')" | |
| - name: Load native binding with Node | |
| run: node -e "require('./packages/native'); console.log('Windows native binding OK (node)')" | |
| publish: | |
| name: publish | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - test | |
| - test-windows | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: packages/native/artifacts | |
| - name: Create npm dirs and move artifacts | |
| run: | | |
| bunx @napi-rs/cli create-npm-dirs | |
| bunx @napi-rs/cli artifacts | |
| working-directory: packages/native | |
| - name: List packages | |
| run: ls -R packages/native/npm/ | |
| shell: bash | |
| # NPM_TOKEN lives in Sigillo (npm/tokens, prod). CI only stores | |
| # SIGILLO_TOKEN. Rotate the npm token in one place. | |
| - name: Publish @gpuix/native | |
| env: | |
| SIGILLO_TOKEN: ${{ secrets.SIGILLO_TOKEN }} | |
| SIGILLO_PROJECT: ${{ vars.SIGILLO_PROJECT }} | |
| SIGILLO_ENVIRONMENT: prod | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./packages/native/package.json').version") | |
| if npm view "@gpuix/native@${CURRENT_VERSION}" version 2>/dev/null; then | |
| echo "@gpuix/native@${CURRENT_VERSION} already published, skipping" | |
| else | |
| echo "Publishing @gpuix/native@${CURRENT_VERSION}" | |
| cd packages/native | |
| bunx sigillo run --command 'printf "//registry.npmjs.org/:_authToken=%s\n" "$NPM_TOKEN" > /tmp/gpuix-npmrc && NPM_CONFIG_USERCONFIG=/tmp/gpuix-npmrc npm publish --access public --provenance' | |
| fi | |
| - name: Build @gpuix/react | |
| run: bun run build | |
| working-directory: packages/react | |
| - name: Publish @gpuix/react | |
| env: | |
| SIGILLO_TOKEN: ${{ secrets.SIGILLO_TOKEN }} | |
| SIGILLO_PROJECT: ${{ vars.SIGILLO_PROJECT }} | |
| SIGILLO_ENVIRONMENT: prod | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./packages/react/package.json').version") | |
| if npm view "@gpuix/react@${CURRENT_VERSION}" version 2>/dev/null; then | |
| echo "@gpuix/react@${CURRENT_VERSION} already published, skipping" | |
| else | |
| echo "Publishing @gpuix/react@${CURRENT_VERSION}" | |
| cd packages/react | |
| node -e " | |
| const fs = require('fs') | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')) | |
| const native = require('../native/package.json').version | |
| pkg.dependencies['@gpuix/native'] = '^' + native | |
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n') | |
| " | |
| bunx sigillo run --command 'printf "//registry.npmjs.org/:_authToken=%s\n" "$NPM_TOKEN" > /tmp/gpuix-npmrc && NPM_CONFIG_USERCONFIG=/tmp/gpuix-npmrc npm publish --access public --provenance' | |
| fi |