conan-package-create.yml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. name: Create and Upload Conan package
  2. on:
  3. workflow_call:
  4. inputs:
  5. project_name:
  6. required: true
  7. type: string
  8. recipe_id_full:
  9. required: true
  10. type: string
  11. build_id:
  12. required: true
  13. type: number
  14. build_info:
  15. required: false
  16. default: true
  17. type: boolean
  18. recipe_id_latest:
  19. required: false
  20. type: string
  21. runs_on:
  22. required: true
  23. type: string
  24. python_version:
  25. required: true
  26. type: string
  27. conan_config_branch:
  28. required: false
  29. type: string
  30. conan_logging_level:
  31. required: false
  32. type: string
  33. conan_clean_local_cache:
  34. required: false
  35. type: boolean
  36. default: false
  37. conan_upload_community:
  38. required: false
  39. default: true
  40. type: boolean
  41. env:
  42. CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }}
  43. CONAN_PASSWORD: ${{ secrets.CONAN_PASS }}
  44. CONAN_LOG_RUN_TO_OUTPUT: 1
  45. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  46. CONAN_NON_INTERACTIVE: 1
  47. jobs:
  48. conan-package-create:
  49. runs-on: ${{ inputs.runs_on }}
  50. steps:
  51. - name: Checkout
  52. uses: actions/checkout@v3
  53. - name: Setup Python and pip
  54. uses: actions/setup-python@v4
  55. with:
  56. python-version: ${{ inputs.python_version }}
  57. cache: 'pip'
  58. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  59. - name: Install Python requirements for runner
  60. run: pip install -r https://raw.githubusercontent.com/Ultimaker/Cura/main/.github/workflows/requirements-conan-package.txt
  61. # Note the runner requirements are always installed from the main branch in the Ultimaker/Cura repo
  62. - name: Use Conan download cache (Bash)
  63. if: ${{ runner.os != 'Windows' }}
  64. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  65. - name: Use Conan download cache (Powershell)
  66. if: ${{ runner.os == 'Windows' }}
  67. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  68. - name: Cache Conan local repository packages (Bash)
  69. uses: actions/cache@v3
  70. if: ${{ runner.os != 'Windows' }}
  71. with:
  72. path: |
  73. $HOME/.conan/data
  74. $HOME/.conan/conan_download_cache
  75. key: conan-${{ inputs.runs_on }}-${{ runner.arch }}-create-cache
  76. - name: Cache Conan local repository packages (Powershell)
  77. uses: actions/cache@v3
  78. if: ${{ runner.os == 'Windows' }}
  79. with:
  80. path: |
  81. C:\Users\runneradmin\.conan\data
  82. C:\.conan
  83. C:\Users\runneradmin\.conan\conan_download_cache
  84. key: conan-${{ inputs.runs_on }}-${{ runner.arch }}-create-cache
  85. - name: Install MacOS system requirements
  86. if: ${{ runner.os == 'Macos' }}
  87. run: brew install autoconf automake ninja
  88. # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest.
  89. # This is maybe because grub caches the disk it uses last time, which is recreated each time.
  90. - name: Install Linux system requirements
  91. if: ${{ runner.os == 'Linux' }}
  92. run: |
  93. sudo rm /var/cache/debconf/config.dat
  94. sudo dpkg --configure -a
  95. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  96. sudo apt update
  97. sudo apt upgrade
  98. 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 flex bison -y
  99. - name: Install GCC-12 on ubuntu-22.04
  100. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  101. run: |
  102. sudo apt install g++-12 gcc-12 -y
  103. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  104. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  105. - name: Use GCC-10 on ubuntu-20.04
  106. if: ${{ startsWith(inputs.runs_on, 'ubuntu-20.04') }}
  107. run: |
  108. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  109. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  110. - name: Create the default Conan profile
  111. run: conan profile new default --detect
  112. - name: Get Conan configuration from branch
  113. if: ${{ inputs.conan_config_branch != '' }}
  114. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  115. - name: Get Conan configuration
  116. if: ${{ inputs.conan_config_branch == '' }}
  117. run: conan config install https://github.com/Ultimaker/conan-config.git
  118. - name: Add Cura private Artifactory remote
  119. run: conan remote add cura-private https://ultimaker.jfrog.io/artifactory/api/conan/cura-private True
  120. - name: Create the Packages
  121. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
  122. - name: Upload the Package(s)
  123. if: ${{ always() && inputs.conan_upload_community }}
  124. run: conan upload ${{ inputs.recipe_id_full }} -r cura --all -c
  125. - name: Upload the Package(s) to the private Artifactory
  126. if: ${{ always() && ! inputs.conan_upload_community }}
  127. run: conan upload ${{ inputs.recipe_id_full }} -r cura-private --all -c