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.

161 lines
7.7 KiB

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