main.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. name: build
  2. on: [push, pull_request]
  3. jobs:
  4. build_win:
  5. runs-on: windows-latest
  6. steps:
  7. - uses: actions/checkout@v3
  8. - name: Set up Clang
  9. uses: egor-tensin/setup-clang@v1
  10. with:
  11. version: 15
  12. platform: x64
  13. - name: Compiling
  14. shell: bash
  15. run: |
  16. clang-cl.exe -std:c++17 -GR- -EHsc -O2 -Wno-deprecated-declarations -Fe:pocketpy src/main.cpp
  17. echo '#include "pocketpy.h"' > src/tmp.cpp
  18. clang-cl.exe -std:c++17 -GR- -EHsc -O2 -Wno-deprecated-declarations -LD -Fe:pocketpy src/tmp.cpp
  19. python3 scripts/run_tests.py
  20. python3 scripts/run_tests.py benchmark
  21. mkdir -p output/windows/x86_64
  22. mv pocketpy.exe output/windows/x86_64
  23. mv pocketpy.dll output/windows/x86_64
  24. - uses: actions/upload-artifact@v3
  25. with:
  26. path: output
  27. build_web:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - uses: actions/checkout@v3
  31. - name: Setup emsdk
  32. uses: mymindstorm/setup-emsdk@v11
  33. with:
  34. version: 3.1.25
  35. actions-cache-folder: 'emsdk-cache'
  36. - name: Verify emsdk
  37. run: emcc -v
  38. - name: Compiling
  39. run: |
  40. mkdir -p output/web/lib
  41. bash build_wasm.sh
  42. cp web/lib/* output/web/lib
  43. - uses: crazy-max/ghaction-github-pages@v3
  44. with:
  45. target_branch: gh-pages
  46. build_dir: web
  47. env:
  48. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  49. if: github.event_name == 'push'
  50. - uses: actions/upload-artifact@v3
  51. with:
  52. path: output
  53. build_linux:
  54. runs-on: ubuntu-latest
  55. steps:
  56. - uses: actions/checkout@v3
  57. - name: Set up Clang
  58. uses: egor-tensin/setup-clang@v1
  59. with:
  60. version: 15
  61. platform: x64
  62. - name: Compiling
  63. run: |
  64. sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15
  65. bash build_cpp.sh
  66. bash build_linux.sh
  67. python3 scripts/run_tests.py
  68. python3 scripts/run_tests.py benchmark
  69. mkdir -p output/linux/x86_64
  70. mv pocketpy output/linux/x86_64
  71. mv pocketpy.so output/linux/x86_64
  72. - uses: actions/upload-artifact@v3
  73. with:
  74. path: output
  75. build_android:
  76. runs-on: ubuntu-latest
  77. steps:
  78. - uses: actions/checkout@v3
  79. - uses: subosito/flutter-action@v2
  80. with:
  81. flutter-version: '3.3.0'
  82. channel: 'stable'
  83. - run: flutter --version
  84. - name: Compiling
  85. run: |
  86. python3 amalgamate.py
  87. cd plugins/flutter/example
  88. flutter build apk --split-debug-info=.debug-info --split-per-abi
  89. cd build/app/outputs/flutter-apk
  90. mkdir -p output/android/arm64-v8a
  91. mkdir -p output/android/armeabi-v7a
  92. mkdir -p output/android/x86_64
  93. unzip -q app-arm64-v8a-release.apk -d tmp
  94. mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
  95. rm -rf tmp
  96. unzip -q app-armeabi-v7a-release.apk -d tmp
  97. mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
  98. rm -rf tmp
  99. unzip -q app-x86_64-release.apk -d tmp
  100. mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
  101. rm -rf tmp
  102. - uses: actions/upload-artifact@v3
  103. with:
  104. path: plugins/flutter/example/build/app/outputs/flutter-apk/output
  105. build_macos:
  106. runs-on: macos-latest
  107. steps:
  108. - uses: actions/checkout@v3
  109. - run: |
  110. python3 amalgamate.py
  111. cd plugins/macos/pocketpy
  112. mkdir -p output/macos
  113. xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  114. cp -r build/Release/pocketpy.bundle output/macos
  115. - uses: actions/upload-artifact@v3
  116. with:
  117. path: plugins/macos/pocketpy/output