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.

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