main.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. mkdir -p output/windows/x86_64
  13. mkdir build
  14. cd build
  15. cmake ..
  16. cmake --build . --config Release
  17. cp Release/main.exe ../output/windows/x86_64
  18. cp Release/pocketpy.dll ../output/windows/x86_64
  19. cp Release/main.exe ../
  20. cp Release/pocketpy.dll ../
  21. - uses: actions/upload-artifact@v3
  22. with:
  23. path: output
  24. - name: Unit Test
  25. run: python3 scripts/run_tests.py
  26. - name: Benchmark
  27. run: python3 scripts/run_tests.py benchmark
  28. build_linux:
  29. runs-on: ubuntu-20.04
  30. steps:
  31. - uses: actions/checkout@v3
  32. - name: Setup Clang
  33. uses: egor-tensin/setup-clang@v1
  34. with:
  35. version: 15
  36. platform: x64
  37. - name: Install libc++
  38. run: sudo apt-get install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev
  39. - name: Unit Test with Coverage
  40. run: bash run_tests.sh
  41. - name: Upload coverage reports to Codecov
  42. uses: codecov/codecov-action@v3
  43. with:
  44. token: ${{ secrets.CODECOV_TOKEN }}
  45. directory: .coverage
  46. if: github.ref == 'refs/heads/main'
  47. - name: Compile
  48. run: |
  49. export CXX=clang++
  50. export CC=clang
  51. mkdir -p output/linux/x86_64
  52. mkdir build
  53. cd build
  54. cmake ..
  55. cmake --build . --config Release
  56. cp main ../output/linux/x86_64
  57. cp libpocketpy.so ../output/linux/x86_64
  58. cp main ../
  59. cp libpocketpy.so ../
  60. - uses: actions/upload-artifact@v3
  61. with:
  62. path: output
  63. - name: Benchmark
  64. run: python3 scripts/run_tests.py benchmark
  65. - name: C Binding Test
  66. run: bash run_c_binding_test.sh
  67. build_macos:
  68. runs-on: macos-latest
  69. steps:
  70. - uses: actions/checkout@v3
  71. - name: Compile and Test
  72. run: |
  73. bash build.sh
  74. python3 scripts/run_tests.py
  75. - run: |
  76. python3 amalgamate.py
  77. cd plugins/macos/pocketpy
  78. mkdir -p output/macos
  79. xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  80. cp -r build/Release/pocketpy.bundle output/macos
  81. - uses: actions/upload-artifact@v3
  82. with:
  83. path: plugins/macos/pocketpy/output
  84. build_android:
  85. runs-on: ubuntu-latest
  86. steps:
  87. - uses: actions/checkout@v3
  88. - uses: subosito/flutter-action@v2
  89. with:
  90. flutter-version: '3.3.0'
  91. channel: 'stable'
  92. cache: true
  93. - run: flutter --version
  94. - name: Compile
  95. run: |
  96. python3 amalgamate.py
  97. cd plugins/flutter/example
  98. flutter build apk --split-debug-info=.debug-info --split-per-abi
  99. cd build/app/outputs/flutter-apk
  100. mkdir -p output/android/arm64-v8a
  101. mkdir -p output/android/armeabi-v7a
  102. mkdir -p output/android/x86_64
  103. unzip -q app-arm64-v8a-release.apk -d tmp
  104. mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
  105. rm -rf tmp
  106. unzip -q app-armeabi-v7a-release.apk -d tmp
  107. mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
  108. rm -rf tmp
  109. unzip -q app-x86_64-release.apk -d tmp
  110. mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
  111. rm -rf tmp
  112. - uses: actions/upload-artifact@v3
  113. with:
  114. path: plugins/flutter/example/build/app/outputs/flutter-apk/output