cura-installer.yml 9.9 KB

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