main.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. name: build
  2. on:
  3. push:
  4. branches: [ main ]
  5. paths-ignore:
  6. - 'docs/**'
  7. - 'web/**'
  8. - '**.md'
  9. pull_request:
  10. branches: [ main ]
  11. paths-ignore:
  12. - 'docs/**'
  13. - 'web/**'
  14. - '**.md'
  15. jobs:
  16. build_win32_amalgamated:
  17. runs-on: windows-latest
  18. steps:
  19. - uses: actions/checkout@v4
  20. - uses: ilammy/msvc-dev-cmd@v1
  21. - name: Compile
  22. shell: powershell
  23. run: |
  24. python amalgamate.py
  25. cd amalgamated
  26. cl.exe /std:c++17 /EHsc /utf-8 /O2 /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe
  27. - uses: actions/upload-artifact@v3
  28. with:
  29. path: amalgamated/pkpy.exe
  30. build_win32:
  31. runs-on: windows-latest
  32. steps:
  33. - uses: actions/checkout@v4
  34. - uses: ilammy/msvc-dev-cmd@v1
  35. - name: Compile
  36. shell: bash
  37. run: |
  38. mkdir -p output/windows/x86_64
  39. python cmake_build.py
  40. cp main.exe output/windows/x86_64
  41. cp pocketpy.dll output/windows/x86_64
  42. - uses: actions/upload-artifact@v3
  43. with:
  44. path: output
  45. - name: Unit Test
  46. run: python scripts/run_tests.py
  47. - name: Benchmark
  48. run: python scripts/run_tests.py benchmark
  49. build_linux:
  50. runs-on: ubuntu-20.04
  51. steps:
  52. - uses: actions/checkout@v4
  53. - name: Setup Clang
  54. uses: egor-tensin/setup-clang@v1
  55. with:
  56. version: 15
  57. platform: x64
  58. - name: Install libc++
  59. run: sudo apt-get install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev
  60. - name: Unit Test with Coverage
  61. run: bash run_tests.sh
  62. - name: Upload coverage reports to Codecov
  63. uses: codecov/codecov-action@v4
  64. with:
  65. token: ${{ secrets.CODECOV_TOKEN }}
  66. directory: .coverage
  67. if: github.ref == 'refs/heads/main'
  68. - name: Compile
  69. run: |
  70. mkdir -p output/linux/x86_64
  71. python cmake_build.py
  72. cp main output/linux/x86_64
  73. cp libpocketpy.so output/linux/x86_64
  74. env:
  75. CXX: clang++
  76. CC: clang
  77. - uses: actions/upload-artifact@v3
  78. with:
  79. path: output
  80. - name: Benchmark
  81. run: python scripts/run_tests.py benchmark
  82. - name: C Binding Test
  83. run: bash run_c_binding_test.sh
  84. build_linux_x86:
  85. runs-on: ubuntu-latest
  86. steps:
  87. - uses: actions/checkout@v4
  88. - name: Setup Alpine Linux for aarch64
  89. uses: jirutka/setup-alpine@v1
  90. with:
  91. arch: x86
  92. packages: gcc g++ make cmake libc-dev linux-headers python3
  93. - name: Build and Test
  94. run: |
  95. uname -m
  96. python cmake_build.py
  97. python scripts/run_tests.py
  98. python scripts/run_tests.py benchmark
  99. shell: alpine.sh --root {0}
  100. build_darwin:
  101. runs-on: macos-latest
  102. steps:
  103. - uses: actions/checkout@v4
  104. - name: Compile and Test
  105. run: |
  106. python cmake_build.py
  107. python scripts/run_tests.py
  108. - name: Benchmark
  109. run: python scripts/run_tests.py benchmark
  110. - run: |
  111. python amalgamate.py
  112. cd plugins/macos/pocketpy
  113. mkdir -p output/macos
  114. xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  115. cp -r build/Release/pocketpy.bundle output/macos
  116. - uses: actions/upload-artifact@v3
  117. with:
  118. path: plugins/macos/pocketpy/output
  119. build_android:
  120. runs-on: ubuntu-latest
  121. steps:
  122. - uses: actions/checkout@v4
  123. - uses: nttld/setup-ndk@v1
  124. id: setup-ndk
  125. with:
  126. ndk-version: r23
  127. local-cache: false
  128. add-to-path: false
  129. - name: Compile Shared Library
  130. run: |
  131. bash build_android.sh arm64-v8a
  132. bash build_android.sh armeabi-v7a
  133. bash build_android.sh x86_64
  134. mkdir -p output/android/arm64-v8a
  135. mkdir -p output/android/armeabi-v7a
  136. mkdir -p output/android/x86_64
  137. cp build/android/arm64-v8a/libpocketpy.so output/android/arm64-v8a
  138. cp build/android/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a
  139. cp build/android/x86_64/libpocketpy.so output/android/x86_64
  140. env:
  141. ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
  142. - uses: actions/upload-artifact@v3
  143. with:
  144. path: output
  145. build_ios:
  146. runs-on: macos-latest
  147. steps:
  148. - uses: actions/checkout@v4
  149. - name: Compile Frameworks
  150. run: |
  151. git clone https://github.com/leetal/ios-cmake --depth 1 ~/ios-cmake
  152. bash build_ios.sh
  153. mkdir -p output/ios
  154. cp -r build/pocketpy.xcframework output/ios/pocketpy.xcframework
  155. - uses: actions/upload-artifact@v3
  156. with:
  157. path: output