cura-installer.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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-10.15, os_id: 'MacOS' }
  60. - { os: windows-2022, os_id: 'Windows' }
  61. - { os: ubuntu-20.04, os_id: 'Linux' }
  62. - { os: ubuntu-22.04, os_id: 'Linux-latest' }
  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 and Create default Conan profile
  73. run: |
  74. pip install -r .github/workflows/requirements-conan-package.txt
  75. conan profile new default --detect
  76. - name: Use Conan download cache (Bash)
  77. if: ${{ runner.os != 'Windows' }}
  78. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  79. - name: Use Conan download cache (Powershell)
  80. if: ${{ runner.os == 'Windows' }}
  81. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  82. - name: Cache Conan local repository packages (Bash)
  83. uses: actions/cache@v3
  84. if: ${{ runner.os != 'Windows' }}
  85. with:
  86. path: |
  87. $HOME/.conan/data
  88. $HOME/.conan/conan_download_cache
  89. key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache
  90. - name: Cache Conan local repository packages (Powershell)
  91. uses: actions/cache@v3
  92. if: ${{ runner.os == 'Windows' }}
  93. with:
  94. path: |
  95. C:\Users\runneradmin\.conan\data
  96. C:\.conan
  97. C:\Users\runneradmin\.conan\conan_download_cache
  98. key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache
  99. - name: Install MacOS system requirements
  100. if: ${{ runner.os == 'Macos' }}
  101. run: brew install autoconf automake ninja create-dmg
  102. - name: Install Linux system requirements
  103. if: ${{ runner.os == 'Linux' }}
  104. run: |
  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 xdg-desktop-portal-gtk xdg-desktop-portal-kde -y
  106. wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool
  107. chmod +x $GITHUB_WORKSPACE/appimagetool
  108. echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV
  109. - name: Configure GPG Key Linux (Bash)
  110. if: ${{ runner.os == 'Linux' }}
  111. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  112. - name: Configure Macos keychain (Bash)
  113. id: macos-keychain
  114. if: ${{ runner.os == 'Macos' }}
  115. uses: apple-actions/import-codesign-certs@v1
  116. with:
  117. p12-file-base64: ${{ secrets.MACOS_CERT_P12 }}
  118. p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  119. - name: Clean Conan local cache
  120. if: ${{ inputs.conan_clean_local_cache }}
  121. run: conan remove "*" -f
  122. - name: Get Conan configuration from branch
  123. if: ${{ inputs.conan_config_branch != '' }}
  124. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  125. - name: Get Conan configuration
  126. if: ${{ inputs.conan_config_branch == '' }}
  127. run: conan config install https://github.com/Ultimaker/conan-config.git
  128. - name: Create the Packages
  129. 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"
  130. - name: Set Environment variables for Cura (bash)
  131. if: ${{ runner.os != 'Windows' }}
  132. run: |
  133. . ./cura_inst/bin/activate_github_actions_env.sh
  134. . ./cura_inst/bin/activate_github_actions_version_env.sh
  135. - name: Set Environment variables for Cura (Powershell)
  136. if: ${{ runner.os == 'Windows' }}
  137. run: |
  138. .\cura_inst\Scripts\activate_github_actions_env.ps1
  139. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  140. - name: Unlock Macos keychain (Bash)
  141. if: ${{ runner.os == 'Macos' }}
  142. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  143. env:
  144. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  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. if: ${{ runner.os != 'Windows' }}
  153. run: |
  154. cp ./openssl/lib/*.so* ./cura_inst/bin/ || true
  155. cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true
  156. - name: Copy OpenSSL shared (Powershell)
  157. if: ${{ runner.os == 'Windows' }}
  158. run: |
  159. cp openssl/bin/*.dll ./cura_inst/Scripts/
  160. cp openssl/lib/*.lib ./cura_inst/Lib/
  161. - name: Create the Cura dist
  162. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  163. - name: Archive the artifacts (bash)
  164. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  165. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/"
  166. working-directory: dist
  167. - name: Archive the artifacts (Powershell)
  168. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  169. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ matrix.os_id }}-${{ runner.arch }}.zip"
  170. working-directory: dist
  171. - name: Create the Windows exe installer (Powershell)
  172. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  173. run: |
  174. python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ matrix.os_id }}-${{ runner.arch }}.exe"
  175. working-directory: dist
  176. - name: Create the Linux AppImage (Bash)
  177. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  178. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL "Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}-${{ runner.arch }}.AppImage"
  179. working-directory: dist
  180. - name: Create the MacOS dmg (Bash)
  181. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  182. run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "Ultimaker-Cura-$CURA_VERSION_FULL-${{ matrix.os_id }}-${{ runner.arch }}.dmg"
  183. working-directory: dist
  184. - name: Upload the artifacts
  185. uses: actions/upload-artifact@v3
  186. with:
  187. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ matrix.os_id }}-${{ runner.arch }}
  188. path: |
  189. dist/*.tar.gz
  190. dist/*.zip
  191. dist/*.exe
  192. dist/*.msi
  193. dist/*.dmg
  194. dist/*.AppImage
  195. dist/*.asc
  196. retention-days: 2
  197. notify-export:
  198. if: ${{ always() }}
  199. needs: [ cura-installer-create ]
  200. uses: ultimaker/cura/.github/workflows/notify.yml@main
  201. with:
  202. success: ${{ contains(join(needs.*.result, ','), 'success') }}
  203. success_title: "Create the Cura distributions"
  204. success_body: "Installers for ${{ inputs.cura_conan_version }}"
  205. failure_title: "Failed to create the Cura distributions"
  206. failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}"
  207. secrets: inherit