Skip to content

Commit c6b749f

Browse files
Merge pull request #55 from b5i/github-actions-final
Added GitHub actions for multiplatform PlatformIO builds
2 parents 73f477a + 0e4d6d7 commit c6b749f

File tree

3 files changed

+127
-5
lines changed

3 files changed

+127
-5
lines changed

.github/workflows/platformio.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: PlatformIO
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
espBuild:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/cache@v3
18+
with:
19+
path: |
20+
~/.cache/pip
21+
~/.platformio/.cache
22+
key: ${{ runner.os }}-pio
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.11'
26+
- name: Install PlatformIO Core
27+
run: pip install --upgrade platformio
28+
29+
- name: Build PlatformIO Project for Paxo ESP32
30+
run: pio run -e paxo-v5
31+
32+
linuxBuild:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cache/pip
41+
~/.platformio/.cache
42+
key: ${{ runner.os }}-pio
43+
- uses: actions/setup-python@v4
44+
with:
45+
python-version: '3.11'
46+
- name: Install PlatformIO Core
47+
run: pip install --upgrade platformio
48+
49+
- name: Install SDL2
50+
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev
51+
52+
- name: Build PlatformIO Project for Linux
53+
run: pio run -e linux
54+
55+
macOSBuild:
56+
runs-on: macos-latest
57+
58+
steps:
59+
- uses: actions/checkout@v3
60+
- uses: actions/cache@v3
61+
with:
62+
path: |
63+
~/.cache/pip
64+
~/.platformio/.cache
65+
key: ${{ runner.os }}-pio
66+
- uses: actions/setup-python@v4
67+
with:
68+
python-version: '3.11'
69+
- name: Install PlatformIO Core
70+
run: pip install --upgrade platformio
71+
72+
- name: Install SDL2
73+
run: brew install SDL2
74+
75+
- name: Build PlatformIO Project for macOS
76+
run: DYLD_LIBRARY_PATH="`brew --prefix sdl2`/lib" pio run -e macos
77+
windowsBuild:
78+
runs-on: windows-latest
79+
80+
steps:
81+
- uses: actions/checkout@v3
82+
- uses: actions/cache@v3
83+
with:
84+
path: |
85+
~/.cache/pip
86+
~/.platformio/.cache
87+
key: ${{ runner.os }}-pio
88+
- uses: actions/setup-python@v4
89+
with:
90+
python-version: '3.11'
91+
- name: Install PlatformIO Core
92+
run: pip install --upgrade platformio
93+
94+
- name: Build PlatformIO Project for Windows
95+
run: pio run -e windows-build-only

platformio.ini

+24
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ extra_scripts =
7878
scripts/platformio/windows/execute.py
7979
targets = execute
8080

81+
[env:windows-build-only]
82+
platform = native
83+
lib_deps =
84+
lovyan03/LovyanGFX@^1.1.9
85+
plerup/EspSoftwareSerial@^8.2.0
86+
maxgerhardt/ghostl@^1.0.1
87+
mbed-babylonica/[email protected]+sha.278f7f125495
88+
build_flags =
89+
-std=c++17
90+
-lm
91+
-Iextern/SDL2-2.28.5/x86_64-w64-mingw32/include/SDL2
92+
-Lextern/SDL2-2.28.5/x86_64-w64-mingw32/lib
93+
-lSDL2main
94+
-lSDL2
95+
-m64
96+
-Wa,-mbig-obj
97+
extra_scripts =
98+
pre:scripts/platformio/windows/setup_workspace.py
99+
pre:scripts/platformio/windows/copy_dependencies.py
100+
81101
[env:linux]
82102
platform = native
83103
lib_deps =
@@ -106,6 +126,10 @@ build_flags =
106126
-lm
107127
-lSDL2main
108128
-lSDL2
129+
-I/usr/local/include/SDL2 # we include both /usr/local/ and /opt/homebrew/ to support the macOS silicon and Intel as explained here https://stackoverflow.com/a/71186857/16456439
130+
-L/usr/local/lib
131+
-I/opt/homebrew/include/SDL2
132+
-L/opt/homebrew/lib
109133

110134
[env:test]
111135
platform = native

scripts/platformio/windows/setup_workspace.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
import zipfile
44
import shutil
55

6-
76
Import("env")
87

98

109
def SDL2_cleanup():
11-
if os.path.exists("temp"):
12-
if os.path.exists("temp\\SDL2.zip"):
13-
os.remove("temp\\SDL2.zip")
14-
os.remove("temp")
10+
try:
11+
if os.path.exists("temp"):
12+
if os.path.exists("temp\\SDL2.zip"):
13+
os.remove("temp\\SDL2.zip")
14+
os.remove("temp")
15+
except PermissionError:
16+
print("Could not delete temp directory or the SDL2.zip file. Please delete them manually.")
17+
1518

1619

1720
def SDL2_download():

0 commit comments

Comments
 (0)