main.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. - uses: ilammy/msvc-dev-cmd@v1
  9. - name: Compile
  10. shell: bash
  11. run: |
  12. python3 build.py windows
  13. python3 build.py windows -lib
  14. mkdir -p output/windows/x86_64
  15. cp pocketpy.exe output/windows/x86_64
  16. cp pocketpy.dll output/windows/x86_64
  17. - uses: actions/upload-artifact@v3
  18. with:
  19. path: output
  20. - name: Unit Test
  21. run: python3 scripts/run_tests.py
  22. - name: Benchmark
  23. run: python3 scripts/run_tests.py benchmark
  24. build_linux:
  25. runs-on: ubuntu-latest
  26. steps:
  27. - uses: actions/checkout@v3
  28. - name: Setup Clang
  29. uses: egor-tensin/setup-clang@v1
  30. with:
  31. version: 15
  32. platform: x64
  33. - name: Install libc++
  34. run: sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev
  35. # - name: Coverage Test
  36. # run: |
  37. # python3 preprocess.py
  38. # bash run_tests.sh
  39. # - uses: actions/upload-artifact@v3
  40. # with:
  41. # name: coverage
  42. # path: .coverage
  43. - name: Compile
  44. run: |
  45. python3 build.py linux
  46. python3 build.py linux -lib
  47. mkdir -p output/linux/x86_64
  48. cp pocketpy output/linux/x86_64
  49. cp pocketpy.so output/linux/x86_64
  50. - uses: actions/upload-artifact@v3
  51. with:
  52. path: output
  53. - name: Unit Test
  54. run: python3 scripts/run_tests.py
  55. - name: Benchmark
  56. run: python3 scripts/run_tests.py benchmark
  57. build_macos:
  58. runs-on: macos-latest
  59. steps:
  60. - uses: actions/checkout@v3
  61. - run: |
  62. python3 amalgamate.py
  63. cd plugins/macos/pocketpy
  64. mkdir -p output/macos
  65. xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  66. cp -r build/Release/pocketpy.bundle output/macos
  67. - uses: actions/upload-artifact@v3
  68. with:
  69. path: plugins/macos/pocketpy/output
  70. build_android:
  71. runs-on: ubuntu-latest
  72. steps:
  73. - uses: actions/checkout@v3
  74. - uses: subosito/flutter-action@v2
  75. with:
  76. flutter-version: '3.3.0'
  77. channel: 'stable'
  78. cache: true
  79. - run: flutter --version
  80. - name: Compile
  81. run: |
  82. python3 amalgamate.py
  83. cd plugins/flutter/example
  84. flutter build apk --split-debug-info=.debug-info --split-per-abi
  85. cd build/app/outputs/flutter-apk
  86. mkdir -p output/android/arm64-v8a
  87. mkdir -p output/android/armeabi-v7a
  88. mkdir -p output/android/x86_64
  89. unzip -q app-arm64-v8a-release.apk -d tmp
  90. mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
  91. rm -rf tmp
  92. unzip -q app-armeabi-v7a-release.apk -d tmp
  93. mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
  94. rm -rf tmp
  95. unzip -q app-x86_64-release.apk -d tmp
  96. mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
  97. rm -rf tmp
  98. - uses: actions/upload-artifact@v3
  99. with:
  100. path: plugins/flutter/example/build/app/outputs/flutter-apk/output
  101. build_web:
  102. runs-on: ubuntu-latest
  103. steps:
  104. - uses: actions/checkout@v3
  105. - name: Setup emsdk
  106. uses: mymindstorm/setup-emsdk@v12
  107. with:
  108. version: 3.1.25
  109. actions-cache-folder: 'emsdk-cache'
  110. - name: Verify emsdk
  111. run: emcc -v
  112. - name: Compile
  113. run: |
  114. mkdir -p output/web/lib
  115. python3 build.py web
  116. cp web/lib/* output/web/lib
  117. - uses: crazy-max/ghaction-github-pages@v3
  118. with:
  119. target_branch: gh-pages
  120. build_dir: web
  121. env:
  122. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  123. if: github.event_name == 'push' && github.ref == 'refs/heads/main'
  124. - uses: actions/upload-artifact@v3
  125. with:
  126. path: output