cura-installer.yml 12 KB

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