Skip to content

Commit 9a149ac

Browse files
committed
updates
1 parent d431a5d commit 9a149ac

File tree

2 files changed

+229
-2
lines changed

2 files changed

+229
-2
lines changed

.github/scripts/patch_pubspec.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# /// script
2+
# dependencies = ["pyyaml"]
3+
# ///
4+
15
import os
26
import pathlib
37
import sys
@@ -22,7 +26,7 @@
2226
"serious_python_macos",
2327
]
2428

25-
with open(pubspec_path, "r") as f:
29+
with open(pubspec_path) as f:
2630
data = yaml.safe_load(f)
2731

2832
# patch version

.github/workflows/ci.yml

Lines changed: 224 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,228 @@ permissions:
1515
env:
1616
ROOT: "${{ github.workspace }}"
1717
SCRIPTS: "${{ github.workspace }}/.github/scripts"
18+
SERIOUS_PYTHON_SITE_PACKAGES: "${{ github.workspace }}/site-packages"
1819
UV_PYTHON: "3.12"
19-
PYODIDE_VERSION: "0.27.7"
20+
21+
jobs:
22+
macos:
23+
name: Test on macOS
24+
runs-on: macos-14
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Flutter
30+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
31+
with:
32+
path: '.fvmrc'
33+
cache: true
34+
35+
- name: Run tests
36+
shell: bash
37+
run: |
38+
export SERIOUS_PYTHON_SITE_PACKAGES=$GITHUB_WORKSPACE/site-packages
39+
cd src/serious_python/example/flet_example
40+
dart run serious_python:main package app/src -p Darwin -r flet -r --pre
41+
flutter test integration_test -d macos
42+
43+
ios:
44+
name: Test on iOS
45+
runs-on: macos-14
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Flutter
51+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
52+
with:
53+
path: '.fvmrc'
54+
cache: true
55+
56+
- name: Build iOS (no codesign)
57+
shell: bash
58+
run: |
59+
export SERIOUS_PYTHON_SITE_PACKAGES=$GITHUB_WORKSPACE/site-packages
60+
cd src/serious_python/example/flet_example
61+
dart run serious_python:main package app/src -p iOS -r flet -r --pre
62+
flutter build ios --no-codesign
63+
# add simulator drive steps later if needed
64+
65+
android:
66+
name: Test on Android
67+
runs-on: ubuntu-22.04
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
72+
- name: Setup Flutter
73+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
74+
with:
75+
path: '.fvmrc'
76+
cache: true
77+
78+
- name: Accept SDK licenses
79+
shell: bash
80+
run: |
81+
sudo apt-get update
82+
sudo apt-get install -y unzip
83+
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --licenses || true
84+
- name: Prepare Android emulator + Flutter
85+
shell: bash
86+
env:
87+
API_LEVEL: "33"
88+
TARGET: "google_atd"
89+
ARCH: "x86_64"
90+
DEVICE_NAME: "android_emulator"
91+
DEVICE_TYPE: "pixel_5"
92+
run: |
93+
export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH
94+
sdkmanager "platform-tools" "platforms;android-${API_LEVEL}"
95+
sdkmanager --install "system-images;android-${API_LEVEL};${TARGET};${ARCH}"
96+
sdkmanager --update
97+
echo "no" | avdmanager -v create avd --force --name "${DEVICE_NAME}" --package "system-images;android-${API_LEVEL};${TARGET};${ARCH}" --tag "${TARGET}" --sdcard 128M --device "${DEVICE_TYPE}"
98+
${ANDROID_HOME}/emulator/emulator -avd "${DEVICE_NAME}" -memory 2048 -wipe-data -no-boot-anim -noaudio -no-window -accel off -partition-size 8192 &
99+
adb wait-for-device shell 'while [[ -z $(getprop dev.bootcomplete) ]]; do sleep 1; done;'
100+
101+
- name: Run tests
102+
shell: bash
103+
run: |
104+
cd src/serious_python/example/flet_example
105+
dart run serious_python:main package app/src -p Android -r flet -r --pre
106+
flutter test integration_test -d emulator-5554
107+
108+
windows:
109+
name: Test on Windows
110+
runs-on: windows-latest
111+
steps:
112+
- name: Checkout repository
113+
uses: actions/checkout@v4
114+
115+
- name: Setup Flutter
116+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
117+
with:
118+
path: '.fvmrc'
119+
cache: true
120+
121+
- name: Run tests
122+
shell: pwsh
123+
run: |
124+
cd src/serious_python/example/flet_example
125+
dart run serious_python:main package app/src -p Windows -r flet -r --pre
126+
flutter test integration_test -d windows
127+
128+
linux:
129+
name: Test on Linux
130+
runs-on: ubuntu-22.04
131+
steps:
132+
- name: Checkout repository
133+
uses: actions/checkout@v4
134+
135+
- name: Setup Flutter
136+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
137+
with:
138+
path: '.fvmrc'
139+
cache: true
140+
141+
- name: Install desktop deps
142+
run: |
143+
sudo apt-get update --allow-releaseinfo-change
144+
sudo apt-get install -y xvfb libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
145+
146+
- name: Run tests
147+
shell: bash
148+
run: |
149+
cd src/serious_python/example/flet_example
150+
dart run serious_python:main package app/src -p Linux -r flet -r --pre
151+
xvfb-run flutter test integration_test -d linux
152+
153+
linux-arm64:
154+
name: Test on Linux ARM64
155+
runs-on: ubuntu-22.04-arm64 # change if you use self-hosted ARM64
156+
steps:
157+
- name: Checkout repository
158+
uses: actions/checkout@v4
159+
160+
- name: Setup Flutter
161+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
162+
with:
163+
path: '.fvmrc'
164+
cache: true
165+
166+
- name: Install deps
167+
shell: bash
168+
run: |
169+
sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
170+
sudo apt-get update -y --allow-releaseinfo-change
171+
sudo apt-get install -y clang ninja-build xvfb libgtk-3-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
172+
173+
- name: Run tests
174+
shell: bash
175+
run: |
176+
cd src/serious_python/example/flet_example
177+
dart run serious_python:main package app/src -p Linux -r flet -r --pre
178+
xvfb-run flutter test integration_test -d linux
179+
180+
publish:
181+
name: Publish to pub.dev
182+
needs:
183+
- macos
184+
- ios
185+
- android
186+
- windows
187+
- linux
188+
- linux-arm64
189+
runs-on: ubuntu-22.04
190+
# if: startsWith(github.ref, 'refs/tags/v')
191+
steps:
192+
193+
- name: Checkout repository
194+
uses: actions/checkout@v4
195+
with:
196+
fetch-depth: 0
197+
198+
- name: Setup Flutter
199+
uses: kuhnroyal/flutter-fvm-config-action/setup@v3
200+
with:
201+
path: '.fvmrc'
202+
cache: true
203+
204+
- name: Compute PKG_VER
205+
id: ver
206+
shell: bash
207+
run: |
208+
PKG_VER="${GITHUB_REF_NAME#v}"
209+
echo "PKG_VER=$PKG_VER" | tee -a "$GITHUB_ENV"
210+
sudo apt-get update
211+
212+
- name: Configure pub.dev credentials
213+
# if: ${{ secrets.PUB_DEV_TOKEN != '' }}
214+
env:
215+
PUB_DEV_TOKEN: ${{ secrets.PUB_DEV_TOKEN }}
216+
run: |
217+
mkdir -p $HOME/.config/dart
218+
echo "$PUB_DEV_TOKEN" | base64 --decode > $HOME/.config/dart/pub-credentials.json
219+
220+
- name: Patch pubspec versions
221+
run: |
222+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python_platform_interface/pubspec.yaml" "$PKG_VER"
223+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python/pubspec.yaml" "$PKG_VER"
224+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python_android/pubspec.yaml" "$PKG_VER"
225+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python_darwin/pubspec.yaml" "$PKG_VER"
226+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python_windows/pubspec.yaml" "$PKG_VER"
227+
uv run "$SCRIPTS/patch_pubspec.py" "src/serious_python_linux/pubspec.yaml" "$PKG_VER"
228+
229+
- name: Publish packages
230+
shell: bash
231+
if: false
232+
run: |
233+
publish_pkg () { pushd "$1" >/dev/null; dart pub publish --force; popd >/dev/null; }
234+
235+
publish_pkg src/serious_python_platform_interface
236+
sleep 600
237+
publish_pkg src/serious_python_android
238+
publish_pkg src/serious_python_darwin
239+
publish_pkg src/serious_python_windows
240+
publish_pkg src/serious_python_linux
241+
sleep 600
242+
publish_pkg src/serious_python

0 commit comments

Comments
 (0)