Skip to content

Commit 1f53e71

Browse files
committed
Add CI/CD workflows for releases and playground deployment
- Add build-clang.yml: Builds Linux and macOS binaries on version tags - Update build-playground.yml: Builds WASM with EXIT_RUNTIME=0 and ALLOW_MEMORY_GROWTH flags to enable multiple callMain() invocations (fixes signal handler issue) - Playground deploys automatically on push to null-safe-c-dev - Binaries only released when explicitly tagged (v* for binaries, playground-v* for WASM)
1 parent 16c0ba9 commit 1f53e71

File tree

3 files changed

+186
-12
lines changed

3 files changed

+186
-12
lines changed

.github/workflows/build-clang.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Build Null-Safe Clang Binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-linux:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y ninja-build cmake build-essential
21+
22+
- name: Configure build
23+
run: |
24+
mkdir -p build
25+
cd build
26+
cmake -G Ninja \
27+
-DCMAKE_BUILD_TYPE=Release \
28+
-DLLVM_ENABLE_PROJECTS="clang" \
29+
-DLLVM_TARGETS_TO_BUILD="X86" \
30+
-DLLVM_ENABLE_ASSERTIONS=OFF \
31+
-DCMAKE_INSTALL_PREFIX=../install \
32+
../llvm
33+
34+
- name: Build Clang
35+
run: |
36+
cd build
37+
ninja clang
38+
39+
- name: Install Clang
40+
run: |
41+
cd build
42+
ninja install-clang
43+
ninja install-clang-headers
44+
45+
- name: Package binaries
46+
run: |
47+
cd install
48+
tar -czf clang-nullsafe-linux-x86_64.tar.gz bin/ lib/clang/
49+
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: clang-nullsafe-linux-x86_64
54+
path: install/clang-nullsafe-linux-x86_64.tar.gz
55+
56+
- name: Create Release
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
files: install/clang-nullsafe-linux-x86_64.tar.gz
60+
body: |
61+
## Null-Safe Clang Binary Release
62+
63+
This release contains the Null-Safe Clang compiler for Linux x86_64.
64+
65+
### Installation:
66+
```bash
67+
tar -xzf clang-nullsafe-linux-x86_64.tar.gz
68+
export PATH=$PWD/bin:$PATH
69+
clang --version
70+
```
71+
72+
### Usage:
73+
```bash
74+
# Compile with null-safety warnings (default)
75+
clang mycode.c
76+
77+
# Promote warnings to errors
78+
clang -Werror=nullability mycode.c
79+
80+
# Disable null-safety checking
81+
clang -fno-strict-nullability mycode.c
82+
```
83+
84+
See the [README](https://github.com/cs01/llvm-project/blob/null-safe-c-dev/README.md) for full documentation.
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
88+
build-macos:
89+
runs-on: macos-latest
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
95+
- name: Install dependencies
96+
run: |
97+
brew install ninja cmake
98+
99+
- name: Configure build
100+
run: |
101+
mkdir -p build
102+
cd build
103+
cmake -G Ninja \
104+
-DCMAKE_BUILD_TYPE=Release \
105+
-DLLVM_ENABLE_PROJECTS="clang" \
106+
-DLLVM_TARGETS_TO_BUILD="AArch64;X86" \
107+
-DLLVM_ENABLE_ASSERTIONS=OFF \
108+
-DCMAKE_INSTALL_PREFIX=../install \
109+
../llvm
110+
111+
- name: Build Clang
112+
run: |
113+
cd build
114+
ninja clang
115+
116+
- name: Install Clang
117+
run: |
118+
cd build
119+
ninja install-clang
120+
ninja install-clang-headers
121+
122+
- name: Package binaries
123+
run: |
124+
cd install
125+
tar -czf clang-nullsafe-macos-universal.tar.gz bin/ lib/clang/
126+
127+
- name: Upload artifact
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: clang-nullsafe-macos-universal
131+
path: install/clang-nullsafe-macos-universal.tar.gz
132+
133+
- name: Create Release
134+
uses: softprops/action-gh-release@v1
135+
with:
136+
files: install/clang-nullsafe-macos-universal.tar.gz
137+
body: |
138+
## Null-Safe Clang Binary Release (macOS)
139+
140+
This release contains the Null-Safe Clang compiler for macOS (Intel and Apple Silicon).
141+
142+
### Installation:
143+
```bash
144+
tar -xzf clang-nullsafe-macos-universal.tar.gz
145+
export PATH=$PWD/bin:$PATH
146+
clang --version
147+
```
148+
149+
See the [README](https://github.com/cs01/llvm-project/blob/null-safe-c-dev/README.md) for usage instructions.
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-playground.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
-DLLVM_ENABLE_TERMINFO=OFF \
4545
-DLLVM_ENABLE_ZLIB=OFF \
4646
-DLLVM_ENABLE_LIBXML2=OFF \
47-
-DCMAKE_EXE_LINKER_FLAGS="-sEXPORTED_RUNTIME_METHODS=callMain" \
47+
-DCMAKE_EXE_LINKER_FLAGS="-sEXPORTED_RUNTIME_METHODS=callMain -sEXIT_RUNTIME=0 -sALLOW_MEMORY_GROWTH=1" \
4848
../llvm
4949
5050
- name: Build Null-Safe Clang WASM

CONTRIBUTING.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
1-
# Contributing to LLVM
1+
# Contributing to Null-Safe Clang
22

3-
Thank you for your interest in contributing to LLVM! There are many ways to
4-
contribute, and we appreciate all contributions.
3+
Development branch: `null-safe-c-dev`
54

6-
To get started with contributing, please take a look at the
7-
[Contributing to LLVM](https://llvm.org/docs/Contributing.html) guide. It
8-
describes how to get involved, raise issues and submit patches.
5+
## Building
96

10-
## Getting in touch
7+
### Standard (x86)
8+
```bash
9+
mkdir build && cd build
10+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" ../llvm
11+
ninja clang clangd
12+
```
1113

12-
Join the [LLVM Discourse forums](https://discourse.llvm.org/) or [Discord
13-
chat](https://discord.gg/xS7Z362).
14+
### WASM (playground)
15+
```bash
16+
mkdir build-wasm && cd build-wasm
17+
export PATH="/path/to/emscripten:$PATH"
18+
emcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
19+
-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="WebAssembly" \
20+
-DLLVM_ENABLE_THREADS=OFF \
21+
-DCMAKE_EXE_LINKER_FLAGS="-sEXPORTED_RUNTIME_METHODS=callMain -sEXIT_RUNTIME=0 -sALLOW_MEMORY_GROWTH=1" \
22+
../llvm
23+
ninja clang
24+
```
1425

15-
The LLVM project has adopted a [code of conduct](https://llvm.org/docs/CodeOfConduct.html) for
16-
participants to all modes of communication within the project.
26+
## Testing
27+
```bash
28+
build/bin/llvm-lit -v clang/test/Sema/strict-nullability.c
29+
```
30+
31+
## Releases
32+
33+
**Playground:** Push to `null-safe-c-dev` → deploys GitHub Pages automatically.
34+
35+
**WASM files:** `git tag playground-v1.0 && git push origin playground-v1.0`
36+
37+
**Binaries:** `git tag v1.0.0 && git push origin v1.0.0`
38+
39+
Downloads: https://github.com/cs01/llvm-project/releases

0 commit comments

Comments
 (0)