mirror of
https://github.com/anomalyco/opentui.git
synced 2026-09-19 01:26:03 +08:00
fa14b96ad4
Keep 26.4.0 as the minimum supported version while allowing later releases.
171 lines
4.6 KiB
YAML
171 lines
4.6 KiB
YAML
name: Build Core
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
NODE_VERSION: 26.7.0
|
|
ZIG_VERSION: 0.16.0
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Native Libraries
|
|
runs-on: blacksmith-12vcpu-macos-15
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.14
|
|
|
|
- name: Setup Zig
|
|
uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: ${{ env.ZIG_VERSION }}
|
|
use-cache: false
|
|
|
|
- name: Restore Zig cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: packages/native/.zig-cache
|
|
key: zig-v1-${{ runner.os }}-${{ env.ZIG_VERSION }}-${{ github.run_id }}-${{ github.job }}
|
|
restore-keys: zig-v1-${{ runner.os }}-${{ env.ZIG_VERSION }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Build native libraries (cross-compile all platforms)
|
|
run: |
|
|
cd packages/core
|
|
bun run build:native --all
|
|
|
|
- name: Build custom target without Ghostty VT
|
|
working-directory: packages/native
|
|
run: zig build -Dlibrary-target=x86_64-freebsd -Doptimize=ReleaseFast
|
|
|
|
- name: Upload native artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: native-libraries
|
|
path: packages/core/node_modules/@opentui/core-*/**
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
test:
|
|
name: Test (${{ matrix.os }})
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: blacksmith-12vcpu-macos-15
|
|
platform: darwin-arm64
|
|
- os: blacksmith-8vcpu-ubuntu-2404
|
|
platform: linux-x64
|
|
- os: blacksmith-8vcpu-windows-2025
|
|
platform: win32-x64
|
|
runs-on: ${{ matrix.os }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.14
|
|
|
|
- name: Setup Node
|
|
if: runner.os == 'Linux'
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Setup Zig
|
|
uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: ${{ env.ZIG_VERSION }}
|
|
use-cache: false
|
|
|
|
- name: Restore Zig cache
|
|
if: runner.os != 'Windows'
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: packages/native/.zig-cache
|
|
key: zig-v1-${{ runner.os }}-${{ env.ZIG_VERSION }}-${{ github.run_id }}-${{ github.job }}
|
|
restore-keys: zig-v1-${{ runner.os }}-${{ env.ZIG_VERSION }}-
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Download native artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: native-libraries
|
|
path: packages/core/node_modules/@opentui/
|
|
|
|
- name: Verify native library
|
|
run: |
|
|
echo "Checking for ${{ matrix.platform }} native library..."
|
|
ls -la packages/core/node_modules/@opentui/
|
|
ls -la packages/core/node_modules/@opentui/core-${{ matrix.platform }}/
|
|
|
|
- name: Run native tests
|
|
working-directory: packages/core
|
|
run: bun run test:native
|
|
|
|
- name: Build TypeScript library
|
|
run: |
|
|
cd packages/core
|
|
bun run build:lib
|
|
|
|
- name: Run TypeScript tests
|
|
run: |
|
|
cd packages/core
|
|
export OTUI_TREE_SITTER_WORKER_PATH="$(bun -e 'import { resolve } from "node:path"; console.log(resolve("dist/parser.worker.js"))')"
|
|
bun run test:js
|
|
|
|
- name: Run Node TypeScript tests
|
|
if: runner.os == 'Linux'
|
|
working-directory: packages/core
|
|
run: bun run test:js:node
|
|
|
|
- name: Test packed distribution
|
|
if: runner.os == 'Linux'
|
|
working-directory: packages/core
|
|
run: bun run test:dist --skip-build
|
|
|
|
- name: Test Node SEA executable
|
|
if: runner.os == 'Linux'
|
|
working-directory: packages/core
|
|
run: bun run test:standalone --skip-build
|
|
|
|
# Gate job for branch protection
|
|
build-complete:
|
|
name: Core - Build and Test
|
|
needs: [test]
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
if: always()
|
|
steps:
|
|
- name: Check test results
|
|
run: |
|
|
if [ "${{ needs.test.result }}" != "success" ]; then
|
|
echo "Tests failed"
|
|
exit 1
|
|
fi
|
|
echo "All tests passed"
|