mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
d08ecbffd8
commit
13f691bc37
199
.github/workflows/main.yml
vendored
Normal file
199
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'web/**'
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'web/**'
|
||||||
|
- '**.md'
|
||||||
|
jobs:
|
||||||
|
# build_win32_amalgamated:
|
||||||
|
# runs-on: windows-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# - uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
# - name: Compile
|
||||||
|
# shell: powershell
|
||||||
|
# run: |
|
||||||
|
# python amalgamate.py
|
||||||
|
# cd amalgamated
|
||||||
|
# cl.exe /std:c++17 /EHsc /utf-8 /Ox /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe
|
||||||
|
build_win32:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
- name: Compile
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p output/x86_64
|
||||||
|
python cmake_build.py
|
||||||
|
cp main.exe output/x86_64
|
||||||
|
cp pocketpy.dll output/x86_64
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
path: output
|
||||||
|
- name: Unit Test
|
||||||
|
run: python scripts/run_tests.py
|
||||||
|
- name: Benchmark
|
||||||
|
run: python scripts/run_tests.py benchmark
|
||||||
|
build_linux:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Clang
|
||||||
|
uses: egor-tensin/setup-clang@v1
|
||||||
|
with:
|
||||||
|
version: 15
|
||||||
|
platform: x64
|
||||||
|
- name: Unit Test with Coverage
|
||||||
|
run: bash run_tests.sh
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
directory: .coverage
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
- name: Compile and Test
|
||||||
|
run: |
|
||||||
|
mkdir -p output/x86_64
|
||||||
|
python cmake_build.py
|
||||||
|
python scripts/run_tests.py
|
||||||
|
cp main output/x86_64
|
||||||
|
cp libpocketpy.so output/x86_64
|
||||||
|
env:
|
||||||
|
CC: clang
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux
|
||||||
|
path: output
|
||||||
|
- name: Benchmark
|
||||||
|
run: python scripts/run_tests.py benchmark
|
||||||
|
build_linux_x86:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Alpine Linux for aarch64
|
||||||
|
uses: jirutka/setup-alpine@v1
|
||||||
|
with:
|
||||||
|
arch: x86
|
||||||
|
packages: gcc make cmake libc-dev linux-headers python3
|
||||||
|
- name: Build and Test
|
||||||
|
run: |
|
||||||
|
uname -m
|
||||||
|
python cmake_build.py
|
||||||
|
python scripts/run_tests.py
|
||||||
|
python scripts/run_tests.py benchmark
|
||||||
|
shell: alpine.sh --root {0}
|
||||||
|
build_darwin:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Compile and Test
|
||||||
|
run: |
|
||||||
|
python cmake_build.py
|
||||||
|
python scripts/run_tests.py
|
||||||
|
- name: Benchmark
|
||||||
|
run: python scripts/run_tests.py benchmark
|
||||||
|
# - run: |
|
||||||
|
# python amalgamate.py
|
||||||
|
# cd plugins/macos/pocketpy
|
||||||
|
# mkdir output
|
||||||
|
# xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
|
||||||
|
# cp -r build/Release/pocketpy.bundle output
|
||||||
|
# - uses: actions/upload-artifact@v4
|
||||||
|
# with:
|
||||||
|
# name: macos
|
||||||
|
# path: plugins/macos/pocketpy/output
|
||||||
|
build_android:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r23
|
||||||
|
local-cache: false
|
||||||
|
add-to-path: false
|
||||||
|
- name: Compile Shared Library
|
||||||
|
run: |
|
||||||
|
bash build_android.sh arm64-v8a
|
||||||
|
bash build_android.sh armeabi-v7a
|
||||||
|
bash build_android.sh x86_64
|
||||||
|
|
||||||
|
mkdir -p output/arm64-v8a
|
||||||
|
mkdir -p output/armeabi-v7a
|
||||||
|
mkdir -p output/x86_64
|
||||||
|
|
||||||
|
cp build/android/arm64-v8a/libpocketpy.so output/arm64-v8a
|
||||||
|
cp build/android/armeabi-v7a/libpocketpy.so output/armeabi-v7a
|
||||||
|
cp build/android/x86_64/libpocketpy.so output/x86_64
|
||||||
|
env:
|
||||||
|
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: android
|
||||||
|
path: output
|
||||||
|
build_ios:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Compile Frameworks
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/leetal/ios-cmake --depth 1 ~/ios-cmake
|
||||||
|
bash build_ios.sh
|
||||||
|
mkdir -p output
|
||||||
|
cp -r build/pocketpy.xcframework output/pocketpy.xcframework
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ios
|
||||||
|
path: output
|
||||||
|
|
||||||
|
merge:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ build_win32, build_linux, build_darwin, build_android, build_ios ]
|
||||||
|
steps:
|
||||||
|
- name: "Create output directory"
|
||||||
|
run: "mkdir $GITHUB_WORKSPACE/output"
|
||||||
|
|
||||||
|
- name: "Merge win32"
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
path: $GITHUB_WORKSPACE/output/windows
|
||||||
|
|
||||||
|
- name: "Merge linux"
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: linux
|
||||||
|
path: $GITHUB_WORKSPACE/output/linux
|
||||||
|
|
||||||
|
# - name: "Merge darwin"
|
||||||
|
# uses: actions/download-artifact@v4.1.7
|
||||||
|
# with:
|
||||||
|
# name: macos
|
||||||
|
# path: $GITHUB_WORKSPACE/output/macos
|
||||||
|
|
||||||
|
- name: "Merge android"
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: android
|
||||||
|
path: $GITHUB_WORKSPACE/output/android
|
||||||
|
|
||||||
|
- name: "Merge ios"
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: ios
|
||||||
|
path: $GITHUB_WORKSPACE/output/ios
|
||||||
|
|
||||||
|
- name: "Upload merged artifact"
|
||||||
|
uses: actions/upload-artifact@v4.3.3
|
||||||
|
with:
|
||||||
|
name: all-in-one
|
||||||
|
path: $GITHUB_WORKSPACE/output
|
BIN
.github/workflows/main.zip
vendored
BIN
.github/workflows/main.zip
vendored
Binary file not shown.
@ -80,8 +80,8 @@ elseif(PK_BUILD_STATIC_LIB)
|
|||||||
else()
|
else()
|
||||||
set(PROJECT_EXE_NAME main)
|
set(PROJECT_EXE_NAME main)
|
||||||
add_executable(${PROJECT_EXE_NAME} src2/main.c)
|
add_executable(${PROJECT_EXE_NAME} src2/main.c)
|
||||||
# static linked main
|
# shared linked main
|
||||||
add_library(${PROJECT_NAME} STATIC ${POCKETPY_SRC})
|
add_library(${PROJECT_NAME} SHARED ${POCKETPY_SRC})
|
||||||
target_link_libraries(${PROJECT_EXE_NAME} ${PROJECT_NAME})
|
target_link_libraries(${PROJECT_EXE_NAME} ${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ assert code == 0
|
|||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
shutil.copy(f"{config}/main.exe", "../main.exe")
|
shutil.copy(f"{config}/main.exe", "../main.exe")
|
||||||
# shutil.copy(f"{config}/pocketpy.dll", "../pocketpy.dll")
|
shutil.copy(f"{config}/pocketpy.dll", "../pocketpy.dll")
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
shutil.copy("main", "../main")
|
shutil.copy("main", "../main")
|
||||||
# shutil.copy("libpocketpy.dylib", "../libpocketpy.dylib")
|
shutil.copy("libpocketpy.dylib", "../libpocketpy.dylib")
|
||||||
else:
|
else:
|
||||||
shutil.copy("main", "../main")
|
shutil.copy("main", "../main")
|
||||||
# shutil.copy("libpocketpy.so", "../libpocketpy.so")
|
# shutil.copy("libpocketpy.so", "../libpocketpy.so")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user