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.

139 lines
6.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. runs-on: ubuntu-latest
  25. strategy:
  26. matrix:
  27. distro: ["ubuntu-18.04", "debian-10", "debian-9"]
  28. debugOrRelease: ["debug", "release"]
  29. steps:
  30. - name: Setup cmake arguments
  31. # this is strangely the best way to implement environment variables based on the value of another
  32. # GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE}
  33. # then the env variable with name NAME will be created/updated with VALUE
  34. run: |
  35. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CMAKE_ARGS=${CMAKE_DEBUG}" || echo "CMAKE_ARGS=${CMAKE_RELEASE}") >> $GITHUB_ENV
  36. - name: Init Docker
  37. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${{ matrix.distro }}
  38. - name: Git clone
  39. run: sudo docker exec storm git clone --depth 1 --branch $STORM_BRANCH $STORM_GIT_URL /opt/storm
  40. - name: Run cmake
  41. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${CMAKE_ARGS}"
  42. - name: Build storm
  43. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  44. # A bit hacky... but its usefullnes has been proven in production
  45. - name: Check release makeflags
  46. if: matrix.debugOrRelease == 'release'
  47. run: |
  48. 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)"
  49. 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)"
  50. - name: Check debug makeflags
  51. if: matrix.debugOrRelease == 'debug'
  52. run: |
  53. 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)"
  54. - name: Run unit tests
  55. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  56. deploy:
  57. runs-on: ubuntu-latest
  58. env:
  59. DISTRO: "ubuntu-20.04"
  60. strategy:
  61. matrix:
  62. debugOrRelease: ["debug", "release"]
  63. steps:
  64. - name: Setup cmake arguments
  65. # this is strangely the best way to implement environment variables based on the value of another
  66. # GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE}
  67. # then the env variable with name NAME will be created/updated with VALUE
  68. run: |
  69. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CMAKE_ARGS=${CMAKE_DEBUG}" || echo "CMAKE_ARGS=${CMAKE_RELEASE}") >> $GITHUB_ENV
  70. ([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "CARL_CMAKE_ARGS=${CARL_CMAKE_DEBUG}" || echo "CARL_CMAKE_ARGS=${CARL_CMAKE_RELEASE}") >> $GITHUB_ENV
  71. - name: Login into docker
  72. run: echo "${{ secrets.DOCKER_PASSWORD }}" | sudo docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
  73. - name: Init Docker
  74. run: sudo docker run -d -it --name storm --privileged movesrwth/storm-basesystem:${DISTRO}
  75. #####
  76. # Build & DEPLOY CARL
  77. #####
  78. # We should not do partial updates :/
  79. # but we need to install some dependencies
  80. # Surely we can find a better way to do this at some point
  81. - name: Update base system
  82. run: |
  83. sudo docker exec storm apt-get update
  84. sudo docker exec storm apt-get upgrade -qqy
  85. - name: install dependencies
  86. run: sudo docker exec storm apt-get install -qq -y uuid-dev pkg-config
  87. - name: Git clone carl
  88. run: sudo docker exec storm git clone --depth 1 --branch $CARL_BRANCH $CARL_GIT_URL /opt/carl
  89. - name: Run cmake for carl
  90. run: sudo docker exec storm bash -c "mkdir /opt/carl/build; cd /opt/carl/build; cmake .. ${CARL_CMAKE_ARGS}"
  91. - name: Build carl
  92. run: sudo docker exec storm bash -c "cd /opt/carl/build; make lib_carl -j ${NR_JOBS}"
  93. # dummy step for now
  94. - name: Deploy carl
  95. run: |
  96. sudo docker commit storm movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  97. sudo docker push movesrwth/carl:ci-${{ matrix.debugOrRelease }}
  98. #####
  99. # Build & TEST & DEPLOY STORM
  100. #####
  101. - name: Git clone
  102. run: sudo docker exec storm git clone --depth 1 --branch $STORM_BRANCH $STORM_GIT_URL /opt/storm
  103. - name: Run cmake
  104. run: sudo docker exec storm bash -c "mkdir /opt/storm/build; cd /opt/storm/build; cmake .. ${CMAKE_ARGS}"
  105. - name: Build storm
  106. run: sudo docker exec storm bash -c "cd /opt/storm/build; make -j ${NR_JOBS}"
  107. # A bit hacky... but its usefullnes has been proven in production
  108. - name: Check release makeflags
  109. if: matrix.debugOrRelease == 'release'
  110. run: |
  111. 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)"
  112. 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)"
  113. - name: Check debug makeflags
  114. if: matrix.debugOrRelease == 'debug'
  115. run: |
  116. 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)"
  117. - name: Run unit tests
  118. run: sudo docker exec storm bash -c "cd /opt/storm/build; ctest test --output-on-failure"
  119. # dummy step for now
  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 }}