cura-installer.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. name: Cura Installer
  2. run-name: ${{ inputs.cura_conan_version }} for ${{ inputs.platform }} by @${{ github.actor }}
  3. on:
  4. workflow_call:
  5. inputs:
  6. platform:
  7. description: 'Selected Installer OS'
  8. default: 'ubuntu-20.04'
  9. required: true
  10. type: string
  11. os_name:
  12. description: 'OS Friendly Name'
  13. default: 'linux'
  14. required: true
  15. type: string
  16. cura_conan_version:
  17. description: 'Cura Conan Version'
  18. default: 'cura/latest@ultimaker/testing'
  19. required: true
  20. type: string
  21. conan_args:
  22. description: 'Conan args: eq.: --require-override'
  23. default: ''
  24. required: false
  25. type: string
  26. conan_config:
  27. description: 'Conan config branch to use'
  28. default: ''
  29. required: false
  30. type: string
  31. enterprise:
  32. description: 'Build Cura as an Enterprise edition'
  33. default: false
  34. required: true
  35. type: boolean
  36. staging:
  37. description: 'Use staging API'
  38. default: false
  39. required: true
  40. type: boolean
  41. installer:
  42. description: 'Create the installer'
  43. default: true
  44. required: true
  45. type: boolean
  46. env:
  47. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  48. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  49. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  50. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  51. CONAN_LOG_RUN_TO_OUTPUT: 1
  52. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  53. CONAN_NON_INTERACTIVE: 1
  54. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  55. MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }}
  56. MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }}
  57. MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
  58. MACOS_CERT_PASS: ${{ secrets.MACOS_CERT_PASS }}
  59. MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }}
  60. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  61. MACOS_CERT_PASSPHRASE: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  62. CURA_CONAN_VERSION: ${{ inputs.cura_conan_version }}
  63. ENTERPRISE: ${{ inputs.enterprise }}
  64. STAGING: ${{ inputs.staging }}
  65. jobs:
  66. cura-installer-create:
  67. runs-on: ${{ inputs.platform }}
  68. steps:
  69. - name: Checkout
  70. uses: actions/checkout@v3
  71. - name: Setup Python and pip
  72. uses: actions/setup-python@v4
  73. with:
  74. python-version: '3.10.x'
  75. cache: 'pip'
  76. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  77. - name: Install Python requirements for runner
  78. run: pip install -r .github/workflows/requirements-conan-package.txt
  79. - name: Use Conan download cache (Bash)
  80. if: ${{ runner.os != 'Windows' }}
  81. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  82. - name: Use Conan download cache (Powershell)
  83. if: ${{ runner.os == 'Windows' }}
  84. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  85. - name: Cache Conan local repository packages (Bash)
  86. uses: actions/cache@v3
  87. if: ${{ runner.os != 'Windows' }}
  88. with:
  89. path: |
  90. $HOME/.conan/data
  91. $HOME/.conan/conan_download_cache
  92. key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache
  93. - name: Cache Conan local repository packages (Powershell)
  94. uses: actions/cache@v3
  95. if: ${{ runner.os == 'Windows' }}
  96. with:
  97. path: |
  98. C:\Users\runneradmin\.conan\data
  99. C:\.conan
  100. C:\Users\runneradmin\.conan\conan_download_cache
  101. key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache
  102. - name: Install MacOS system requirements
  103. if: ${{ runner.os == 'Macos' }}
  104. run: brew install autoconf automake ninja create-dmg
  105. - name: Install Linux system requirements
  106. if: ${{ runner.os == 'Linux' }}
  107. run: |
  108. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  109. sudo apt update
  110. sudo apt upgrade
  111. 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
  112. wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool
  113. chmod +x $GITHUB_WORKSPACE/appimagetool
  114. echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV
  115. - name: Install GCC-12 on ubuntu-22.04
  116. if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }}
  117. run: |
  118. sudo apt install g++-12 gcc-12 -y
  119. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
  120. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
  121. - name: Use GCC-10 on ubuntu-20.04
  122. if: ${{ startsWith(inputs.runs_on, 'ubuntu-20.04') }}
  123. run: |
  124. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
  125. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  126. - name: Create the default Conan profile
  127. run: conan profile new default --detect
  128. - name: Configure GPG Key Linux (Bash)
  129. if: ${{ runner.os == 'Linux' }}
  130. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  131. - name: Configure Macos keychain (Bash)
  132. id: macos-keychain
  133. if: ${{ runner.os == 'Macos' }}
  134. uses: apple-actions/import-codesign-certs@v1
  135. with:
  136. p12-file-base64: ${{ secrets.MACOS_CERT_P12 }}
  137. p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  138. - name: Clean Conan local cache
  139. if: ${{ inputs.conan_clean_local_cache }}
  140. run: conan remove "*" -f
  141. - name: Get Conan configuration from branch
  142. if: ${{ inputs.conan_config_branch != '' }}
  143. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  144. - name: Get Conan configuration
  145. if: ${{ inputs.conan_config_branch == '' }}
  146. run: conan config install https://github.com/Ultimaker/conan-config.git
  147. - name: Create the Packages (Bash)
  148. if: ${{ runner.os != 'Windows' }}
  149. 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 --json "cura_inst/conan_install_info.json"
  150. - name: Create the Packages (Powershell)
  151. if: ${{ runner.os == 'Windows' }}
  152. run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING --json "cura_inst/conan_install_info.json"
  153. - name: Set Environment variables for Cura (bash)
  154. if: ${{ runner.os != 'Windows' }}
  155. run: |
  156. . ./cura_inst/bin/activate_github_actions_env.sh
  157. . ./cura_inst/bin/activate_github_actions_version_env.sh
  158. - name: Set Environment variables for Cura (Powershell)
  159. if: ${{ runner.os == 'Windows' }}
  160. run: |
  161. .\cura_inst\Scripts\activate_github_actions_env.ps1
  162. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  163. - name: Unlock Macos keychain (Bash)
  164. if: ${{ runner.os == 'Macos' }}
  165. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  166. env:
  167. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  168. # FIXME: This is a workaround to ensure that we use and pack a shared library for OpenSSL 1.1.1l. We currently compile
  169. # OpenSSL statically for CPython, but our Python Dependenies (such as PyQt6) require a shared library.
  170. # Because Conan won't allow for building the same library with two different options (easily) we need to install it explicitly
  171. # and do a manual copy to the VirtualEnv, such that Pyinstaller can find it.
  172. - name: Install OpenSSL shared
  173. run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy
  174. - name: Copy OpenSSL shared (Bash)
  175. if: ${{ runner.os != 'Windows' }}
  176. run: |
  177. cp ./openssl/lib/*.so* ./cura_inst/bin/ || true
  178. cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true
  179. - name: Copy OpenSSL shared (Powershell)
  180. if: ${{ runner.os == 'Windows' }}
  181. run: |
  182. cp openssl/bin/*.dll ./cura_inst/Scripts/
  183. cp openssl/lib/*.lib ./cura_inst/Lib/
  184. - name: Create the Cura dist
  185. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  186. - name: Archive the artifacts (bash)
  187. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  188. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.tar.gz" "./Ultimaker-Cura/"
  189. working-directory: dist
  190. - name: Archive the artifacts (Powershell)
  191. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  192. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.zip"
  193. working-directory: dist
  194. - name: Create the Windows exe installer (Powershell)
  195. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  196. run: |
  197. python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.exe"
  198. working-directory: dist
  199. - name: Create the Linux AppImage (Bash)
  200. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  201. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL "Ultimaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.AppImage"
  202. working-directory: dist
  203. - name: Create the MacOS dmg (Bash)
  204. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  205. run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "Ultimaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.dmg"
  206. working-directory: dist
  207. - name: Upload the artifacts
  208. uses: actions/upload-artifact@v3
  209. with:
  210. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ inputs.os_name }}
  211. path: |
  212. dist/*.tar.gz
  213. dist/*.zip
  214. dist/*.exe
  215. dist/*.msi
  216. dist/*.dmg
  217. dist/*.AppImage
  218. dist/*.asc
  219. retention-days: 5
  220. notify-export:
  221. if: ${{ always() }}
  222. needs: [ cura-installer-create ]
  223. uses: ultimaker/cura/.github/workflows/notify.yml@main
  224. with:
  225. success: ${{ contains(join(needs.*.result, ','), 'success') }}
  226. success_title: "Create the Cura distributions"
  227. success_body: "Installers for ${{ inputs.cura_conan_version }}"
  228. failure_title: "Failed to create the Cura distributions"
  229. failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}"
  230. secrets: inherit