conan-package-create.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. name: Create and Upload Conan package
  2. on:
  3. workflow_call:
  4. inputs:
  5. recipe_id_full:
  6. required: true
  7. type: string
  8. recipe_id_latest:
  9. required: false
  10. type: string
  11. runs_on:
  12. required: true
  13. type: string
  14. python_version:
  15. required: true
  16. type: string
  17. conan_config_branch:
  18. required: false
  19. type: string
  20. conan_logging_level:
  21. required: false
  22. type: string
  23. conan_clean_local_cache:
  24. required: false
  25. type: boolean
  26. default: false
  27. conan_upload_community:
  28. required: false
  29. default: true
  30. type: boolean
  31. create_from_source:
  32. required: false
  33. default: false
  34. type: boolean
  35. env:
  36. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  37. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  38. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  39. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  40. CONAN_LOG_RUN_TO_OUTPUT: 1
  41. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  42. CONAN_NON_INTERACTIVE: 1
  43. jobs:
  44. conan-package-create:
  45. runs-on: ${{ inputs.runs_on }}
  46. steps:
  47. - name: Checkout
  48. uses: actions/checkout@v3
  49. - name: Setup Python and pip
  50. uses: actions/setup-python@v4
  51. with:
  52. python-version: ${{ inputs.python_version }}
  53. cache: 'pip'
  54. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  55. - name: Install Python requirements and Create default Conan profile
  56. run: |
  57. pip install -r .github/workflows/requirements-conan-package.txt
  58. conan profile new default --detect
  59. - name: Use Conan download cache (Bash)
  60. if: ${{ runner.os != 'Windows' }}
  61. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  62. - name: Use Conan download cache (Powershell)
  63. if: ${{ runner.os == 'Windows' }}
  64. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  65. - name: Cache Conan local repository packages (Bash)
  66. uses: actions/cache@v3
  67. if: ${{ runner.os != 'Windows' }}
  68. with:
  69. path: |
  70. $HOME/.conan/data
  71. $HOME/.conan/conan_download_cache
  72. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  73. - name: Cache Conan local repository packages (Powershell)
  74. uses: actions/cache@v3
  75. if: ${{ runner.os == 'Windows' }}
  76. with:
  77. path: |
  78. C:\Users\runneradmin\.conan\data
  79. C:\.conan
  80. C:\Users\runneradmin\.conan\conan_download_cache
  81. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  82. - name: Install MacOS system requirements
  83. if: ${{ runner.os == 'Macos' }}
  84. run: brew install autoconf automake ninja
  85. - name: Install Linux system requirements
  86. if: ${{ runner.os == 'Linux' }}
  87. run: sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev pkg-config -y
  88. - name: Get Conan configuration from branch
  89. if: ${{ inputs.conan_config_branch != '' }}
  90. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  91. - name: Get Conan configuration
  92. if: ${{ inputs.conan_config_branch == '' }}
  93. run: conan config install https://github.com/Ultimaker/conan-config.git
  94. - name: Create the Packages
  95. if: ${{ !inputs.create_from_source }}
  96. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
  97. - name: Create the Packages (from source)
  98. if: ${{ inputs.create_from_source }}
  99. run: conan create . ${{ inputs.recipe_id_full }} --build=missing --update
  100. - name: Remove the latest alias
  101. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && runner.os == 'Linux' }}
  102. run: |
  103. conan remove ${{ inputs.recipe_id_latest }} -r cura -f || true
  104. conan remove ${{ inputs.recipe_id_latest }} -r cura-ce -f || true
  105. - name: Create the latest alias
  106. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && always() }}
  107. run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
  108. - name: Upload the Package(s)
  109. if: always()
  110. run: conan upload "*" -r cura --all -c
  111. - name: Upload the Package(s) community
  112. if: ${{ always() && inputs.conan_upload_community == 'true' }}
  113. run: conan upload "*" -r cura-ce -c