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.

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