cura-installer.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 libxkbcommon-x11-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: Clean Conan local cache
  113. if: ${{ inputs.conan_clean_local_cache }}
  114. run: conan remove "*" -f
  115. - name: Get Conan configuration from branch
  116. if: ${{ inputs.conan_config_branch != '' }}
  117. run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
  118. - name: Get Conan configuration
  119. if: ${{ inputs.conan_config_branch == '' }}
  120. run: conan config install https://github.com/Ultimaker/conan-config.git
  121. - name: Create the Packages
  122. run: conan install ${{ inputs.cura_conan_version }} --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"
  123. - name: Set Environment variables for Cura (bash)
  124. if: ${{ runner.os != 'Windows' }}
  125. run: |
  126. . ./cura_inst/bin/activate_github_actions_env.sh
  127. . ./cura_inst/bin/activate_github_actions_version_env.sh
  128. - name: Set Environment variables for Cura (Powershell)
  129. if: ${{ runner.os == 'Windows' }}
  130. run: |
  131. .\cura_inst\Scripts\activate_github_actions_env.ps1
  132. .\cura_inst\Scripts\activate_github_actions_version_env.ps1
  133. - name: Unlock Macos keychain (Bash)
  134. if: ${{ runner.os == 'Macos' }}
  135. run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain
  136. env:
  137. TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain.outputs.keychain-password }}
  138. - name: Create the Cura dist
  139. run: pyinstaller ./cura_inst/Ultimaker-Cura.spec
  140. - name: Archive the artifacts (bash)
  141. if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }}
  142. run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/"
  143. working-directory: dist
  144. - name: Archive the artifacts (Powershell)
  145. if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }}
  146. run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.zip"
  147. working-directory: dist
  148. - name: Create the Windows exe installer (Powershell)
  149. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }}
  150. run: |
  151. 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"
  152. makensis /V2 /P4 Ultimaker-Cura.nsi
  153. working-directory: dist
  154. - name: Create the Linux AppImage (Bash)
  155. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }}
  156. run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL "Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.AppImage"
  157. working-directory: dist
  158. - name: Create the MacOS dmg (Bash)
  159. if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
  160. run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.dmg"
  161. working-directory: dist
  162. - name: Upload the artifacts
  163. uses: actions/upload-artifact@v3
  164. with:
  165. name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ runner.os }}-${{ runner.arch }}
  166. path: |
  167. dist/*.tar.gz
  168. dist/*.zip
  169. dist/*.exe
  170. dist/*.msi
  171. dist/*.dmg
  172. dist/*.AppImage
  173. dist/*.asc
  174. retention-days: 2