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.

164 lines
7.9 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. run: echo "${{ secrets.STORM_CI_DOCKER_PASSWORD }}" | sudo docker login -u "${{ secrets.STORM_CI_DOCKER_USERNAME }}" --password-stdin
  76. - name: Init Docker
  77. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${DISTRO}
  78. #####
  79. # Build & DEPLOY CARL
  80. #####
  81. # We should not do partial updates :/
  82. # but we need to install some dependencies
  83. # Surely we can find a better way to do this at some point
  84. - name: Update base system
  85. run: |
  86. sudo docker exec storm apt-get update
  87. sudo docker exec storm apt-get upgrade -qqy
  88. - name: install dependencies
  89. run: sudo docker exec storm apt-get install -qq -y uuid-dev pkg-config
  90. - name: Git clone carl
  91. run: sudo docker exec storm git clone --depth 1 --branch $CARL_BRANCH $CARL_GIT_URL /opt/carl
  92. - name: Run cmake for carl
  93. run: sudo docker exec storm bash -c "mkdir /opt/carl/build; cd /opt/carl/build; cmake .. ${CARL_CMAKE_ARGS}"
  94. - name: Build carl
  95. run: sudo docker exec storm bash -c "cd /opt/carl/build; make lib_carl -j ${NR_JOBS}"
  96. - name: Deploy carl
  97. run: |
  98. sudo docker commit storm movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  99. sudo docker push movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  100. #####
  101. # Build & TEST & DEPLOY STORM
  102. #####
  103. - name: Git clone
  104. run: sudo docker exec storm git clone --branch $STORM_BRANCH $STORM_GIT_URL /opt/storm
  105. - name: Run cmake
  106. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${CMAKE_ARGS}"
  107. - name: Build storm
  108. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  109. # A bit hacky... but its usefulness has been proven in production
  110. - name: Check release makeflags
  111. if: matrix.debugOrRelease == 'release'
  112. run: |
  113. 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)"
  114. 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)"
  115. - name: Check debug makeflags
  116. if: matrix.debugOrRelease == 'debug'
  117. run: |
  118. 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)"
  119. - name: Run unit tests
  120. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  121. - name: Deploy storm
  122. # Only deploy if using master (and not for pull requests)
  123. if: github.ref == 'refs/heads/master'
  124. run: |
  125. sudo docker commit storm movesrwth/storm:ci-${{ matrix.debugOrRelease }}
  126. sudo docker push movesrwth/storm:ci-${{ matrix.debugOrRelease }}
  127. notify:
  128. name: Email notification
  129. runs-on: ubuntu-latest
  130. needs: [noDeploy, deploy]
  131. if: always() # set always
  132. steps:
  133. - uses: technote-space/workflow-conclusion-action@v2
  134. - uses: dawidd6/action-send-mail@v2
  135. with:
  136. server_address: ${{ secrets.STORM_CI_MAIL_SERVER }}
  137. server_port: 587
  138. username: ${{ secrets.STORM_CI_MAIL_USERNAME }}
  139. password: ${{ secrets.STORM_CI_MAIL_PASSWORD }}
  140. subject: "[You broke it] CI run failed for ${{ github.repository }}"
  141. body:
  142. "CI job of ${{ github.repository }} has failed for commit ${{ github.sha }}.\n\
  143. The error type is: ${{ env.WORKFLOW_CONCLUSION }}.\n\n\
  144. For more information, see https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  145. to: ${{ secrets.STORM_CI_MAIL_RECIPIENTS }}
  146. from: Github Actions <you-broke-it@stormchecker.org>
  147. if: env.WORKFLOW_CONCLUSION != 'success' # notify only if failure