cura-installer.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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_config:
  11. description: 'Conan config branch to use'
  12. default: ''
  13. required: false
  14. enterprise:
  15. description: 'Build Cura as an Enterprise edition'
  16. required: true
  17. default: false
  18. type: boolean
  19. staging:
  20. description: 'Use staging API'
  21. required: true
  22. default: false
  23. type: boolean
  24. installer:
  25. description: 'Create the installer'
  26. required: true
  27. default: false
  28. type: boolean
  29. # Run the nightly at 5:25 UTC on working days
  30. schedule:
  31. - cron: '25 3 * * 1-5'
  32. env:
  33. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  34. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  35. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  36. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  37. CONAN_LOG_RUN_TO_OUTPUT: 1
  38. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  39. CONAN_NON_INTERACTIVE: 1
  40. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  41. MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }}
  42. MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }}
  43. MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
  44. MACOS_CERT_PASS: ${{ secrets.MACOS_CERT_PASS }}
  45. MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }}
  46. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  47. MACOS_CERT_PASSPHRASE: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  48. jobs:
  49. cura-installer-create:
  50. runs-on: ${{ matrix.os }}
  51. strategy:
  52. fail-fast: false
  53. matrix:
  54. os: [ macos-10.15, windows-2022, ubuntu-20.04 ]
  55. steps:
  56. - name: Checkout
  57. uses: actions/checkout@v3
  58. - name: Setup Python and pip
  59. uses: actions/setup-python@v4
  60. with:
  61. python-version: '3.10.x'
  62. cache: 'pip'
  63. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  64. - name: Install Python requirements and Create default Conan profile
  65. run: |
  66. pip install -r .github/workflows/requirements-conan-package.txt
  67. conan profile new default --detect
  68. - name: Use Conan download cache (Bash)
  69. if: ${{ runner.os != 'Windows' }}
  70. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  71. - name: Use Conan download cache (Powershell)
  72. if: ${{ runner.os == 'Windows' }}
  73. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  74. - name: Cache Conan local repository packages (Bash)
  75. uses: actions/cache@v3
  76. if: ${{ runner.os != 'Windows' }}
  77. with:
  78. path: |
  79. $HOME/.conan/data
  80. $HOME/.conan/conan_download_cache
  81. key: conan-${{ runner.os }}-${{ runner.arch }}
  82. - name: Cache Conan local repository packages (Powershell)
  83. uses: actions/cache@v3
  84. if: ${{ runner.os == 'Windows' }}
  85. with:
  86. path: |
  87. C:\Users\runneradmin\.conan\data
  88. C:\.conan
  89. C:\Users\runneradmin\.conan\conan_download_cache
  90. key: conan-${{ runner.os }}-${{ runner.arch }}
  91. - name: Install MacOS system requirements
  92. if: ${{ runner.os == 'Macos' }}
  93. run: brew install autoconf automake ninja create-dmg
  94. - name: Install Linux system requirements
  95. if: ${{ runner.os == 'Linux' }}
  96. run: |
  97. sudo apt install build-essential checkinstall 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 -y
  98. wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool
  99. chmod +x $GITHUB_WORKSPACE/appimagetool
  100. echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV
  101. - name: Configure GPG Key Linux (Bash)
  102. if: ${{ runner.os == 'Linux' }}
  103. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  104. - name: Configure Macos keychain (Bash)
  105. id: macos-keychain
  106. if: ${{ runner.os == 'Macos' }}
  107. uses: apple-actions/import-codesign-certs@v1
  108. with:
  109. p12-file-base64: ${{ secrets.MACOS_CERT_P12 }}
  110. p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  111. - name: Unlock Macos keychain (Bash)
  112. if: ${{ runner.os == 'Macos' }}
  113. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  114. env:
  115. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  116. - name: Clean Conan local cache
  117. if: ${{ inputs.conan_clean_local_cache }}
  118. run: conan remove "*" -f
  119. - name: Get Conan configuration from branch
  120. if: ${{ inputs.conan_config_branch != '' }}
  121. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  122. - name: Get Conan configuration
  123. if: ${{ inputs.conan_config_branch == '' }}
  124. run: conan config install https://github.com/Ultimaker/conan-config.git
  125. - name: Create the Packages
  126. run: conan install ${{ inputs.cura_conan_version }} --build=missing --update -c tools.env.virtualenv:powershell=True -if cura_inst -g VirtualPythonEnv -o cura:enterprise=${{ inputs.enterprise }} -o cura:staging=${{ inputs.staging }}
  127. - name: Set Environment variables for Cura (bash)
  128. if: ${{ runner.os != 'Windows' }}
  129. run: |
  130. . ./cura_inst/bin/activate_github_actions_env.sh
  131. . ./cura_inst/bin/activate_github_actions_version_env.sh
  132. - name: Set Environment variables for Cura (Powershell)
  133. if: ${{ runner.os == 'Windows' }}
  134. run: |
  135. .\cura_inst\Scripts\activate_github_actions_env.ps1
  136. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  137. - name: Create the Cura dist
  138. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  139. - name: Archive the artifacts (bash)
  140. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  141. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/"
  142. working-directory: dist
  143. - name: Archive the artifacts (Powershell)
  144. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  145. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.zip"
  146. working-directory: dist
  147. - name: Create the Windows exe installer (Powershell)
  148. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  149. run: |
  150. python ..\cura_inst\packaging\NSIS\nsis-configurator.py ".\Ultimaker-Cura" "..\cura_inst\packaging\NSIS\Ultimaker-Cura.nsi.jinja" "Ultimaker Cura" "Ultimaker-Cura.exe" "$Env:CURA_VERSION_MAJOR" "$Env:CURA_VERSION_MINOR" "$Env:CURA_VERSION_PATCH" "$Env:CURA_VERSION_BUILD" "Ultimaker B.V." "https://ultimaker.com" "..\cura_inst\packaging\cura_license.txt" "LZMA" "..\cura_inst\packaging\NSIS\cura_banner_nsis.bmp" "..\cura_inst\packaging\icons\Cura.ico" "Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.exe"
  151. makensis /V2 /P4 Ultimaker-Cura.nsi
  152. working-directory: dist
  153. - name: Create the Linux AppImage (Bash)
  154. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  155. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL
  156. working-directory: dist
  157. - name: Create the MacOS dmg (Bash) alternative
  158. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  159. run: create-dmg --window-pos 640 360 --volicon "../cura_inst/packaging/icons/VolumeIcons_Cura.icns" --window-size 690 503 --icon-size 90 --icon "Ultimaker-Cura.app" 169 272 --app-drop-link 520 272 --eula "../cura_inst/packaging/cura_license.txt" --background "../cura_inst/packaging/icons/cura_background_dmg.png" "./Ultimaker-Cura.dmg" "./Ultimaker-Cura.app"
  160. working-directory: dist
  161. - name: Sign the MacOS dmg (Bash) alternative
  162. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  163. run: codesign -s "$CODESIGN_IDENTITY" --timestamp -i "nl.ultimaker.cura.dmg" "./Ultimaker-Cura.dmg"
  164. working-directory: dist
  165. - name: Notarize the MacOS dmg (Bash) alternative
  166. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  167. run: xcrun altool --notarize-app --primary-bundle-id "nl.ultimaker.cura" --username "$MAC_NOTARIZE_USER" --password "$MAC_NOTARIZE_PASS" --file "./Ultimaker-Cura.dmg"
  168. working-directory: dist
  169. # - name: Create the MacOS dmg (Bash)
  170. # if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  171. # run: python ../cura_inst/packaging/dmg/dmg_sign_notarize.py
  172. # working-directory: dist
  173. # env:
  174. # SOURCE_DIR: ${{ env.GITHUB_WORKSPACE }}/cura_inst
  175. # DIST_DIR: ${{ env.GITHUB_WORKSPACE }}/dist
  176. - name: Upload the artifacts
  177. uses: actions/upload-artifact@v3
  178. with:
  179. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ runner.os }}-${{ runner.arch }}
  180. path: |
  181. dist/*.tar.gz
  182. dist/*.zip
  183. dist/*.exe
  184. dist/*.msi
  185. dist/*.dmg
  186. dist/*.AppImage
  187. dist/*.asc
  188. retention-days: 2