main.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_linux_x86:
  68. runs-on: ubuntu-latest
  69. steps:
  70. - name: Setup Alpine Linux v3.15 for aarch64
  71. uses: jirutka/setup-alpine@v1
  72. with:
  73. arch: x86
  74. packages: gcc g++ make cmake libc-dev linux-headers python3
  75. branch: v3.15
  76. - name: Build and Test
  77. run: |
  78. uname -m
  79. mkdir build
  80. cd build
  81. cmake ..
  82. cmake --build . --config Release
  83. cp main ../
  84. cp libpocketpy.so ../
  85. cd ..
  86. python3 scripts/run_tests.py
  87. python3 scripts/run_tests.py benchmark
  88. shell: alpine.sh {0}
  89. build_macos:
  90. runs-on: macos-latest
  91. steps:
  92. - uses: actions/checkout@v3
  93. - name: Compile and Test
  94. run: |
  95. bash build.sh
  96. python3 scripts/run_tests.py
  97. - name: Benchmark
  98. run: python3 scripts/run_tests.py benchmark
  99. - run: |
  100. python3 amalgamate.py
  101. cd plugins/macos/pocketpy
  102. mkdir -p output/macos
  103. xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  104. cp -r build/Release/pocketpy.bundle output/macos
  105. - uses: actions/upload-artifact@v3
  106. with:
  107. path: plugins/macos/pocketpy/output
  108. build_android:
  109. runs-on: ubuntu-latest
  110. steps:
  111. - uses: actions/checkout@v3
  112. - uses: subosito/flutter-action@v2
  113. with:
  114. flutter-version: '3.3.0'
  115. channel: 'stable'
  116. cache: true
  117. - run: flutter --version
  118. - name: Compile
  119. run: |
  120. python3 amalgamate.py
  121. cd plugins/flutter/example
  122. flutter build apk --split-debug-info=.debug-info --split-per-abi
  123. cd build/app/outputs/flutter-apk
  124. mkdir -p output/android/arm64-v8a
  125. mkdir -p output/android/armeabi-v7a
  126. mkdir -p output/android/x86_64
  127. unzip -q app-arm64-v8a-release.apk -d tmp
  128. mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
  129. rm -rf tmp
  130. unzip -q app-armeabi-v7a-release.apk -d tmp
  131. mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
  132. rm -rf tmp
  133. unzip -q app-x86_64-release.apk -d tmp
  134. mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
  135. rm -rf tmp
  136. - uses: actions/upload-artifact@v3
  137. with:
  138. path: plugins/flutter/example/build/app/outputs/flutter-apk/output