conan-package-create.yml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. 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. env:
  38. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  39. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  40. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  41. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  42. CONAN_LOG_RUN_TO_OUTPUT: 1
  43. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  44. CONAN_NON_INTERACTIVE: 1
  45. jobs:
  46. conan-package-create:
  47. runs-on: ${{ inputs.runs_on }}
  48. steps:
  49. - name: Checkout
  50. uses: actions/checkout@v3
  51. - name: Setup Python and pip
  52. uses: actions/setup-python@v4
  53. with:
  54. python-version: ${{ inputs.python_version }}
  55. cache: 'pip'
  56. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  57. - name: Install Python requirements for runner
  58. run: pip install -r .github/workflows/requirements-conan-package.txt
  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-${{ inputs.runs_on }}-${{ 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-${{ inputs.runs_on }}-${{ 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: |
  88. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  89. sudo apt update
  90. sudo apt upgrade
  91. 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
  92. - name: Install GCC-12 on ubuntu-22.04
  93. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  94. run: |
  95. sudo apt install g++-12 gcc-12 -y
  96. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  97. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  98. - name: Use GCC-10 on ubuntu-20.04
  99. if: ${{ startsWith(inputs.runs_on, 'ubuntu-20.04') }}
  100. run: |
  101. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  102. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  103. - name: Create the default Conan profile
  104. run: conan profile new default --detect
  105. - name: Get Conan configuration from branch
  106. if: ${{ inputs.conan_config_branch != '' }}
  107. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  108. - name: Get Conan configuration
  109. if: ${{ inputs.conan_config_branch == '' }}
  110. run: conan config install https://github.com/Ultimaker/conan-config.git
  111. - name: Create the lock file
  112. run: |
  113. conan_build_info --v2 start ${{ inputs.project_name }} ${{ github.run_number }}000${{ inputs.build_id }}
  114. conan lock create --reference ${{ inputs.recipe_id_full }} --lockfile-out=conan.lock
  115. - name: Create the Packages and the build info
  116. run: conan install ${{ inputs.recipe_id_full }} --build=missing --update --lockfile=conan.lock --lockfile-out=conan.lock
  117. - name: Create the build info
  118. run: conan_build_info --v2 create buildinfo.json --lockfile conan.lock --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  119. - name: Upload the Package(s)
  120. if: always()
  121. run: conan upload "*" -r cura --all -c
  122. - name: Upload the build info
  123. run: |
  124. conan_build_info --v2 publish buildinfo.json --url https://ultimaker.jfrog.io/artifactory --user ${{ secrets.CONAN_USER }} --password ${{ secrets.CONAN_PASS }}
  125. conan_build_info --v2 stop
  126. - name: Upload the Package(s) community
  127. if: ${{ always() && inputs.conan_upload_community == true }}
  128. run: conan upload "*" -r cura-ce -c