Skip to content

Commit e92173e

Browse files
mcbartonvgvassilev
authored andcommitted
Create inital llvm-test-emscripten.yml
1 parent 734bcf5 commit e92173e

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Emscripten
2+
on:
3+
pull_request:
4+
branches: [main]
5+
push:
6+
branches: [main]
7+
schedule:
8+
- cron: '0 23 * * *'
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build-main:
19+
name: ${{ matrix.os }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-24.04-arm, macos-15, windows-2025]
25+
26+
steps:
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
repository: llvm/llvm-project
30+
path: ${{ github.workspace }}/llvm
31+
fetch-depth: 0
32+
33+
- name: Setup emsdk
34+
run: |
35+
cd ${{ github.workspace }}/llvm
36+
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
37+
cd emsdk
38+
./emsdk install latest
39+
40+
- name: Install deps on Windows
41+
if: ${{ runner.os == 'windows' }}
42+
run: |
43+
choco install ninja
44+
45+
- name: Install deps on Linux
46+
if: ${{ runner.os == 'Linux' }}
47+
run: |
48+
sudo apt-get install ninja-build
49+
50+
- name: Build Emscripten LLVM on Unix systems
51+
if: ${{ runner.os != 'windows' }}
52+
run: |
53+
cd ${{ github.workspace }}/llvm
54+
./emsdk/emsdk activate latest
55+
source ./emsdk/emsdk_env.sh
56+
mkdir native_build
57+
cd native_build
58+
cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/
59+
cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all)
60+
export NATIVE_DIR=$PWD/bin/
61+
cd ..
62+
mkdir build
63+
cd build
64+
emcmake cmake -DCMAKE_BUILD_TYPE=Release \
65+
-DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \
66+
-DLLVM_ENABLE_ASSERTIONS=ON \
67+
-DLLVM_TARGETS_TO_BUILD="WebAssembly" \
68+
-DLLVM_ENABLE_LIBEDIT=OFF \
69+
-DLLVM_ENABLE_PROJECTS="clang;lld" \
70+
-DLLVM_ENABLE_ZSTD=OFF \
71+
-DLLVM_ENABLE_LIBXML2=OFF \
72+
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
73+
-DCLANG_ENABLE_ARCMT=OFF \
74+
-DCLANG_ENABLE_BOOTSTRAP=OFF \
75+
-DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4" \
76+
-DLLVM_INCLUDE_BENCHMARKS=OFF \
77+
-DLLVM_INCLUDE_EXAMPLES=OFF \
78+
-DLLVM_ENABLE_THREADS=OFF \
79+
-DLLVM_BUILD_TOOLS=OFF \
80+
-DLLVM_ENABLE_LIBPFM=OFF \
81+
-DCLANG_BUILD_TOOLS=OFF \
82+
-G Ninja \
83+
-DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
84+
../llvm
85+
emmake ninja ClangReplInterpreterTests ClangReplInterpreterExceptionTests
86+
node ./tools/clang/unittests/Interpreter/ClangReplInterpreterTests.js
87+
node ./tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests.js
88+
89+
90+
- name: Build Emscripten LLVM on Windows systems
91+
if: ${{ runner.os == 'windows' }}
92+
run: |
93+
function Error-On-Failure {
94+
param (
95+
[Parameter(Mandatory)]
96+
[ScriptBlock]$Command
97+
)
98+
99+
& $Command
100+
101+
if ($LASTEXITCODE -ne 0) {
102+
exit $LASTEXITCODE
103+
}
104+
}
105+
cd ${{ github.workspace }}/llvm
106+
.\emsdk\emsdk activate latest
107+
mkdir native_build
108+
cd native_build
109+
cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm/
110+
cmake --build . --target llvm-tblgen clang-tblgen --parallel $(nproc --all)
111+
$env:PWD_DIR= $PWD.Path
112+
$env:NATIVE_DIR="$env:PWD_DIR/bin/"
113+
cd ..
114+
mkdir build
115+
cd build
116+
emcmake cmake -DCMAKE_BUILD_TYPE=Release `
117+
-DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten `
118+
-DLLVM_ENABLE_ASSERTIONS=ON `
119+
-DLLVM_TARGETS_TO_BUILD="WebAssembly" `
120+
-DLLVM_ENABLE_LIBEDIT=OFF `
121+
-DLLVM_ENABLE_PROJECTS="clang;lld" `
122+
-DLLVM_ENABLE_ZSTD=OFF `
123+
-DLLVM_ENABLE_LIBXML2=OFF `
124+
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
125+
-DCLANG_ENABLE_ARCMT=OFF `
126+
-DCLANG_ENABLE_BOOTSTRAP=OFF `
127+
-DCMAKE_CXX_FLAGS="-Dwait4=__syscall_wait4" `
128+
-DLLVM_INCLUDE_BENCHMARKS=OFF `
129+
-DLLVM_INCLUDE_EXAMPLES=OFF `
130+
-DLLVM_ENABLE_THREADS=OFF `
131+
-DLLVM_BUILD_TOOLS=OFF `
132+
-DLLVM_ENABLE_LIBPFM=OFF `
133+
-DCLANG_BUILD_TOOLS=OFF `
134+
-G Ninja `
135+
-DLLVM_NATIVE_TOOL_DIR="$env:NATIVE_DIR" `
136+
..\llvm
137+
Error-On-Failure { emmake ninja ClangReplInterpreterTests ClangReplInterpreterExceptionTests }
138+
Error-On-Failure { node ./tools/clang/unittests/Interpreter/ClangReplInterpreterTests.js }
139+
Error-On-Failure { node ./tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests.js }

0 commit comments

Comments
 (0)