cura-installer.yml 13 KB

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