conan-package-create.yml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. name: Create and Upload Conan package
  2. on:
  3. workflow_call:
  4. inputs:
  5. project_name:
  6. required: true
  7. type: string
  8. build_id:
  9. required: true
  10. type: number
  11. recipe_id_full:
  12. required: true
  13. type: string
  14. recipe_id_latest:
  15. required: false
  16. type: string
  17. runs_on:
  18. required: true
  19. type: string
  20. python_version:
  21. required: true
  22. type: string
  23. conan_config_branch:
  24. required: false
  25. type: string
  26. conan_logging_level:
  27. required: false
  28. type: string
  29. conan_clean_local_cache:
  30. required: false
  31. type: boolean
  32. default: false
  33. conan_upload_community:
  34. required: false
  35. default: true
  36. type: boolean
  37. create_from_source:
  38. required: false
  39. default: false
  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 .github/workflows/requirements-conan-package.txt
  63. - name: Use Conan download cache (Bash)
  64. if: ${{ runner.os != 'Windows' }}
  65. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  66. - name: Use Conan download cache (Powershell)
  67. if: ${{ runner.os == 'Windows' }}
  68. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  69. - name: Cache Conan local repository packages (Bash)
  70. uses: actions/cache@v3
  71. if: ${{ runner.os != 'Windows' }}
  72. with:
  73. path: |
  74. $HOME/.conan/data
  75. $HOME/.conan/conan_download_cache
  76. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  77. - name: Cache Conan local repository packages (Powershell)
  78. uses: actions/cache@v3
  79. if: ${{ runner.os == 'Windows' }}
  80. with:
  81. path: |
  82. C:\Users\runneradmin\.conan\data
  83. C:\.conan
  84. C:\Users\runneradmin\.conan\conan_download_cache
  85. key: conan-${{ runner.os }}-${{ runner.arch }}-create-cache
  86. - name: Install MacOS system requirements
  87. if: ${{ runner.os == 'Macos' }}
  88. run: brew install autoconf automake ninja
  89. - name: Install Linux system requirements
  90. if: ${{ runner.os == 'Linux' }}
  91. run: |
  92. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  93. sudo apt update
  94. sudo apt upgrade
  95. 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
  96. - name: Install GCC-12 on ubuntu-22.04
  97. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  98. run: |
  99. sudo apt install g++-12 gcc-12 -y
  100. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  101. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  102. - name: Use GCC-10 on ubuntu-20.04
  103. if: ${{ startsWith(inputs.runs_on, 'ubuntu-20.04') }}
  104. run: |
  105. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  106. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  107. - name: Create the default Conan profile
  108. run: conan profile new default --detect
  109. - name: Get Conan configuration from branch
  110. if: ${{ inputs.conan_config_branch != '' }}
  111. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  112. - name: Get Conan configuration
  113. if: ${{ inputs.conan_config_branch == '' }}
  114. run: conan config install https://github.com/Ultimaker/conan-config.git
  115. - name: Create the Packages
  116. if: ${{ !inputs.create_from_source }}
  117. run: |
  118. conan_build_info --v2 start ${{ inputs.project_name }} ${{ github.run_number }}000${{ inputs.build_id }}
  119. conan lock create --reference ${{ inputs.recipe_id_full }} --build=missing --update
  120. conan install ${{ inputs.recipe_id_full }} --build=missing --update --lockfile=conan.lock
  121. conan_build_info --v2 create buildinfo.json --lockfile conan.lock --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  122. conan_build_info --v2 publish buildinfo.json --url https://ultimaker.jfrog.io/artifactory --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  123. conan_build_info --v2 stop
  124. - name: Create the Packages (from source)
  125. if: ${{ inputs.create_from_source }}
  126. run: conan create . ${{ inputs.recipe_id_full }} --build=missing --update
  127. - name: Remove the latest alias
  128. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && runner.os == 'Linux' }}
  129. run: |
  130. conan remove ${{ inputs.recipe_id_latest }} -r cura -f || true
  131. conan remove ${{ inputs.recipe_id_latest }} -r cura-ce -f || true
  132. - name: Create the latest alias
  133. if: ${{ inputs.create_from_source && inputs.recipe_id_latest != '' && always() }}
  134. run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
  135. - name: Upload the Package(s)
  136. if: always()
  137. run: conan upload "*" -r cura --all -c
  138. - name: Upload the Package(s) community
  139. if: ${{ always() && inputs.conan_upload_community == true }}
  140. run: conan upload "*" -r cura-ce -c