linux.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. name: Linux Installer
  2. run-name: ${{ inputs.cura_conan_version }} for Linux-${{ inputs.architecture }} by @${{ github.actor }}
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. cura_conan_version:
  7. description: 'Cura Conan Version'
  8. default: 'cura/latest@ultimaker/testing'
  9. required: true
  10. type: string
  11. conan_args:
  12. description: 'Conan args: eq.: --require-override'
  13. default: ''
  14. required: false
  15. type: string
  16. enterprise:
  17. description: 'Build Cura as an Enterprise edition'
  18. default: false
  19. required: true
  20. type: boolean
  21. staging:
  22. description: 'Use staging API'
  23. default: false
  24. required: true
  25. type: boolean
  26. architecture:
  27. description: 'Architecture'
  28. required: true
  29. default: 'X64'
  30. type: choice
  31. options:
  32. - X64
  33. operating_system:
  34. description: 'OS'
  35. required: true
  36. default: 'ubuntu-22.04'
  37. type: choice
  38. options:
  39. - ubuntu-22.04
  40. workflow_call:
  41. inputs:
  42. cura_conan_version:
  43. description: 'Cura Conan Version'
  44. default: 'cura/latest@ultimaker/testing'
  45. required: true
  46. type: string
  47. conan_args:
  48. description: 'Conan args: eq.: --require-override'
  49. default: ''
  50. required: false
  51. type: string
  52. enterprise:
  53. description: 'Build Cura as an Enterprise edition'
  54. default: false
  55. required: true
  56. type: boolean
  57. staging:
  58. description: 'Use staging API'
  59. default: false
  60. required: true
  61. type: boolean
  62. architecture:
  63. description: 'Architecture'
  64. required: true
  65. default: 'X64'
  66. type: string
  67. operating_system:
  68. description: 'OS'
  69. required: true
  70. default: 'ubuntu-22.04'
  71. type: string
  72. env:
  73. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  74. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  75. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  76. CURA_CONAN_VERSION: ${{ inputs.cura_conan_version }}
  77. ENTERPRISE: ${{ inputs.enterprise }}
  78. STAGING: ${{ inputs.staging }}
  79. jobs:
  80. cura-installer-create:
  81. runs-on: ${{ inputs.operating_system }}
  82. steps:
  83. - name: Checkout
  84. uses: actions/checkout@v3
  85. - name: Setup Python and pip
  86. uses: actions/setup-python@v4
  87. with:
  88. python-version: '3.10.x'
  89. cache: 'pip'
  90. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  91. - name: Install Python requirements for runner
  92. run: pip install -r .github/workflows/requirements-conan-package.txt
  93. - name: Cache Conan local repository packages (Bash)
  94. uses: actions/cache@v3
  95. with:
  96. path: |
  97. $HOME/.conan/data
  98. $HOME/.conan/conan_download_cache
  99. key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache
  100. - name: Install Linux system requirements
  101. run: |
  102. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  103. sudo apt update
  104. sudo apt upgrade
  105. 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 binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf squashfs-tools strace util-linux zsync -y
  106. # Get the AppImage tool
  107. wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool
  108. chmod +x $GITHUB_WORKSPACE/appimagetool
  109. echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV
  110. # Get the AppImage builder
  111. wget --no-check-certificate --quiet -O $GITHUB_WORKSPACE/appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
  112. chmod +x appimage-builder-x86_64.AppImage
  113. echo "APPIMAGEBUILDER_LOCATION=$GITHUB_WORKSPACE/appimage-builder-x86_64.AppImage" >> $GITHUB_ENV
  114. # Make sure these tools can be found on the path
  115. echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
  116. - name: Install GCC-13
  117. run: |
  118. sudo apt install g++-13 gcc-13 -y
  119. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
  120. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
  121. - name: Create the default Conan profile
  122. run: conan profile new default --detect --force
  123. - name: Configure GPG Key Linux (Bash)
  124. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  125. - name: Get Conan configuration
  126. run: |
  127. conan config install https://github.com/Ultimaker/conan-config.git
  128. conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}"
  129. - name: Use Conan download cache (Bash)
  130. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  131. - name: Create the Packages (Bash)
  132. run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING -c tools.build:skip_test=True
  133. - name: Remove internal packages before uploading
  134. run: |
  135. conan remove "*@internal/*" -f || true
  136. conan remove "cura_private_data*" -f || true
  137. - name: Upload the Package(s)
  138. if: always()
  139. run: |
  140. conan upload "*" -r cura --all -c
  141. - name: Set Environment variables for Cura (bash)
  142. run: |
  143. . ./cura_inst/bin/activate_github_actions_env.sh
  144. . ./cura_inst/bin/activate_github_actions_version_env.sh
  145. # FIXME: This is a workaround to ensure that we use and pack a shared library for OpenSSL 1.1.1l. We currently compile
  146. # OpenSSL statically for CPython, but our Python Dependenies (such as PyQt6) require a shared library.
  147. # Because Conan won't allow for building the same library with two different options (easily) we need to install it explicitly
  148. # and do a manual copy to the VirtualEnv, such that Pyinstaller can find it.
  149. - name: Install OpenSSL shared
  150. run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy
  151. - name: Copy OpenSSL shared (Bash)
  152. run: |
  153. cp ./openssl/lib/*.so* ./cura_inst/bin/ || true
  154. cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true
  155. - name: Create the Cura dist
  156. run: pyinstaller ./cura_inst/UltiMaker-Cura.spec
  157. - name: Output the name file name and extension
  158. id: filename
  159. shell: python
  160. run: |
  161. import os
  162. enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else ""
  163. installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}"
  164. output_env = os.environ["GITHUB_OUTPUT"]
  165. content = ""
  166. if os.path.exists(output_env):
  167. with open(output_env, "r") as f:
  168. content = f.read()
  169. with open(output_env, "w") as f:
  170. f.write(content)
  171. f.writelines(f"INSTALLER_FILENAME={installer_filename}\n")
  172. - name: Summarize the used dependencies
  173. shell: python
  174. run: |
  175. import os
  176. from cura.CuraVersion import ConanInstalls, PythonInstalls
  177. summary_env = os.environ["GITHUB_STEP_SUMMARY"]
  178. content = ""
  179. if os.path.exists(summary_env):
  180. with open(summary_env, "r") as f:
  181. content = f.read()
  182. with open(summary_env, "w") as f:
  183. f.write(content)
  184. f.writelines("# ${{ steps.filename.outputs.INSTALLER_FILENAME }}\n")
  185. f.writelines("## Conan packages:\n")
  186. for dep_name, dep_info in ConanInstalls.items():
  187. f.writelines(f"`{dep_name} {dep_info['version']} {dep_info['revision']}`\n")
  188. f.writelines("## Python modules:\n")
  189. for dep_name, dep_info in PythonInstalls.items():
  190. f.writelines(f"`{dep_name} {dep_info['version']}`\n")
  191. - name: Create the Linux AppImage (Bash)
  192. run: |
  193. python ../cura_inst/packaging/AppImage-builder/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage"
  194. chmod +x "${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage"
  195. working-directory: dist
  196. - name: Upload the AppImage
  197. uses: actions/upload-artifact@v3
  198. with:
  199. name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-AppImage
  200. path: |
  201. dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage
  202. retention-days: 5
  203. - name: Upload the asc
  204. uses: actions/upload-artifact@v3
  205. with:
  206. name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-asc
  207. path: |
  208. dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage.asc
  209. retention-days: 5
  210. - name: Write the run info
  211. shell: python
  212. run: |
  213. import os
  214. with open("run_info.sh", "w") as f:
  215. f.writelines(f'echo "CURA_VERSION_FULL={os.environ["CURA_VERSION_FULL"]}" >> $GITHUB_ENV\n')
  216. - name: Upload the run info
  217. uses: actions/upload-artifact@v3
  218. with:
  219. name: linux-run-info
  220. path: |
  221. run_info.sh
  222. retention-days: 5
  223. notify-export:
  224. if: ${{ always() }}
  225. needs: [ cura-installer-create ]
  226. uses: ultimaker/cura/.github/workflows/notify.yml@main
  227. with:
  228. success: ${{ contains(join(needs.*.result, ','), 'success') }}
  229. success_title: "Create the Cura distributions"
  230. success_body: "Installers for ${{ inputs.cura_conan_version }}"
  231. failure_title: "Failed to create the Cura distributions"
  232. failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}"
  233. secrets: inherit