Skip to content

Commit 6b5b03d

Browse files
committed
Initial Commit
0 parents  commit 6b5b03d

File tree

131 files changed

+20045
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+20045
-0
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Zig
21+
uses: goto-bus-stop/setup-zig@v2
22+
with:
23+
version: 0.15.1
24+
25+
- name: Run tests
26+
run: zig build test
27+
28+
- name: Build library
29+
run: zig build
30+
31+
lint:
32+
name: Format check
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Setup Zig
39+
uses: goto-bus-stop/setup-zig@v2
40+
with:
41+
version: 0.15.1
42+
43+
- name: Check formatting
44+
run: zig fmt --check src/

.github/workflows/deploy-docs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Deploy VitePress documentation to GitHub Pages
2+
name: Deploy Docs
3+
4+
on:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Bun
28+
uses: oven-sh/setup-bun@v1
29+
with:
30+
bun-version: latest
31+
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v4
34+
35+
- name: Install dependencies
36+
run: bun install
37+
working-directory: docs
38+
39+
- name: Build with VitePress
40+
run: bun run docs:build
41+
working-directory: docs
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: docs/.vitepress/dist
47+
48+
deploy:
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
needs: build
53+
runs-on: ubuntu-latest
54+
name: Deploy
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Release Workflow - Build and publish release artifacts
2+
name: Release
3+
4+
permissions:
5+
contents: write
6+
7+
on:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
test:
13+
name: Test on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Zig
23+
uses: mlugg/setup-zig@v2
24+
with:
25+
version: 0.15.0
26+
27+
- name: Run Tests
28+
run: zig build test
29+
30+
build-library:
31+
name: Build Library (${{ matrix.target }})
32+
needs: test
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
target:
37+
- x86_64-windows
38+
- x86-windows
39+
- x86_64-linux
40+
- x86-linux
41+
- aarch64-linux
42+
- x86_64-macos
43+
- aarch64-macos
44+
- x86_64-freestanding
45+
- aarch64-freestanding
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Zig
51+
uses: mlugg/setup-zig@v2
52+
with:
53+
version: 0.15.0
54+
55+
- name: Build Library
56+
run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }}
57+
58+
- name: Rename Artifact (Windows)
59+
if: contains(matrix.target, 'windows')
60+
run: mv zig-out/lib/tui.lib tui-${{ matrix.target }}.lib
61+
62+
- name: Rename Artifact (Unix)
63+
if: contains(matrix.target, 'windows') == false
64+
run: mv zig-out/lib/libtui.a libtui-${{ matrix.target }}.a
65+
66+
- name: Upload Artifact
67+
run: gh release upload ${{ github.event.release.tag_name }} ${{ contains(matrix.target, 'windows') && format('tui-{0}.lib', matrix.target) || format('libtui-{0}.a', matrix.target) }}
68+
env:
69+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
70+
71+
update-release:
72+
name: Update Release Description
73+
needs: test
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
79+
- name: Get Release URL
80+
id: get_url
81+
run: echo "url=https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz" >> $GITHUB_OUTPUT
82+
83+
- name: Setup Zig
84+
uses: mlugg/setup-zig@v2
85+
with:
86+
version: 0.15.0
87+
88+
- name: Calculate Hash
89+
id: calc_hash
90+
run: |
91+
zig fetch ${{ steps.get_url.outputs.url }}
92+
HASH=$(zig fetch --save ${{ steps.get_url.outputs.url }} 2>&1 | grep -oP '(?<=hash: ).*' || echo "run-zig-fetch-to-get-hash")
93+
echo "hash=$HASH" >> $GITHUB_OUTPUT
94+
95+
- name: Update Release Body
96+
uses: softprops/action-gh-release@v1
97+
with:
98+
token: ${{ secrets.GH_TOKEN }}
99+
body: |
100+
${{ github.event.release.body }}
101+
102+
## 📦 Installation
103+
104+
### Option A — Automatic (Recommended)
105+
106+
```bash
107+
zig fetch --save git+https://github.com/${{ github.repository }}.git#${{ github.event.release.tag_name }}
108+
```
109+
110+
### Option B — Using Archive URL
111+
112+
```bash
113+
zig fetch --save https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz
114+
```
115+
116+
Then add to `build.zig`:
117+
118+
```zig
119+
const tui_dep = b.dependency("tui", .{
120+
.target = target,
121+
.optimize = optimize,
122+
});
123+
exe.root_module.addImport("tui", tui_dep.module("tui"));
124+
```
125+
126+
## 📥 Prebuilt Libraries
127+
128+
| Platform | Architecture | Download |
129+
|----------|--------------|----------|
130+
| Windows | x86_64 | [tui-x86_64-windows.lib](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/tui-x86_64-windows.lib) |
131+
| Windows | x86 | [tui-x86-windows.lib](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/tui-x86-windows.lib) |
132+
| Linux | x86_64 | [libtui-x86_64-linux.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-x86_64-linux.a) |
133+
| Linux | x86 | [libtui-x86-linux.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-x86-linux.a) |
134+
| Linux | aarch64 | [libtui-aarch64-linux.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-aarch64-linux.a) |
135+
| macOS | x86_64 | [libtui-x86_64-macos.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-x86_64-macos.a) |
136+
| macOS | aarch64 | [libtui-aarch64-macos.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-aarch64-macos.a) |
137+
| Bare Metal | x86_64 | [libtui-x86_64-freestanding.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-x86_64-freestanding.a) |
138+
| Bare Metal | aarch64 | [libtui-aarch64-freestanding.a](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/libtui-aarch64-freestanding.a) |

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Zig
2+
zig-cache/
3+
zig-out/
4+
.zig-cache/
5+
6+
7+
# Build artifacts
8+
*.o
9+
*.a
10+
*.so
11+
*.dll
12+
*.dylib
13+
*.exe
14+
*.pdb
15+
16+
# IDE
17+
.vscode/
18+
.idea/
19+
*.swp
20+
*.swo
21+
*~
22+
23+
# OS
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Docs
28+
docs/node_modules/
29+
docs/.vitepress/cache/
30+
docs/.vitepress/dist/
31+
docs/bun.lock
32+
docs/package-lock.json
33+
docs/yarn.lock
34+
35+
# Test coverage
36+
*.profdata
37+
*.profraw
38+
39+
# Temporary files
40+
*.tmp
41+
*.temp
42+
*.log

0 commit comments

Comments
 (0)