cura-installer.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. name: Cura Installer
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. cura_conan_version:
  6. description: 'Cura Conan Version'
  7. default: 'cura/latest@ultimaker/testing'
  8. required: true
  9. conan_args:
  10. description: 'Conan args: eq.: --require-override'
  11. default: ''
  12. required: false
  13. conan_config:
  14. description: 'Conan config branch to use'
  15. default: ''
  16. required: false
  17. enterprise:
  18. description: 'Build Cura as an Enterprise edition'
  19. required: true
  20. default: false
  21. type: boolean
  22. staging:
  23. description: 'Use staging API'
  24. required: true
  25. default: false
  26. type: boolean
  27. installer:
  28. description: 'Create the installer'
  29. required: true
  30. default: false
  31. type: boolean
  32. # Run the nightly at 3:25 UTC on working days
  33. #FIXME: Provide the same default values as the workflow dispatch
  34. schedule:
  35. - cron: '25 3 * * 1-5'
  36. env:
  37. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  38. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  39. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  40. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  41. CONAN_LOG_RUN_TO_OUTPUT: 1
  42. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  43. CONAN_NON_INTERACTIVE: 1
  44. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  45. MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }}
  46. MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }}
  47. MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
  48. MACOS_CERT_PASS: ${{ secrets.MACOS_CERT_PASS }}
  49. MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }}
  50. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  51. MACOS_CERT_PASSPHRASE: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  52. jobs:
  53. cura-installer-create:
  54. runs-on: ${{ matrix.os }}
  55. strategy:
  56. fail-fast: false
  57. matrix:
  58. include:
  59. - { os: macos-11, os_id: 'mac' }
  60. - { os: windows-2022, os_id: 'win64' }
  61. - { os: ubuntu-20.04, os_id: 'linux' }
  62. - { os: ubuntu-22.04, os_id: 'linux-modern' }
  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: ${{ matrix.os == '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: Create the default Conan profile
  117. run: conan profile new default --detect
  118. - name: Configure GPG Key Linux (Bash)
  119. if: ${{ runner.os == 'Linux' }}
  120. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  121. - name: Configure Macos keychain (Bash)
  122. id: macos-keychain
  123. if: ${{ runner.os == 'Macos' }}
  124. uses: apple-actions/import-codesign-certs@v1
  125. with:
  126. p12-file-base64: ${{ secrets.MACOS_CERT_P12 }}
  127. p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  128. - name: Clean Conan local cache
  129. if: ${{ inputs.conan_clean_local_cache }}
  130. run: conan remove "*" -f
  131. - name: Get Conan configuration from branch
  132. if: ${{ inputs.conan_config_branch != '' }}
  133. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  134. - name: Get Conan configuration
  135. if: ${{ inputs.conan_config_branch == '' }}
  136. run: conan config install https://github.com/Ultimaker/conan-config.git
  137. - name: Create the Packages
  138. run: conan install ${{ inputs.cura_conan_version }} ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=${{ inputs.enterprise }} -o cura:staging=${{ inputs.staging }} --json "cura_inst/conan_install_info.json"
  139. - name: Set Environment variables for Cura (bash)
  140. if: ${{ runner.os != 'Windows' }}
  141. run: |
  142. . ./cura_inst/bin/activate_github_actions_env.sh
  143. . ./cura_inst/bin/activate_github_actions_version_env.sh
  144. - name: Set Environment variables for Cura (Powershell)
  145. if: ${{ runner.os == 'Windows' }}
  146. run: |
  147. .\cura_inst\Scripts\activate_github_actions_env.ps1
  148. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  149. - name: Unlock Macos keychain (Bash)
  150. if: ${{ runner.os == 'Macos' }}
  151. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  152. env:
  153. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  154. # FIXME: This is a workaround to ensure that we use and pack a shared library for OpenSSL 1.1.1l. We currently compile
  155. # OpenSSL statically for CPython, but our Python Dependenies (such as PyQt6) require a shared library.
  156. # Because Conan won't allow for building the same library with two different options (easily) we need to install it explicitly
  157. # and do a manual copy to the VirtualEnv, such that Pyinstaller can find it.
  158. - name: Install OpenSSL shared
  159. run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy
  160. - name: Copy OpenSSL shared (Bash)
  161. if: ${{ runner.os != 'Windows' }}
  162. run: |
  163. cp ./openssl/lib/*.so* ./cura_inst/bin/ || true
  164. cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true
  165. - name: Copy OpenSSL shared (Powershell)
  166. if: ${{ runner.os == 'Windows' }}
  167. run: |
  168. cp openssl/bin/*.dll ./cura_inst/Scripts/
  169. cp openssl/lib/*.lib ./cura_inst/Lib/
  170. - name: Create the Cura dist
  171. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  172. - name: Archive the artifacts (bash)
  173. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  174. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}.tar.gz" "./Ultimaker-Cura/"
  175. working-directory: dist
  176. - name: Archive the artifacts (Powershell)
  177. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  178. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ matrix.os_id }}.zip"
  179. working-directory: dist
  180. - name: Create the Windows exe installer (Powershell)
  181. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  182. run: |
  183. python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ matrix.os_id }}.exe"
  184. working-directory: dist
  185. - name: Create the Linux AppImage (Bash)
  186. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  187. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL "Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}.AppImage"
  188. working-directory: dist
  189. - name: Create the MacOS dmg (Bash)
  190. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  191. run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}.dmg"
  192. working-directory: dist
  193. - name: Upload the artifacts
  194. uses: actions/upload-artifact@v3
  195. with:
  196. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ matrix.os_id }}
  197. path: |
  198. dist/*.tar.gz
  199. dist/*.zip
  200. dist/*.exe
  201. dist/*.msi
  202. dist/*.dmg
  203. dist/*.AppImage
  204. dist/*.asc
  205. retention-days: 5
  206. notify-export:
  207. if: ${{ always() }}
  208. needs: [ cura-installer-create ]
  209. uses: ultimaker/cura/.github/workflows/notify.yml@main
  210. with:
  211. success: ${{ contains(join(needs.*.result, ','), 'success') }}
  212. success_title: "Create the Cura distributions"
  213. success_body: "Installers for ${{ inputs.cura_conan_version }}"
  214. failure_title: "Failed to create the Cura distributions"
  215. failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}"
  216. secrets: inherit