cura-installer.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 3:25 UTC on working days
  30. #FIXME: Provide the same default values as the workflow dispatch
  31. schedule:
  32. - cron: '25 3 * * 1-5'
  33. env:
  34. CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
  35. CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
  36. CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
  37. CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
  38. CONAN_LOG_RUN_TO_OUTPUT: 1
  39. CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
  40. CONAN_NON_INTERACTIVE: 1
  41. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  42. MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }}
  43. MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }}
  44. MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
  45. MACOS_CERT_PASS: ${{ secrets.MACOS_CERT_PASS }}
  46. MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }}
  47. GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
  48. MACOS_CERT_PASSPHRASE: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  49. jobs:
  50. cura-installer-create:
  51. runs-on: ${{ matrix.os }}
  52. strategy:
  53. fail-fast: false
  54. matrix:
  55. os: [ macos-10.15, windows-2022, ubuntu-20.04 ]
  56. steps:
  57. - name: Checkout
  58. uses: actions/checkout@v3
  59. - name: Setup Python and pip
  60. uses: actions/setup-python@v4
  61. with:
  62. python-version: '3.10.x'
  63. cache: 'pip'
  64. cache-dependency-path: .github/workflows/requirements-conan-package.txt
  65. - name: Install Python requirements and Create default Conan profile
  66. run: |
  67. pip install -r .github/workflows/requirements-conan-package.txt
  68. conan profile new default --detect
  69. - name: Use Conan download cache (Bash)
  70. if: ${{ runner.os != 'Windows' }}
  71. run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
  72. - name: Use Conan download cache (Powershell)
  73. if: ${{ runner.os == 'Windows' }}
  74. run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
  75. - name: Cache Conan local repository packages (Bash)
  76. uses: actions/cache@v3
  77. if: ${{ runner.os != 'Windows' }}
  78. with:
  79. path: |
  80. $HOME/.conan/data
  81. $HOME/.conan/conan_download_cache
  82. key: conan-${{ runner.os }}-${{ runner.arch }}
  83. - name: Cache Conan local repository packages (Powershell)
  84. uses: actions/cache@v3
  85. if: ${{ runner.os == 'Windows' }}
  86. with:
  87. path: |
  88. C:\Users\runneradmin\.conan\data
  89. C:\.conan
  90. C:\Users\runneradmin\.conan\conan_download_cache
  91. key: conan-${{ runner.os }}-${{ runner.arch }}
  92. - name: Install MacOS system requirements
  93. if: ${{ runner.os == 'Macos' }}
  94. run: brew install autoconf automake ninja create-dmg
  95. - name: Install Linux system requirements
  96. if: ${{ runner.os == 'Linux' }}
  97. run: |
  98. 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
  99. wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool
  100. chmod +x $GITHUB_WORKSPACE/appimagetool
  101. echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV
  102. - name: Configure GPG Key Linux (Bash)
  103. if: ${{ runner.os == 'Linux' }}
  104. run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import
  105. - name: Configure Macos keychain (Bash)
  106. id: macos-keychain
  107. if: ${{ runner.os == 'Macos' }}
  108. uses: apple-actions/import-codesign-certs@v1
  109. with:
  110. p12-file-base64: ${{ secrets.MACOS_CERT_P12 }}
  111. p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }}
  112. - name: Output security response
  113. if: ${{ runner.os == 'Macos' }}
  114. run: echo $security-response
  115. env:
  116. SECURITY_RESPONSE: ${{ steps.macos-keychain.outputs.security-response }}
  117. - name: Unlock Macos keychain (Bash)
  118. if: ${{ runner.os == 'Macos' }}
  119. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  120. env:
  121. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  122. - name: Clean Conan local cache
  123. if: ${{ inputs.conan_clean_local_cache }}
  124. run: conan remove "*" -f
  125. - name: Get Conan configuration from branch
  126. if: ${{ inputs.conan_config_branch != '' }}
  127. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  128. - name: Get Conan configuration
  129. if: ${{ inputs.conan_config_branch == '' }}
  130. run: conan config install https://github.com/Ultimaker/conan-config.git
  131. - name: Create the Packages
  132. 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 }}
  133. - name: Set Environment variables for Cura (bash)
  134. if: ${{ runner.os != 'Windows' }}
  135. run: |
  136. . ./cura_inst/bin/activate_github_actions_env.sh
  137. . ./cura_inst/bin/activate_github_actions_version_env.sh
  138. - name: Set Environment variables for Cura (Powershell)
  139. if: ${{ runner.os == 'Windows' }}
  140. run: |
  141. .\cura_inst\Scripts\activate_github_actions_env.ps1
  142. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  143. - name: Create the Cura dist
  144. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  145. - name: Archive the artifacts (bash)
  146. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  147. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/"
  148. working-directory: dist
  149. - name: Archive the artifacts (Powershell)
  150. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  151. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.zip"
  152. working-directory: dist
  153. - name: Create the Windows exe installer (Powershell)
  154. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  155. run: |
  156. 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"
  157. makensis /V2 /P4 Ultimaker-Cura.nsi
  158. working-directory: dist
  159. - name: Create the Linux AppImage (Bash)
  160. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  161. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL
  162. working-directory: dist
  163. - name: Create the MacOS dmg (Bash)
  164. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  165. run: python ../cura_inst/packaging/dmg/dmg_sign_notarize.py
  166. working-directory: dist
  167. env:
  168. SOURCE_DIR: ${{ env.GITHUB_WORKSPACE }}/cura_inst
  169. DIST_DIR: ${{ env.GITHUB_WORKSPACE }}/dist
  170. - name: Upload the artifacts
  171. uses: actions/upload-artifact@v3
  172. with:
  173. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ runner.os }}-${{ runner.arch }}
  174. path: |
  175. dist/*.tar.gz
  176. dist/*.zip
  177. dist/*.exe
  178. dist/*.msi
  179. dist/*.dmg
  180. dist/*.AppImage
  181. dist/*.asc
  182. retention-days: 2