You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
12 KiB

  1. name: Build Test
  2. # Builds and tests storm on various platforms
  3. # also deploys images to Dockerhub
  4. on:
  5. schedule:
  6. # run daily
  7. - cron: '0 6 * * *'
  8. # needed to trigger the workflow manually
  9. workflow_dispatch:
  10. pull_request:
  11. env:
  12. CARL_BRANCH: "master14"
  13. CARL_GIT_URL: "https://github.com/smtrat/carl.git"
  14. STORM_GIT_URL: "${{ github.server_url }}/${{ github.repository }}.git"
  15. STORM_BRANCH: "${{ github.ref }}"
  16. # github runners currently have two cores
  17. NR_JOBS: "2"
  18. # cmake arguments
  19. CMAKE_DEBUG: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_SPOT_SHIPPED=ON"
  20. CMAKE_RELEASE: "-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DSTORM_PORTABLE=ON -DSTORM_USE_SPOT_SHIPPED=ON"
  21. CARL_CMAKE_DEBUG: "-DCMAKE_BUILD_TYPE=Debug -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON"
  22. CARL_CMAKE_RELEASE: "-DCMAKE_BUILD_TYPE=Release -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON"
  23. jobs:
  24. indepthTests:
  25. name: Indepth Tests (${{ matrix.cmakeArgs.name }})
  26. runs-on: ubuntu-latest
  27. env:
  28. DISTRO: "ubuntu-20.10"
  29. strategy:
  30. matrix:
  31. cmakeArgs:
  32. - {name: "GMP exact; GMP rational functions; Spot", args: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_CLN_EA=OFF -DSTORM_USE_CLN_RF=OFF -DSTORM_USE_SPOT_SHIPPED=ON"}
  33. # This is the standard config
  34. # - {name: "GMP exact; CLN rational functions; Spot", args: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_CLN_EA=OFF -DSTORM_USE_CLN_RF=ON -DSTORM_USE_SPOT_SHIPPED=ON"}
  35. - {name: "CLN exact; GMP rational functions; Spot", args: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_CLN_EA=ON -DSTORM_USE_CLN_RF=OFF -DSTORM_USE_SPOT_SHIPPED=ON"}
  36. - {name: "CLN exact; CLN rational functions; Spot", args: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_CLN_EA=ON -DSTORM_USE_CLN_RF=ON -DSTORM_USE_SPOT_SHIPPED=ON"}
  37. - {name: "GMP exact; CLN rational functions; No Spot", args: "-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DSTORM_USE_CLN_EA=ON -DSTORM_USE_CLN_RF=ON -DSTORM_USE_SPOT_SHIPPED=OFF"}
  38. steps:
  39. - name: Init Docker
  40. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${DISTRO}
  41. - name: Git clone
  42. # git clone cannot clone individual commits based on a sha and some other refs
  43. # this workaround fixes this and fetches only one commit
  44. run: |
  45. sudo docker exec storm bash -c "mkdir /opt/storm; cd /opt/storm; git init && git remote add origin ${STORM_GIT_URL} && git fetch --depth 1 origin ${STORM_BRANCH} && git checkout FETCH_HEAD"
  46. - name: Run cmake
  47. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${{ matrix.cmakeArgs.args }}"
  48. - name: Build storm
  49. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  50. - name: Run unit tests
  51. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  52. noDeploy:
  53. name: Build and Test
  54. runs-on: ubuntu-latest
  55. strategy:
  56. matrix:
  57. distro: ["ubuntu-18.04", "debian-10", "debian-9", "ubuntu-20.04"]
  58. debugOrRelease: ["release"]
  59. steps:
  60. - name: Setup cmake arguments
  61. # this is strangely the best way to implement environment variables based on the value of another
  62. # GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE}
  63. # then the env variable with name NAME will be created/updated with VALUE
  64. run: |
  65. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CMAKE_ARGS=${CMAKE_DEBUG}" || echo "CMAKE_ARGS=${CMAKE_RELEASE}") >> $GITHUB_ENV
  66. - name: Init Docker
  67. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${{ matrix.distro }}
  68. - name: Git clone
  69. # git clone cannot clone individual commits based on a sha and some other refs
  70. # this workaround fixes this and fetches only one commit
  71. run: |
  72. sudo docker exec storm bash -c "mkdir /opt/storm; cd /opt/storm; git init && git remote add origin ${STORM_GIT_URL} && git fetch --depth 1 origin ${STORM_BRANCH} && git checkout FETCH_HEAD"
  73. - name: Run cmake
  74. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${CMAKE_ARGS}"
  75. - name: Build storm
  76. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  77. # A bit hacky... but its usefullnes has been proven in production
  78. - name: Check release makeflags
  79. if: matrix.debugOrRelease == 'release'
  80. run: |
  81. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -O3' || (echo \"Error: Missing flag \'-O3\' for release build.\" && false)"
  82. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -DNDEBUG' || (echo \"Error: Missing flag \'-DNDEBUG\' for release build.\" && false)"
  83. - name: Check debug makeflags
  84. if: matrix.debugOrRelease == 'debug'
  85. run: |
  86. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -g' || (echo \"Error: Missing flag \'-g\' for debug build.\" && false)"
  87. - name: Run unit tests
  88. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  89. deploy:
  90. name: Build, Test and Deploy
  91. runs-on: ubuntu-latest
  92. env:
  93. DISTRO: "ubuntu-20.10"
  94. strategy:
  95. matrix:
  96. debugOrRelease: ["debug", "release"]
  97. steps:
  98. - name: Setup cmake arguments
  99. # this is strangely the best way to implement environment variables based on the value of another
  100. # GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE}
  101. # then the env variable with name NAME will be created/updated with VALUE
  102. run: |
  103. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CMAKE_ARGS=${CMAKE_DEBUG}" || echo "CMAKE_ARGS=${CMAKE_RELEASE}") >> $GITHUB_ENV
  104. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CARL_CMAKE_ARGS=${CARL_CMAKE_DEBUG}" || echo "CARL_CMAKE_ARGS=${CARL_CMAKE_RELEASE}") >> $GITHUB_ENV
  105. - name: Login into docker
  106. # Only login if using master on original repo (and not for pull requests or forks)
  107. if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
  108. run: echo "${{ secrets.STORM_CI_DOCKER_PASSWORD }}" | sudo docker login -u "${{ secrets.STORM_CI_DOCKER_USERNAME }}" --password-stdin
  109. - name: Init Docker
  110. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${DISTRO}
  111. #####
  112. # Build & DEPLOY CARL
  113. #####
  114. # We should not do partial updates :/
  115. # but we need to install some dependencies
  116. # Surely we can find a better way to do this at some point
  117. - name: Update base system
  118. run: |
  119. sudo docker exec storm apt-get update
  120. sudo docker exec storm apt-get upgrade -qqy
  121. - name: install dependencies
  122. run: sudo docker exec storm apt-get install -qq -y uuid-dev pkg-config
  123. - name: Git clone carl
  124. run: sudo docker exec storm git clone --depth 1 --branch $CARL_BRANCH $CARL_GIT_URL /opt/carl
  125. - name: Run cmake for carl
  126. run: sudo docker exec storm bash -c "mkdir /opt/carl/build; cd /opt/carl/build; cmake .. ${CARL_CMAKE_ARGS}"
  127. - name: Build carl
  128. run: sudo docker exec storm bash -c "cd /opt/carl/build; make lib_carl -j ${NR_JOBS}"
  129. - name: Deploy carl
  130. # Only deploy if using master on original repo (and not for pull requests or forks)
  131. if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
  132. run: |
  133. sudo docker commit storm movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  134. sudo docker push movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  135. #####
  136. # Build & TEST & DEPLOY STORM
  137. #####
  138. - name: Git shallow clone
  139. # Only clone shallow if not using master on original repo (and not for pull requests or forks)
  140. if: ${{ !(github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master') }}
  141. run: |
  142. # git clone cannot clone individual commits based on a sha and some other refs
  143. sudo docker exec storm bash -c "mkdir /opt/storm; cd /opt/storm; git init && git remote add origin ${STORM_GIT_URL} && git fetch --depth 1 origin ${STORM_BRANCH} && git checkout FETCH_HEAD"
  144. - name: Git deep clone
  145. # needed for versioning for now on deployment
  146. if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
  147. run: |
  148. sudo docker exec storm git clone --branch master $STORM_GIT_URL /opt/storm
  149. - name: Run cmake
  150. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${CMAKE_ARGS}"
  151. - name: Build storm
  152. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  153. # A bit hacky... but its usefulness has been proven in production
  154. - name: Check release makeflags
  155. if: matrix.debugOrRelease == 'release'
  156. run: |
  157. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -O3' || (echo \"Error: Missing flag \'-O3\' for release build.\" && false)"
  158. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -DNDEBUG' || (echo \"Error: Missing flag \'-DNDEBUG\' for release build.\" && false)"
  159. - name: Check debug makeflags
  160. if: matrix.debugOrRelease == 'debug'
  161. run: |
  162. sudo docker exec storm bash -c "/opt/storm/build/bin/storm --version | grep 'with flags .* -g' || (echo \"Error: Missing flag \'-g\' for debug build.\" && false)"
  163. - name: Run unit tests
  164. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  165. - name: Deploy storm
  166. # Only deploy if using master on original repo (and not for pull requests or forks)
  167. if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
  168. run: |
  169. sudo docker commit storm movesrwth/storm:ci-${{ matrix.debugOrRelease }}
  170. sudo docker push movesrwth/storm:ci-${{ matrix.debugOrRelease }}
  171. notify:
  172. name: Email notification
  173. runs-on: ubuntu-latest
  174. needs: [indepthTests, noDeploy, deploy]
  175. # Only run in main repo and even if previous step failed
  176. if: github.repository_owner == 'moves-rwth' && always()
  177. steps:
  178. - uses: technote-space/workflow-conclusion-action@v2
  179. - uses: dawidd6/action-send-mail@v2
  180. with:
  181. server_address: ${{ secrets.STORM_CI_MAIL_SERVER }}
  182. server_port: 587
  183. username: ${{ secrets.STORM_CI_MAIL_USERNAME }}
  184. password: ${{ secrets.STORM_CI_MAIL_PASSWORD }}
  185. subject: "[You broke it] CI run failed for ${{ github.repository }}"
  186. body:
  187. "CI job of ${{ github.repository }} has failed for commit ${{ github.sha }}.\n\
  188. The error type is: ${{ env.WORKFLOW_CONCLUSION }}.\n\n\
  189. For more information, see https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  190. to: ${{ secrets.STORM_CI_MAIL_RECIPIENTS }}
  191. from: Github Actions <you-broke-it@stormchecker.org>
  192. if: env.WORKFLOW_CONCLUSION != 'success' # notify only if failure