-
Notifications
You must be signed in to change notification settings - Fork 40
803 lines (714 loc) · 28.6 KB
/
build.yml
File metadata and controls
803 lines (714 loc) · 28.6 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-mac-intel:
runs-on: macos-15-intel
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11', 'pypy-3.10' ]
raylib-platform: ['Desktop', 'SDL']
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
tar xvfz release-2.32.8.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.32.8 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
# Runs a set of commands using the runners shell
- name: Build raylib without SDL because SDL version has incorrect pkg-config
run: |
cd raylib-c
mkdir build
cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Build raylib with SDL if selected
run: |
cd raylib-c
mkdir build2
cd build2
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
python -m pip install --upgrade pip
pip3 install --upgrade cffi
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
python -m pip install --upgrade build
python -m build --wheel
- name: Rename wheels from universal2 to x86_64
run: |
# Rename universal2 wheels to x86_64 since they aren't truly universal
for wheel in dist/*universal2.whl; do
if [ -f "$wheel" ]; then
new_wheel=$(echo "$wheel" | sed 's/universal2/x86_64/')
echo "Renaming: $(basename "$wheel") -> $(basename "$new_wheel")"
mv "$wheel" "$new_wheel"
fi
done
shell: bash
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-mac-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
build-mac-arm64:
runs-on: macos-14
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14']
raylib-platform: ['Desktop', 'SDL']
env:
MACOSX_DEPLOYMENT_TARGET: '11'
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
tar xvfz release-2.32.8.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.32.8 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: arm64
# Runs a set of commands using the runners shell
- name: Build raylib without SDL because SDL version has incorrect pkg-config
run: |
cd raylib-c
mkdir build
cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Build raylib with SDL if selected
run: |
cd raylib-c
mkdir build2
cd build2
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
python -m pip install --upgrade pip
pip3 install --upgrade cffi
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
python -m pip install --upgrade build
python -m build --wheel
- name: Test
run: |
pip3 install dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Rename wheels from universal2 to arm64
run: |
# Rename universal2 wheels to arm64 since they aren't truly universal
for wheel in dist/*universal2.whl; do
if [ -f "$wheel" ]; then
new_wheel=$(echo "$wheel" | sed 's/universal2/arm64/')
echo "Renaming: $(basename "$wheel") -> $(basename "$new_wheel")"
mv "$wheel" "$new_wheel"
fi
done
shell: bash
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-mac-arm64-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
build-linux:
runs-on: ubuntu-latest
container:
image: electronstudio/ubuntu16-modern:latest
options: --user root
volumes:
# override /__e/node20 because GitHub Actions uses a version that requires too-recent glibc
- /tmp:/__e/node20
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'python3.12', 'python3.13', 'python3.14', 'pypy3.11']
raylib-platform: ['Desktop', 'SDL', 'DRM']
steps:
- name: fix node
run: |
ln -s /usr/local/bin /__e/node20/bin
- uses: actions/checkout@v2
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
# Runs a set of commands using the runners shell
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND ..
make -j2
make install
- name: Copy extras
run: |
cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
cp physac/src/physac.h /usr/local/include/
cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
run: |
${{ matrix.python-version }} -m pip install --upgrade pip
${{ matrix.python-version }} -m pip install --upgrade cffi
${{ matrix.python-version }} -m pip install --upgrade wheel
${{ matrix.python-version }} -m pip install --upgrade setuptools
${{ matrix.python-version }} -m pip install --upgrade build
${{ matrix.python-version }} -m build --wheel
python3.13 -m pip install --upgrade auditwheel
python3.13 -m pip install --upgrade patchelf
python3.13 -m auditwheel repair dist/*.whl
shell: bash
- name: Rename wheel for testing
run: |
# Rename wheelhouse wheels to be maximally compatible for testing
for wheel in wheelhouse/raylib*.whl; do
if [ -f "$wheel" ]; then
basename=$(basename "$wheel")
# Extract package and version using regex
if [[ $basename =~ ^([^-]+)-([^-]+.*)-[^-]+-[^-]+-[^-]+\.whl$ ]]; then
package="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
new_name="${package}-${version}-py3-none-linux_x86_64.whl"
echo "Renaming: $basename -> $new_name"
cp "$wheel" "wheelhouse/$new_name"
fi
fi
done
shell: bash
- name: Test
run: |
${{ matrix.python-version }} -m pip install --no-deps wheelhouse/*-py3-none-linux_x86_64.whl
# Clean up test wheels
rm -f wheelhouse/*-py3-none-linux_x86_64.whl
cd /
${{ matrix.python-version }} -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-linux-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: wheelhouse/*
build-linux32:
runs-on: ubuntu-latest
container:
image: electronstudio/ubuntu16-modern:i386
options: --user root --platform=linux/386
volumes:
# override /__e/node20 because GitHub Actions uses a version that requires too-recent glibc
- /tmp:/__e/node20
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'python3.12', 'python3.13', 'python3.14']
raylib-platform: ['Desktop', 'SDL', 'DRM']
steps:
- name: fix node
run: |
ln -s /usr/local/bin /__e/node20/bin
- uses: actions/checkout@v2
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
# Runs a set of commands using the runners shell
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
setarch i386 cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release -DOpenGL_GL_PREFERENCE=GLVND ..
make -j2
make install
- name: Copy extras
run: |
cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
cp physac/src/physac.h /usr/local/include/
cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
run: |
${{ matrix.python-version }} -m pip install --upgrade pip
${{ matrix.python-version }} -m pip install --upgrade cffi
${{ matrix.python-version }} -m pip install --upgrade wheel
${{ matrix.python-version }} -m pip install --upgrade setuptools
${{ matrix.python-version }} -m pip install --upgrade build
setarch i386 ${{ matrix.python-version }} -m build --wheel
python3.13 -m pip install --upgrade auditwheel
python3.13 -m pip install --upgrade patchelf
python3.13 -m auditwheel repair dist/*.whl
shell: bash
- name: Rename wheel for testing
run: |
# Rename wheelhouse wheels to be maximally compatible for testing
for wheel in wheelhouse/raylib*.whl; do
if [ -f "$wheel" ]; then
basename=$(basename "$wheel")
# Extract package and version using regex
if [[ $basename =~ ^([^-]+)-([^-]+.*)-[^-]+-[^-]+-[^-]+\.whl$ ]]; then
package="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
new_name="${package}-${version}-py3-none-linux_i686.whl"
echo "Renaming: $basename -> $new_name"
cp "$wheel" "wheelhouse/$new_name"
fi
fi
done
shell: bash
- name: Test
run: |
${{ matrix.python-version }} -m pip install --no-deps wheelhouse/*-py3-none-linux_*.whl
# Clean up test wheels
rm -f wheelhouse/*-py3-none-linux_i*.whl
cd /
${{ matrix.python-version }} -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-linux32-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: wheelhouse/*
build-linux-arm64:
runs-on: ubuntu-22.04-arm
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14']
raylib-platform: [ 'Desktop', 'SDL', 'DRM' ]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
- name: install libs
run: |
sudo apt update
sudo apt -y install cmake libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev libgbm-dev libdrm-dev
- name: Build SDL
run: |
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
tar xvfz release-2.32.8.tar.gz
mkdir build
cd build
cmake ../SDL-release-2.32.8 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
sudo cmake --install .
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
- name: Build raylib with SDL if selected
run: |
cd raylib-c
mkdir build2
cd build2
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade cffi
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade build
python3 -m build --wheel
python3 -m pip install --upgrade auditwheel
python3 -m pip install --upgrade patchelf
python3 -m auditwheel repair dist/*.whl
shell: bash
- name: Rename wheel for testing
run: |
# Rename wheelhouse wheels to be maximally compatible for testing
for wheel in wheelhouse/raylib*.whl; do
if [ -f "$wheel" ]; then
basename=$(basename "$wheel")
# Extract package and version using regex
if [[ $basename =~ ^([^-]+)-([^-]+.*)-[^-]+-[^-]+-[^-]+\.whl$ ]]; then
package="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
new_name="${package}-${version}-py3-none-linux_aarch64.whl"
echo "Renaming: $basename -> $new_name"
cp "$wheel" "wheelhouse/$new_name"
fi
fi
done
shell: bash
- name: Test
run: |
python3 -m pip install --no-deps wheelhouse/*-py3-none-linux_aarch64.whl
# Clean up test wheels
rm -f wheelhouse/*-py3-none-linux_aarch64.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-linux-arm64-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: wheelhouse/*
build-windows:
# The type of runner that the job will run on
runs-on: windows-2022
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11', 'pypy-3.10' ]
raylib-platform: ['Desktop', 'SDL']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download SDL2
run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-devel-2.30.8-VC.zip
- name: Create extraction directory
run: mkdir ${{ runner.temp }}\SDL2
- name: Unzip SDL2
run: tar -xf SDL2.zip -C ${{ runner.temp }}\SDL2 --strip-components=1
- name: Set SDL2_DIR environment variable
run: echo SDL2_DIR=${{ runner.temp }}\SDL2\cmake >> $env:GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
shell: cmd
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
shell: cmd
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.lib .
copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.dll raylib\
python -m pip install --upgrade pip
pip3 install --upgrade "cffi"
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
pip3 install --upgrade build
del raylib\dynamic\*.so* >nul 2>&1
del raylib\dynamic\*.dll >nul 2>&1
del raylib\dynamic\*.dylib >nul 2>&1
del raylib\dynamic\32bit\* >nul 2>&1
python -m build --wheel
shell: cmd
- name: Test
shell: bash
run: |
pip3 install --no-deps dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
build-windows32:
# The type of runner that the job will run on
runs-on: windows-2022
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14' ]
raylib-platform: [ 'Desktop', 'SDL' ]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download SDL2
run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.32.10/SDL2-devel-2.32.10-VC.zip
- name: Create extraction directory
run: mkdir ${{ runner.temp }}\SDL2
- name: Unzip SDL2
run: tar -xf SDL2.zip -C ${{ runner.temp }}\SDL2 --strip-components=1
- name: Set SDL2_DIR environment variable
run: echo SDL2_DIR=${{ runner.temp }}\SDL2\cmake >> $env:GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: ${{ matrix.python-version }}
# The target architecture (x86, x64) of the Python interpreter.
architecture: x86
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x86
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
shell: cmd
- name: Build raylib
run: |
cd raylib-c
mkdir build
cd build
cmake -A Win32 -DPLATFORM=${{ matrix.raylib-platform }} -DOPENGL_VERSION=2.1 -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
msbuild raylib.sln /target:raylib /property:Configuration=Release
copy raylib\Release\raylib.lib ..\..
cd ..\..
shell: cmd
- name: Build raylib-python-cffi
env:
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
run: |
copy ${{ runner.temp }}\SDL2\lib\x86\SDL2.lib .
copy ${{ runner.temp }}\SDL2\lib\x86\SDL2.dll raylib\
python -m pip install --upgrade pip
pip3 install --upgrade "cffi"
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
pip3 install --upgrade build
del raylib\dynamic\*.so* >nul 2>&1
del raylib\dynamic\*.dll >nul 2>&1
del raylib\dynamic\*.dylib >nul 2>&1
del raylib\dynamic\32bit\* >nul 2>&1
python -m build --wheel
shell: cmd
- name: Test
shell: bash
run: |
pip3 install --no-deps dist/*.whl
cd /
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
cat /tmp/output
if grep -q "INFO: Initializing raylib" /tmp/output; then
echo "Passed"
exit 0
else
echo "Failed"
exit 1
fi
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-windows32-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
path: dist/*
source-distro:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12'
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Build raylib
run: |
sudo apt update
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev
cd raylib-c
mkdir build
cd build
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j2
sudo make install
- name: Copy extras
run: |
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
sudo cp physac/src/physac.h /usr/local/include/
sudo cp raygui/src/raygui.h /usr/local/include/
- name: Build raylib-python-cffi
run: |
python -m pip install --upgrade pip
pip3 install --upgrade cffi
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
python setup.py sdist
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-source
path: dist/*
dynamic-distro:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
- name: fix raygui bug
run: |
patch -p0 <raygui.h.diff
- name: Setup Python
uses: actions/setup-python@v5
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: '3.12'
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64
- name: Build raylib-python-cffi-dynamic
run: |
python -m pip install --upgrade pip
pip3 install --upgrade cffi
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
cd dynamic
python setup.py sdist
- name: Upload build Artifact wheel
uses: actions/upload-artifact@v4
with:
name: wheel-dynamic
path: dynamic/dist/*
merge:
needs: [build-mac-intel, build-mac-arm64, build-windows, build-linux, build-linux-arm64, build-linux32, build-windows32, source-distro, dynamic-distro]
runs-on: ubuntu-latest
steps:
- name: Merge All Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: wheel
pattern: wheel-*