github.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. name: CMake
  2. on: [ push ]
  3. env:
  4. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  5. BUILD_TYPE: Release
  6. jobs:
  7. build:
  8. strategy:
  9. matrix:
  10. include:
  11. - platform: linux
  12. os: ubuntu-20.04
  13. cc: clang-10
  14. cxx: clang++-10
  15. test: 0
  16. - platform: linux
  17. os: ubuntu-20.04
  18. cc: gcc-9
  19. cxx: g++-9
  20. test: 0
  21. - platform: mac
  22. os: macos-latest
  23. test: 0
  24. pack: 1
  25. extension: dmg
  26. - platform: mxe
  27. os: ubuntu-20.04
  28. mxe: i686-w64-mingw32.shared
  29. test: 0
  30. pack: 1
  31. cpack_args: -D CPACK_NSIS_EXECUTABLE=`which makensis`
  32. extension: exe
  33. runs-on: ${{ matrix.os }}
  34. steps:
  35. - uses: actions/checkout@v2
  36. with:
  37. submodules: recursive
  38. - name: Dependencies
  39. run: source ${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh
  40. env:
  41. MXE_TARGET: ${{ matrix.mxe }}
  42. - name: Git branch name
  43. id: git-branch-name
  44. uses: EthanSK/git-branch-name-action@v1
  45. - name: Build Number
  46. run: |
  47. source ${{github.workspace}}/CI/get_package_name.sh
  48. echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV
  49. echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV
  50. env:
  51. PULL_REQUEST: ${{ github.event.pull_request.number }}
  52. - name: Configure CMake
  53. run: |
  54. mkdir ${{github.workspace}}/build
  55. cd ${{github.workspace}}/build
  56. cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
  57. -DENABLE_TEST=${{matrix.test}} \
  58. -DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
  59. -DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"
  60. env:
  61. CC: ${{ matrix.cc }}
  62. CXX: ${{ matrix.cxx }}
  63. - name: Build
  64. run: |
  65. cd ${{github.workspace}}/build
  66. ninja
  67. - name: Test
  68. if: ${{ matrix.test == 1 }}
  69. run: |
  70. cd ${{github.workspace}}/build
  71. ctest -C Release -V
  72. - name: Pack
  73. id: cpack
  74. if: ${{ matrix.pack == 1 }}
  75. run: |
  76. cd ${{github.workspace}}/build
  77. cpack ${{ matrix.cpack_args }}
  78. - name: Additional logs
  79. if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'mxe' }}
  80. run: |
  81. cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/project.nsi
  82. cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/NSISOutput.log
  83. - name: Artifacts
  84. if: ${{ matrix.pack == 1 }}
  85. uses: actions/upload-artifact@v2
  86. with:
  87. name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
  88. path: ${{github.workspace}}/build/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
  89. - name: Upload build
  90. if: ${{ matrix.pack == 1 && github.ref == 'refs/heads/develop' }}
  91. run: |
  92. cd ${{github.workspace}}/build
  93. source ${{github.workspace}}/CI/upload_package.sh
  94. env:
  95. DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }}
  96. PACKAGE_EXTENSION: ${{ matrix.extension }}
  97. - uses: act10ns/slack@v1
  98. with:
  99. status: ${{ job.status }}
  100. channel: '#notifications'
  101. env:
  102. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  103. if: always()