Skip to content

Commit 5c723b2

Browse files
committed
Unify release workflows and fix macOS installer
- Build WASM with platform binaries, release together - Fix install.sh: auto-detect version, handle zstd/SDK deps - Add macOS prerequisites to README
1 parent 89f36f1 commit 5c723b2

File tree

6 files changed

+195
-139
lines changed

6 files changed

+195
-139
lines changed

.github/workflows/build-clang.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,74 @@ jobs:
119119
with:
120120
name: clang-nullsafe-macos-universal
121121
path: install/clang-nullsafe-macos-universal.tar.gz
122+
123+
build-wasm:
124+
runs-on: ubuntu-latest
125+
126+
steps:
127+
- name: Checkout code
128+
uses: actions/checkout@v4
129+
with:
130+
submodules: recursive
131+
132+
- name: Setup Emscripten
133+
uses: mymindstorm/setup-emsdk@v14
134+
with:
135+
version: 'latest'
136+
137+
- name: Install dependencies
138+
run: |
139+
sudo apt-get update
140+
sudo apt-get install -y ninja-build cmake ccache
141+
142+
- name: Setup ccache
143+
uses: actions/cache@v4
144+
with:
145+
path: ~/.ccache
146+
key: ccache-wasm-${{ github.sha }}
147+
restore-keys: |
148+
ccache-wasm-
149+
150+
- name: Configure WASM build
151+
run: |
152+
mkdir -p build-wasm
153+
cd build-wasm
154+
emcmake cmake -G Ninja \
155+
-DCMAKE_BUILD_TYPE=Release \
156+
-DLLVM_ENABLE_PROJECTS="clang" \
157+
-DLLVM_TARGETS_TO_BUILD="WebAssembly" \
158+
-DLLVM_ENABLE_THREADS=OFF \
159+
-DLLVM_ENABLE_EH=OFF \
160+
-DLLVM_ENABLE_RTTI=OFF \
161+
-DLLVM_BUILD_TOOLS=OFF \
162+
-DLLVM_BUILD_UTILS=OFF \
163+
-DLLVM_INCLUDE_TESTS=OFF \
164+
-DLLVM_INCLUDE_EXAMPLES=OFF \
165+
-DLLVM_ENABLE_TERMINFO=OFF \
166+
-DLLVM_ENABLE_ZLIB=OFF \
167+
-DLLVM_ENABLE_LIBXML2=OFF \
168+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
169+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
170+
-DCMAKE_EXE_LINKER_FLAGS="-sEXPORTED_RUNTIME_METHODS=callMain -sEXIT_RUNTIME=0 -sALLOW_MEMORY_GROWTH=1" \
171+
../llvm
172+
173+
- name: Build WASM
174+
run: |
175+
cd build-wasm
176+
ninja clang
177+
178+
- name: Package WASM artifacts
179+
run: |
180+
mkdir -p wasm-artifacts
181+
cp build-wasm/bin/clang.wasm wasm-artifacts/clang-nullsafe.wasm
182+
cp build-wasm/bin/clang.js wasm-artifacts/clang-nullsafe.js
183+
gzip -k wasm-artifacts/clang-nullsafe.wasm
184+
gzip -k wasm-artifacts/clang-nullsafe.js
185+
cd wasm-artifacts
186+
tar -czf clang-nullsafe-wasm.tar.gz *.wasm *.js *.gz
187+
188+
- name: Upload artifact
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: clang-nullsafe-wasm
192+
path: wasm-artifacts/clang-nullsafe-wasm.tar.gz

.github/workflows/build-playground.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/deploy-playground.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,21 @@ jobs:
2424

