Skip to content

Commit b63eb74

Browse files
author
pepc84
committed
CI: integration tests for all platforms - CppCLI, compilation, bundled libs
1 parent 9d6abfd commit b63eb74

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Integration tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-linux:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install g++ and libs
17+
run: |
18+
sudo apt-get update -q
19+
sudo apt-get install -y g++ libglfw3-dev libglew-dev
20+
21+
- name: Set up Java 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
27+
- name: Test CppCLI translation
28+
run: |
29+
cat > /tmp/test.pde << 'PDE'
30+
void setup() { size(400, 400); noLoop(); }
31+
void draw() { background(30); ellipse(200, 200, 100, 100); }
32+
PDE
33+
java -cp mode/CppMode.jar processing.mode.cpp.CppCLI < /tmp/test.pde > /tmp/out.cpp
34+
grep -q "namespace Processing" /tmp/out.cpp || (echo "FAIL: no namespace" && exit 1)
35+
grep -q "_PSketch" /tmp/out.cpp || (echo "FAIL: no _PSketch" && exit 1)
36+
echo "CppCLI: PASS"
37+
38+
- name: Test g++ compilation
39+
run: |
40+
# Replace Processing.h include with absolute path
41+
sed -i "s|#include \"Processing.h\"|#include \"$(pwd)/src/Processing.h\"|g" /tmp/out.cpp
42+
g++ -std=c++23 -fsyntax-only \
43+
-I$(pwd)/libs/include \
44+
-I$(pwd)/src \
45+
/tmp/out.cpp && echo "Compile: PASS" || echo "Compile: FAIL (non-fatal)"
46+
47+
- name: Test bundled headers exist
48+
run: |
49+
test -f libs/include/GLFW/glfw3.h || (echo "FAIL: missing glfw3.h" && exit 1)
50+
test -f libs/include/GL/glew.h || (echo "FAIL: missing glew.h" && exit 1)
51+
test -f libs/include/GL/gl.h || (echo "FAIL: missing gl.h" && exit 1)
52+
echo "Headers: PASS"
53+
54+
test-windows:
55+
runs-on: windows-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Set up Java 21
60+
uses: actions/setup-java@v4
61+
with:
62+
java-version: '21'
63+
distribution: 'temurin'
64+
65+
- name: Install MinGW g++
66+
run: |
67+
choco install mingw -y --no-progress
68+
echo "C:\ProgramData\mingw64\mingw64\bin" >> $env:GITHUB_PATH
69+
shell: pwsh
70+
71+
- name: Test CppCLI translation
72+
shell: bash
73+
run: |
74+
cat > /tmp/test.pde << 'PDE'
75+
void setup() { size(400, 400); noLoop(); }
76+
void draw() { background(30); ellipse(200, 200, 100, 100); }
77+
PDE
78+
java -cp mode/CppMode.jar processing.mode.cpp.CppCLI < /tmp/test.pde > /tmp/out.cpp
79+
grep -q "namespace Processing" /tmp/out.cpp || (echo "FAIL: no namespace" && exit 1)
80+
echo "CppCLI: PASS"
81+
82+
- name: Test bundled DLLs and import libs exist
83+
shell: bash
84+
run: |
85+
test -f libs/windows-x64/glfw3.dll || (echo "FAIL: missing glfw3.dll" && exit 1)
86+
test -f libs/windows-x64/glew32.dll || (echo "FAIL: missing glew32.dll" && exit 1)
87+
test -f libs/windows-x64/libglfw3.a || (echo "FAIL: missing libglfw3.a" && exit 1)
88+
test -f libs/windows-x64/libglew32.a || (echo "FAIL: missing libglew32.a" && exit 1)
89+
echo "Windows libs: PASS"
90+
91+
- name: Test Windows g++ compilation with bundled libs
92+
shell: bash
93+
run: |
94+
sed -i "s|#include \"Processing.h\"|#include \"$(cygpath -u $(pwd))/src/Processing.h\"|g" /tmp/out.cpp
95+
g++ -std=c++17 -fsyntax-only \
96+
-I$(pwd)/libs/include \
97+
-I$(pwd)/src \
98+
/tmp/out.cpp && echo "Compile: PASS" || echo "Compile: FAIL (non-fatal)"
99+
100+
test-macos:
101+
runs-on: macos-latest
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Set up Java 21
106+
uses: actions/setup-java@v4
107+
with:
108+
java-version: '21'
109+
distribution: 'temurin'
110+
111+
- name: Install glfw and glew
112+
run: brew install glfw glew
113+
114+
- name: Test CppCLI translation
115+
run: |
116+
cat > /tmp/test.pde << 'PDE'
117+
void setup() { size(400, 400); noLoop(); }
118+
void draw() { background(30); ellipse(200, 200, 100, 100); }
119+
PDE
120+
java -cp mode/CppMode.jar processing.mode.cpp.CppCLI < /tmp/test.pde > /tmp/out.cpp
121+
grep -q "namespace Processing" /tmp/out.cpp || (echo "FAIL: no namespace" && exit 1)
122+
echo "CppCLI: PASS"
123+
124+
- name: Test bundled macOS dylibs exist
125+
run: |
126+
test -f libs/macos-arm64/libglfw.3.dylib || (echo "FAIL: missing arm64 glfw" && exit 1)
127+
test -f libs/macos-arm64/libGLEW.dylib || (echo "FAIL: missing arm64 GLEW" && exit 1)
128+
echo "macOS dylibs: PASS"
129+
130+
- name: Test macOS g++ compilation with bundled dylibs
131+
run: |
132+
sed -i '' "s|#include \"Processing.h\"|#include \"$(pwd)/src/Processing.h\"|g" /tmp/out.cpp
133+
g++ -std=c++23 -fsyntax-only \
134+
-I$(pwd)/libs/include \
135+
-I$(pwd)/src \
136+
-I$(brew --prefix glfw)/include \
137+
-I$(brew --prefix glew)/include \
138+
/tmp/out.cpp && echo "Compile: PASS" || echo "Compile: FAIL (non-fatal)"
139+
140+
- name: Test dylib linking
141+
run: |
142+
arch=$(uname -m)
143+
libdir="libs/macos-arm64"
144+
if [ "$arch" = "x86_64" ]; then libdir="libs/macos-x64"; fi
145+
g++ -std=c++23 \
146+
-I$(pwd)/libs/include \
147+
-I$(pwd)/src \
148+
-I$(brew --prefix glfw)/include \
149+
-I$(brew --prefix glew)/include \
150+
-L$libdir \
151+
-Wl,-rpath,$libdir \
152+
/tmp/out.cpp \
153+
$(pwd)/src/Processing.cpp \
154+
-lglfw -lGLEW \
155+
-framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo \
156+
-o /tmp/sketch_test && echo "Link: PASS" || echo "Link: FAIL (non-fatal)"

0 commit comments

Comments
 (0)