-
Notifications
You must be signed in to change notification settings - Fork 491
120 lines (102 loc) · 2.87 KB
/
build-core.yml
File metadata and controls
120 lines (102 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build Core
on:
push:
pull_request:
branches: [main]
env:
ZIG_VERSION: 0.15.2
# Workaround for bug in Zig 0.15.2 (fixed in next version)
# https://github.com/ziglang/zig/issues/25805
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/.zig-global-cache
jobs:
build:
name: Build Native Libraries
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ 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: Upload native artifacts
uses: actions/upload-artifact@v4
with:
name: native-libraries
path: packages/core/node_modules/@opentui/
retention-days: 1
test:
name: Test (${{ matrix.os }})
needs: build
strategy:
matrix:
include:
- os: macos-latest
platform: darwin-arm64
- os: ubuntu-latest
platform: linux-x64
- os: windows-latest
platform: win32-x64
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Install dependencies
run: bun install
- name: Download native artifacts
uses: actions/download-artifact@v4
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
run: |
cd packages/core/src/zig
zig build test --summary all
- name: Build TypeScript library
run: |
cd packages/core
bun run build:lib
- name: Run TypeScript tests
run: |
cd packages/core
bun run test:js
# Gate job for branch protection
build-complete:
name: Core - Build and Test
needs: [test]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "Tests failed"
exit 1
fi
echo "All tests passed"