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