Skip to content

Commit d431a5d

Browse files
committed
initial commit
1 parent adf895d commit d431a5d

File tree

4 files changed

+110
-0
lines changed

4 files changed

+110
-0
lines changed

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.27.4"
3+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import json
2+
import os
3+
import pathlib
4+
import sys
5+
import tarfile
6+
import urllib.request
7+
8+
if len(sys.argv) < 2:
9+
print("Specify artifact job name and artifact deployment name to download")
10+
sys.exit(1)
11+
12+
artifact_job_name = sys.argv[1]
13+
artifact_file_name = sys.argv[2].format(
14+
version=os.environ.get("APPVEYOR_BUILD_VERSION")
15+
)
16+
17+
build_jobs = {}
18+
19+
20+
def download_job_artifact(job_id, file_name, dest_file):
21+
url = f"https://ci.appveyor.com/api/buildjobs/{job_id}/artifacts/{file_name}"
22+
print(f"Downloading {url}...")
23+
urllib.request.urlretrieve(url, dest_file)
24+
25+
26+
def get_build_job_ids():
27+
account_name = os.environ.get("APPVEYOR_ACCOUNT_NAME")
28+
project_slug = os.environ.get("APPVEYOR_PROJECT_SLUG")
29+
build_id = os.environ.get("APPVEYOR_BUILD_ID")
30+
url = f"https://ci.appveyor.com/api/projects/{account_name}/{project_slug}/builds/{build_id}"
31+
print(f"Fetching build details at {url}")
32+
req = urllib.request.Request(url)
33+
req.add_header("Content-type", "application/json")
34+
project = json.loads(urllib.request.urlopen(req).read().decode())
35+
for job in project["build"]["jobs"]:
36+
build_jobs[job["name"]] = job["jobId"]
37+
38+
39+
current_dir = pathlib.Path(os.getcwd())
40+
print("current_dir", current_dir)
41+
42+
get_build_job_ids()
43+
44+
# create "web" directory
45+
dist_path = current_dir.joinpath("python_dist")
46+
dist_path.mkdir(exist_ok=True)
47+
tar_path = current_dir.joinpath(artifact_file_name)
48+
download_job_artifact(build_jobs[artifact_job_name], artifact_file_name, tar_path)
49+
with tarfile.open(tar_path, "r:gz") as tar:
50+
tar.extractall(str(dist_path))
51+
os.remove(tar_path)

.github/scripts/patch_pubspec.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import pathlib
3+
import sys
4+
5+
import yaml
6+
7+
if len(sys.argv) < 3:
8+
print("Specify pubspec.yaml file and version to patch")
9+
sys.exit(1)
10+
11+
current_dir = pathlib.Path(os.getcwd())
12+
pubspec_path = current_dir.joinpath(current_dir, sys.argv[1])
13+
ver = sys.argv[2]
14+
print(f"Patching pubspec.yaml file {pubspec_path} with {ver}")
15+
16+
dependencies = [
17+
"serious_python_platform_interface",
18+
"serious_python_android",
19+
"serious_python_darwin",
20+
"serious_python_windows",
21+
"serious_python_linux",
22+
"serious_python_macos",
23+
]
24+
25+
with open(pubspec_path, "r") as f:
26+
data = yaml.safe_load(f)
27+
28+
# patch version
29+
data["version"] = ver
30+
31+
# patch dependencies
32+
for dep in data["dependencies"]:
33+
if dep in dependencies:
34+
data["dependencies"][dep] = f"^{ver}"
35+
# print(dep)
36+
with open(pubspec_path, "w") as file:
37+
yaml.dump(data, file, sort_keys=False)

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '*'
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
15+
env:
16+
ROOT: "${{ github.workspace }}"
17+
SCRIPTS: "${{ github.workspace }}/.github/scripts"
18+
UV_PYTHON: "3.12"
19+
PYODIDE_VERSION: "0.27.7"

0 commit comments

Comments
 (0)