2525
- name: Download latest WASM files from release
2626
run: |
27-
# Get the latest playground release
2827
LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases | \
2928
jq -r '[.[] | select(.tag_name | startswith("playground-v"))] | first | .tag_name')
3029
3130
echo "Latest playground release: $LATEST_RELEASE"
3231
3332
if [ -z "$LATEST_RELEASE" ]; then
34-
echo "No playground release found! Please create a release with tag 'playground-vX.X.X'"
33+
echo "No playground release found"
3534
exit 1
3635
fi
3736
38-
# Download the WASM files to a temp directory
3937
mkdir -p /tmp/wasm-files
4038
cd /tmp/wasm-files
4139
curl -L -o clang.wasm "https://github.com/${{ github.repository }}/releases/download/${LATEST_RELEASE}/clang-nullsafe.wasm"
4240
curl -L -o clang.js "https://github.com/${{ github.repository }}/releases/download/${LATEST_RELEASE}/clang-nullsafe.js"
43-
41+
4442
echo "Downloaded files:"
4543
ls -lh
4644
@@ -49,34 +47,25 @@ jobs:
4947
git config user.name "github-actions[bot]"
5048
git config user.email "github-actions[bot]@users.noreply.github.com"
5149
52-
# Check if gh-pages exists
5350
if git ls-remote --exit-code --heads origin gh-pages; then
54-
echo "gh-pages branch exists, checking out"
5551
git fetch origin gh-pages
5652
git checkout gh-pages
5753
else
58-
echo "Creating new orphan gh-pages branch"
5954
git checkout --orphan gh-pages
6055
fi
6156
62-
# Clear everything
6357
git rm -rf . 2>/dev/null || true
6458
65-
# Copy playground files from the original branch
6659
git checkout null-safe-c-dev -- nullsafe-playground
6760
mv nullsafe-playground/* .
6861
rm -rf nullsafe-playground
6962
70-
# Copy the downloaded WASM files
7163
cp /tmp/wasm-files/* .
7264
73-
# Disable Jekyll processing
7465
touch .nojekyll
7566
76-
# Add all files (including the downloaded WASM)
7767
git add -A
7868
79-
# Commit
8069
if git diff --staged --quiet; then
8170
echo "No changes to deploy"
8271
else

.github/workflows/release-clang.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,44 @@ jobs:
2626
name: clang-nullsafe-macos-universal
2727
path: artifacts/
2828

29+
- name: Download WASM artifact
30+
uses: dawidd6/action-download-artifact@v3
31+
with:
32+
workflow: build-clang.yml
33+
commit: ${{ github.sha }}
34+
name: clang-nullsafe-wasm
35+
path: artifacts/
36+
2937
- name: Create Release
3038
uses: softprops/action-gh-release@v1
3139
with:
3240
files: |
3341
artifacts/clang-nullsafe-linux-x86_64.tar.gz
3442
artifacts/clang-nullsafe-macos-universal.tar.gz
43+
artifacts/clang-nullsafe-wasm.tar.gz
3544
body: |
36-
## Null-Safe Clang Binary Release
45+
## Null-Safe Clang Release
3746
38-
This release contains the Null-Safe Clang compiler and clangd language server for Linux and macOS.
47+
This release contains the Null-Safe Clang compiler for all platforms.
3948
4049
### What's included:
50+
51+
**Native Binaries (Linux/macOS):**
4152
- `clang` - The Null-Safe C compiler
4253
- `clangd` - Language server for IDE integration (VSCode, vim, etc.)
4354
55+
**WebAssembly:**
56+
- `clang-nullsafe.wasm` - WebAssembly compiler for browser playground
57+
- `clang-nullsafe.js` - JavaScript glue code
58+
4459
### Installation:
4560
46-
**Linux / macOS:**
61+
**Quick install (Linux/macOS):**
62+
```bash
63+
curl -fsSL https://raw.githubusercontent.com/cs01/llvm-project/null-safe-c-dev/install.sh | sh
64+
```
65+
66+
**Manual install:**
4767
```bash
4868
tar -xzf clang-nullsafe-<platform>.tar.gz
4969
export PATH=$PWD/bin:$PATH
@@ -62,6 +82,9 @@ jobs:
6282
clang -fno-strict-nullability mycode.c
6383
```
6484
85+
### Try it online:
86+
Interactive WebAssembly playground: https://cs01.github.io/llvm-project/
87+
6588
See the [README](https://github.com/cs01/llvm-project/blob/null-safe-c-dev/README.md) for full documentation.
6689
env:
6790
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,25 @@ Try it out in the [Interactive Playground](https://cs01.github.io/llvm-project/)
3434
3535
## Installation
3636
37+
### Prerequisites
38+
39+
**macOS:**
40+
```bash
41+
brew install zstd
42+
xcode-select --install # If not already installed
43+
```
44+
45+
### Quick Install
46+
3747
```bash
3848
curl -fsSL https://raw.githubusercontent.com/cs01/llvm-project/null-safe-c-dev/install.sh | sh
3949
```
4050

41-
Or download manually from [releases](https://github.com/cs01/llvm-project/releases/latest).
51+
Or download manually from [releases](https://github.com/cs01/llvm-project/releases).
4252

4353
### Windows
4454

45-
Download and extract from [releases](https://github.com/cs01/llvm-project/releases/latest), then add the `bin` directory to your PATH.
55+
Builds not available at this time, you must clone and build locally.
4656

4757
### What's Included
4858

0 commit comments

Comments
 (0)