conan-package-create.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 for runner
  56. run: pip install -r .github/workflows/requirements-conan-package.txt
  57. - name: Use Conan download cache (Bash)
  58. if: ${{ runner.os != 'Windows' }}
  59. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  60. - name: Use Conan download cache (Powershell)
  61. if: ${{ runner.os == 'Windows' }}
  62. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  63. - name: Cache Conan local repository packages (Bash)
  64. uses: actions/cache@v3
  65. if: ${{ runner.os != 'Windows' }}
  66. with:
  67. path: |
  68. $HOME/.conan/data
  69. $HOME/.conan/conan_download_cache
  70. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  71. - name: Cache Conan local repository packages (Powershell)
  72. uses: actions/cache@v3
  73. if: ${{ runner.os == 'Windows' }}
  74. with:
  75. path: |
  76. C:\Users\runneradmin\.conan\data
  77. C:\.conan
  78. C:\Users\runneradmin\.conan\conan_download_cache
  79. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  80. - name: Install MacOS system requirements
  81. if: ${{ runner.os == 'Macos' }}
  82. run: brew install autoconf automake ninja
  83. - name: Install Linux system requirements
  84. if: ${{ runner.os == 'Linux' }}
  85. run: |
  86. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  87. sudo apt update
  88. sudo apt upgrade
  89. 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
  90. - name: Install GCC-12 on ubuntu-22.04
  91. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  92. run: |
  93. sudo apt install g++-12 gcc-12 -y
  94. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  95. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  96. - name: Create the default Conan profile
  97. run: conan profile new default --detect
  98. - name: Get Conan configuration from branch
  99. if: ${{ inputs.conan_config_branch != '' }}
  100. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  101. - name: Get Conan configuration
  102. if: ${{ inputs.conan_config_branch == '' }}
  103. run: conan config install https://github.com/Ultimaker/conan-config.git
  104. - name: Create the Packages
  105. if: ${{ !inputs.create_from_source }}
  106. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
  107. - name: Create the Packages (from source)
  108. if: ${{ inputs.create_from_source }}
  109. run: conan create . ${{ inputs.recipe_id_full }} --build=missing --update
  110. - name: Remove the latest alias
  111. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && runner.os == 'Linux' }}
  112. run: |
  113. conan remove ${{ inputs.recipe_id_latest }} -r cura -f || true
  114. conan remove ${{ inputs.recipe_id_latest }} -r cura-ce -f || true
  115. - name: Create the latest alias
  116. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && always() }}
  117. run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
  118. - name: Upload the Package(s)
  119. if: always()
  120. run: conan upload "*" -r cura --all -c
  121. - name: Upload the Package(s) community
  122. if: ${{ always() && inputs.conan_upload_community == true }}
  123. run: conan upload "*" -r cura-ce -c