conan-package-create.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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_CURA: ${{ secrets.CONAN_USER }}
  43. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  44. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  45. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  46. CONAN_LOG_RUN_TO_OUTPUT: 1
  47. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  48. CONAN_NON_INTERACTIVE: 1
  49. jobs:
  50. conan-package-create:
  51. runs-on: ${{ inputs.runs_on }}
  52. steps:
  53. - name: Checkout
  54. uses: actions/checkout@v3
  55. - name: Setup Python and pip
  56. uses: actions/setup-python@v4
  57. with:
  58. python-version: ${{ inputs.python_version }}
  59. cache: 'pip'
  60. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  61. - name: Install Python requirements for runner
  62. run: pip install -r https://raw.githubusercontent.com/Ultimaker/Cura/main/.github/workflows/requirements-conan-package.txt
  63. # Note the runner requirements are always installed from the main branch in the Ultimaker/Cura repo
  64. - name: Use Conan download cache (Bash)
  65. if: ${{ runner.os != 'Windows' }}
  66. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  67. - name: Use Conan download cache (Powershell)
  68. if: ${{ runner.os == 'Windows' }}
  69. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  70. - name: Cache Conan local repository packages (Bash)
  71. uses: actions/cache@v3
  72. if: ${{ runner.os != 'Windows' }}
  73. with:
  74. path: |
  75. $HOME/.conan/data
  76. $HOME/.conan/conan_download_cache
  77. key: conan-${{ inputs.runs_on }}-${{ runner.arch }}-create-cache
  78. - name: Cache Conan local repository packages (Powershell)
  79. uses: actions/cache@v3
  80. if: ${{ runner.os == 'Windows' }}
  81. with:
  82. path: |
  83. C:\Users\runneradmin\.conan\data
  84. C:\.conan
  85. C:\Users\runneradmin\.conan\conan_download_cache
  86. key: conan-${{ inputs.runs_on }}-${{ runner.arch }}-create-cache
  87. - name: Install MacOS system requirements
  88. if: ${{ runner.os == 'Macos' }}
  89. run: brew install autoconf automake ninja
  90. # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest.
  91. # This is maybe because grub caches the disk it uses last time, which is recreated each time.
  92. - name: Install Linux system requirements
  93. if: ${{ runner.os == 'Linux' }}
  94. run: |
  95. sudo rm /var/cache/debconf/config.dat
  96. sudo dpkg --configure -a
  97. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  98. sudo apt update
  99. sudo apt upgrade
  100. 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
  101. - name: Install GCC-12 on ubuntu-22.04
  102. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  103. run: |
  104. sudo apt install g++-12 gcc-12 -y
  105. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  106. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  107. - name: Use GCC-10 on ubuntu-20.04
  108. if: ${{ startsWith(inputs.runs_on, 'ubuntu-20.04') }}
  109. run: |
  110. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  111. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  112. - name: Create the default Conan profile
  113. run: conan profile new default --detect
  114. - name: Get Conan configuration from branch
  115. if: ${{ inputs.conan_config_branch != '' }}
  116. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  117. - name: Get Conan configuration
  118. if: ${{ inputs.conan_config_branch == '' }}
  119. run: conan config install https://github.com/Ultimaker/conan-config.git
  120. - name: Create the lock file
  121. if: ${{ inputs.build_info }}
  122. run: |
  123. conan_build_info --v2 start ${{ inputs.project_name }} ${{ github.run_number }}000${{ inputs.build_id }}
  124. conan lock create --reference ${{ inputs.recipe_id_full }} --lockfile-out=conan.lock
  125. - name: Create the Packages using lockfile
  126. if: ${{ inputs.build_info }}
  127. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update --lockfile=conan.lock --lockfile-out=conan.lock
  128. - name: Create the Packages
  129. if: ${{ ! inputs.build_info }}
  130. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
  131. - name: Create the build info
  132. if: ${{ inputs.build_info }}
  133. run: conan_build_info --v2 create buildinfo.json --lockfile conan.lock --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  134. - name: Upload the Package(s)
  135. if: always()
  136. run: conan upload "*" -r cura --all -c
  137. - name: Upload the build info
  138. if: ${{ inputs.build_info }}
  139. run: |
  140. conan_build_info --v2 publish buildinfo.json --url https://ultimaker.jfrog.io/artifactory --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  141. conan_build_info --v2 stop
  142. - name: Upload the Package(s) community
  143. if: ${{ always() && inputs.conan_upload_community == true }}
  144. run: conan upload "*" -r cura-ce -c
  145. - name: Upload the log and build artifacts
  146. if: always()
  147. uses: actions/upload-artifact@v3
  148. with:
  149. name: log-${{ inputs.runs_on }}-${{ runner.arch }}
  150. path: |
  151. buildinfo.json
  152. conan.lock
  153. conanbuildinfo.txt
  154. conaninfo.txt
  155. graph_info.json
  156. build/**
  157. retention-days: 1