From c8f393f78580247ac44ab5612f4d5c7c67d46d92 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 08:22:27 +0200 Subject: [PATCH 01/31] Specify runner for each installer workflow Contributes to CURA-10855 --- .github/workflows/cura-all-installers.yml | 6 ++++++ .github/workflows/cura-installer.yml | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cura-all-installers.yml b/.github/workflows/cura-all-installers.yml index 4729c4198a..96071756fe 100644 --- a/.github/workflows/cura-all-installers.yml +++ b/.github/workflows/cura-all-installers.yml @@ -64,6 +64,7 @@ jobs: if: ${{ inputs.build_windows_exe }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'windows-2022' platform: 'windows-2022' os_name: 'win64' cura_conan_version: ${{ inputs.cura_conan_version }} @@ -79,6 +80,7 @@ jobs: if: ${{ inputs.build_windows_msi }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'windows-2022' platform: 'windows-2022' os_name: 'win64' cura_conan_version: ${{ inputs.cura_conan_version }} @@ -94,6 +96,7 @@ jobs: if: ${{ inputs.build_linux }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'ubuntu-20.04' platform: 'ubuntu-20.04' os_name: 'linux' cura_conan_version: ${{ inputs.cura_conan_version }} @@ -109,6 +112,7 @@ jobs: if: ${{ inputs.build_linux }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'ubuntu-22.04' platform: 'ubuntu-22.04' os_name: 'linux-modern' cura_conan_version: ${{ inputs.cura_conan_version }} @@ -124,6 +128,7 @@ jobs: if: ${{ inputs.build_macos }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'self-hosted' platform: 'macos-11' os_name: 'mac' cura_conan_version: ${{ inputs.cura_conan_version }} @@ -139,6 +144,7 @@ jobs: if: ${{ inputs.build_macos }} uses: ./.github/workflows/cura-installer.yml with: + runner: 'self-hosted' platform: 'macos-11' os_name: 'mac' cura_conan_version: ${{ inputs.cura_conan_version }} diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index 9572b31aee..ea71fc83dc 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -4,6 +4,11 @@ run-name: ${{ inputs.cura_conan_version }} for ${{ inputs.platform }} by @${{ gi on: workflow_call: inputs: + runner: + description: 'Selected runner' + default: 'ubuntu-20.04' + required: true + type: string platform: description: 'Selected Installer OS' default: 'ubuntu-20.04' @@ -74,7 +79,7 @@ env: jobs: cura-installer-create: - runs-on: ${{ inputs.platform }} + runs-on: ${{ inputs.runner }} steps: - name: Checkout From bcdd7c9ed32a4c4a5eb05c4feaf329354410934b Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 11:43:04 +0200 Subject: [PATCH 02/31] keychain is persistent If we ever need to start from scratch, temporarily remove `&& inputs.runner != 'self-hosted'` Contributes to CURA-8415 --- .github/workflows/cura-installer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index ac5a8ee921..0fa95d5364 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -168,7 +168,7 @@ jobs: - name: Configure Macos keychain Developer Cert(Bash) id: macos-keychain-developer-cert - if: ${{ runner.os == 'Macos' }} + if: ${{ runner.os == 'Macos' && inputs.runner != 'self-hosted' }} # will be installed on the first-run, if reinitializing the keychain is needed, set to true uses: apple-actions/import-codesign-certs@v1 with: keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} @@ -177,7 +177,7 @@ jobs: - name: Configure Macos keychain Installer Cert (Bash) id: macos-keychain-installer-cert - if: ${{ runner.os == 'Macos' }} + if: ${{ runner.os == 'Macos' && inputs.runner != 'self-hosted' }} # will be installed on the first-run, if reinitializing the keychain is needed, set to true uses: apple-actions/import-codesign-certs@v1 with: keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} From c894ffe93454b97b77dd1a8d23c03fb9d7639491 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 12:41:44 +0200 Subject: [PATCH 03/31] Revert "keychain is persistent" This reverts commit bcdd7c9ed32a4c4a5eb05c4feaf329354410934b. --- .github/workflows/cura-installer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index 0fa95d5364..ac5a8ee921 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -168,7 +168,7 @@ jobs: - name: Configure Macos keychain Developer Cert(Bash) id: macos-keychain-developer-cert - if: ${{ runner.os == 'Macos' && inputs.runner != 'self-hosted' }} # will be installed on the first-run, if reinitializing the keychain is needed, set to true + if: ${{ runner.os == 'Macos' }} uses: apple-actions/import-codesign-certs@v1 with: keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} @@ -177,7 +177,7 @@ jobs: - name: Configure Macos keychain Installer Cert (Bash) id: macos-keychain-installer-cert - if: ${{ runner.os == 'Macos' && inputs.runner != 'self-hosted' }} # will be installed on the first-run, if reinitializing the keychain is needed, set to true + if: ${{ runner.os == 'Macos' }} uses: apple-actions/import-codesign-certs@v1 with: keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} From 13fdb9499e88327303d283a9daa9395711352b7e Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 13:13:41 +0200 Subject: [PATCH 04/31] Ensure that signing_temp.keychain has been removed Contributes to CURA-8415 --- .github/workflows/cura-installer.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index ac5a8ee921..a790f0bc95 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -166,6 +166,10 @@ jobs: if: ${{ runner.os == 'Linux' }} run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import + - name: Remove Macos keychain (Bash) + if: ${{ runner.os == 'Macos' && inputs.runner == 'self-hosted' }} + run: security delete-keychain signing_temp.keychain || true + - name: Configure Macos keychain Developer Cert(Bash) id: macos-keychain-developer-cert if: ${{ runner.os == 'Macos' }} From 23c407150c79e9726c427a26f8c7880272a85521 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 20:12:45 +0200 Subject: [PATCH 05/31] Specifify arch in filename Contributes to CURA-8415 --- .github/workflows/cura-installer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index a790f0bc95..4b4df0a5bd 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -264,7 +264,7 @@ jobs: run: | import os enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" - installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-${{ inputs.os_name }}" + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-${{ inputs.os_name }}-${{ inputs.arch }}" if "${{ runner.os }}" == "Windows": installer_ext = "msi" if "${{ inputs.msi_installer }}" == "true" else "exe" elif "${{ runner.os }}" == "macOS": From 5a12ad2a7148482168f89116af93b18af12d951d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 20:13:49 +0200 Subject: [PATCH 06/31] Allow the build_macos script to build both dmg/pkg on the same runner Why should we build the installer twice? Contributes to CURA-8415 --- packaging/MacOS/build_macos.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index dcde629900..bea248b324 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -21,6 +21,7 @@ def build_dmg(source_path: str, dist_path: str, filename: str, app_name: str) -> "--icon", app_name, "169", "272", "--eula", f"{source_path}/packaging/cura_license.txt", "--background", f"{source_path}/packaging/MacOs/cura_background_dmg.png", + "--hdiutil-quiet", f"{dist_path}/{filename}", f"{dist_path}/{app_name}"] @@ -141,7 +142,9 @@ if __name__ == "__main__": parser.add_argument("source_path", type = str, help = "Path to Pyinstaller source folder") parser.add_argument("dist_path", type = str, help = "Path to Pyinstaller dist folder") parser.add_argument("cura_conan_version", type = str, help="The version of cura") - parser.add_argument("filename", type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64.pkg' or 'UltiMaker-Cura-5.1.0-beta-Macos-X64.dmg')") + parser.add_argument("filename", type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64' or 'UltiMaker-Cura-5.1.0-beta-Macos-X64')") + parser.add_argument("build_pkg", type = bool, default = False, help = "build the pkg") + parser.add_argument("build_dmg", type = bool, default = True, help = "build the dmg") parser.add_argument("app_name", type = str, help = "Filename of the .app that will be contained within the dmg/pkg") args = parser.parse_args() @@ -149,7 +152,7 @@ if __name__ == "__main__": app_name = f"{args.app_name}.app" - if Path(args.filename).suffix == ".pkg": - create_pkg_installer(args.filename, args.dist_path, cura_version, app_name) - else: - create_dmg(args.filename, args.dist_path, args.source_path, app_name) + if args.build_pkg: + create_pkg_installer(args.filename + ".pkg", args.dist_path, cura_version, app_name) + if args.build_dmg: + create_dmg(args.filename + ".dmg", args.dist_path, args.source_path, app_name) From 7a8fe8330ac5bdbb2dbed6a0ddaf9daa7bcf285a Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 20:48:15 +0200 Subject: [PATCH 07/31] Use named arguments Contributes to CURA-8415 --- packaging/MacOS/build_macos.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index bea248b324..8382cac27a 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -139,13 +139,13 @@ def create_dmg(filename: str, dist_path: str, source_path: str, app_name: str) - if __name__ == "__main__": parser = argparse.ArgumentParser(description = "Create installer for Cura.") - parser.add_argument("source_path", type = str, help = "Path to Pyinstaller source folder") - parser.add_argument("dist_path", type = str, help = "Path to Pyinstaller dist folder") - parser.add_argument("cura_conan_version", type = str, help="The version of cura") - parser.add_argument("filename", type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64' or 'UltiMaker-Cura-5.1.0-beta-Macos-X64')") - parser.add_argument("build_pkg", type = bool, default = False, help = "build the pkg") - parser.add_argument("build_dmg", type = bool, default = True, help = "build the dmg") - parser.add_argument("app_name", type = str, help = "Filename of the .app that will be contained within the dmg/pkg") + parser.add_argument("--source_path", required = True, type = str, help = "Path to Pyinstaller source folder") + parser.add_argument("--dist_path", required = True, type = str, help = "Path to Pyinstaller dist folder") + parser.add_argument("--cura_conan_version", required = True, type = str, help = "The version of cura") + parser.add_argument("--filename", required = True, type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.5.0-Macos-X64' or 'UltiMaker-Cura-5.5.0-beta.1-Macos-ARM64')") + parser.add_argument("--build_pkg", type = bool, default = False, help = "build the pkg") + parser.add_argument("--build_dmg", type = bool, default = True, help = "build the dmg") + parser.add_argument("--app_name", required = True, type = str, help = "Filename of the .app that will be contained within the dmg/pkg") args = parser.parse_args() cura_version = args.cura_conan_version.split("/")[-1] From b1cac1224a9d8ce8e29b753638ade779e7343e85 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 21:40:40 +0200 Subject: [PATCH 08/31] actually install the cura package Contributes to CURA-8415 --- .github/workflows/macos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bc59eb27c1..6477bc401f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -125,6 +125,10 @@ jobs: if: ${{ inputs.architecture == 'X64' }} run: conan profile update settings.arch=x86_64 default + - name: Create the Packages (Bash) + if: ${{ runner.os != 'Windows' }} + run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" + - name: Set Environment variables for Cura (bash) run: | . ./cura_inst/bin/activate_github_actions_env.sh From 3dcba69c3312c9c55690757912f56675fceef9ba Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 21:50:50 +0200 Subject: [PATCH 09/31] use build_pkg and build_dmg as flags Contributes to CURA-8415 --- packaging/MacOS/build_macos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index 8382cac27a..bde28afab0 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -143,8 +143,8 @@ if __name__ == "__main__": parser.add_argument("--dist_path", required = True, type = str, help = "Path to Pyinstaller dist folder") parser.add_argument("--cura_conan_version", required = True, type = str, help = "The version of cura") parser.add_argument("--filename", required = True, type = str, help = "Filename of the pkg/dmg (e.g. 'UltiMaker-Cura-5.5.0-Macos-X64' or 'UltiMaker-Cura-5.5.0-beta.1-Macos-ARM64')") - parser.add_argument("--build_pkg", type = bool, default = False, help = "build the pkg") - parser.add_argument("--build_dmg", type = bool, default = True, help = "build the dmg") + parser.add_argument("--build_pkg", action="store_true", default = False, help = "build the pkg") + parser.add_argument("--build_dmg", action="store_true", default = True, help = "build the dmg") parser.add_argument("--app_name", required = True, type = str, help = "Filename of the .app that will be contained within the dmg/pkg") args = parser.parse_args() From f5f06842841473b7bb4ba5d229200c2715faf886 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 22:05:50 +0200 Subject: [PATCH 10/31] use runner context Contributes to CURA-8415 --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6477bc401f..216de03a09 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -160,7 +160,7 @@ jobs: run: | import os enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" - installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-${{ inputs.arch }}" + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-${{ runner.arch }}" output_env = os.environ["GITHUB_OUTPUT"] content = "" if os.path.exists(output_env): From bc13ba8c244f9e9654f810f4f0e76919d8ca1c70 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 22:47:08 +0200 Subject: [PATCH 11/31] don't specify arch for runs-on Contributes to CURA-8415 --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 216de03a09..7cd6a1247c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -76,7 +76,7 @@ env: jobs: cura-installer-create: - runs-on: [ self-hosted, "${{ inputs.architecture }}" ] + runs-on: [ self-hosted ] steps: - name: Checkout From 13b3082b003e0eccbc0c340f35d5f00ddf492f85 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 23:02:09 +0200 Subject: [PATCH 12/31] Use architecture string from inputs Contributes to CURA-8415 --- .github/workflows/macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7cd6a1247c..bd42a2b453 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -76,7 +76,7 @@ env: jobs: cura-installer-create: - runs-on: [ self-hosted ] + runs-on: [ self-hosted, "${{ inputs.architecture }}" ] steps: - name: Checkout @@ -160,7 +160,7 @@ jobs: run: | import os enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" - installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-${{ runner.arch }}" + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-${{ inputs.architecture }}" output_env = os.environ["GITHUB_OUTPUT"] content = "" if os.path.exists(output_env): From e6e867eb5fd9000f9c2dc07d001767fb7a9efb99 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 23:11:59 +0200 Subject: [PATCH 13/31] run X64 on regular runners Contributes to CURA-8415 --- .github/workflows/macos.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bd42a2b453..11d57b286f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -75,8 +75,17 @@ env: STAGING: ${{ inputs.staging }} jobs: + get-runner-label: + runs-on: ubuntu-latest + outputs: + label: ${{ steps.determine-label.outputs.label }} # You must define the specific step inside the job + steps: + - id: determine-label + run: echo "::set-output name=label::$(if [ "${{ inputs.architecture }}" = "ARM64" ]; then echo 'self-hosted'; else echo 'macos-11'; fi)" + cura-installer-create: - runs-on: [ self-hosted, "${{ inputs.architecture }}" ] + needs: [ get-runner-label ] + runs-on: ${{ needs.get-runner-label.outputs.label }} steps: - name: Checkout From 07f784a5d6079eeaf372351a8d74934baf17bd3b Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Fri, 18 Aug 2023 23:17:55 +0200 Subject: [PATCH 14/31] use env instead of output Contributes to CURA-8415 --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 11d57b286f..a19a67c607 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -81,7 +81,7 @@ jobs: label: ${{ steps.determine-label.outputs.label }} # You must define the specific step inside the job steps: - id: determine-label - run: echo "::set-output name=label::$(if [ "${{ inputs.architecture }}" = "ARM64" ]; then echo 'self-hosted'; else echo 'macos-11'; fi)" + run: echo "label=$(if [ "${{ inputs.architecture }}" = "ARM64" ]; then echo 'self-hosted'; else echo 'macos-11'; fi)" >> $GITHUB_OUTPUT cura-installer-create: needs: [ get-runner-label ] From 5521d6448e7b21d34a1f74e38921c7acd11fd6b9 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:10:29 +0200 Subject: [PATCH 15/31] Ported windows runner logic from old workflows Contributes to CURA-8415 --- .github/workflows/windows.yml | 173 +++++++++++++++++++++++++++++++++- 1 file changed, 172 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d76a44d917..27621c9055 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -86,4 +86,175 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 \ No newline at end of file + uses: actions/checkout@v3 + + - name: Setup Python and pip + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + cache: 'pip' + cache-dependency-path: .github/workflows/requirements-conan-package.txt + + - name: Install Python requirements for runner + run: pip install -r .github/workflows/requirements-conan-package.txt + + - name: Use Conan download cache (Powershell) + run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" + + - name: Cache Conan local repository packages (Powershell) + uses: actions/cache@v3 + with: + path: | + C:\Users\runneradmin\.conan\data + C:\.conan + C:\Users\runneradmin\.conan\conan_download_cache + key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache + + - name: Create the default Conan profile + run: conan profile new default --detect --force + + - name: Create PFX certificate from BASE64_PFX_CONTENT secret + id: create-pfx + env: + PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} + run: | + $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; + $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); + Set-Content $pfxPath -Value $encodedBytes -AsByteStream; + echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; + + - name: Get Conan configuration + run: conan config install https://github.com/Ultimaker/conan-config.git + + - name: Create the Packages (Powershell) + run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING --json "cura_inst/conan_install_info.json" + + - name: Set Environment variables for Cura (Powershell) + run: | + echo "${Env:WIX}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + .\cura_inst\Scripts\activate_github_actions_env.ps1 + .\cura_inst\Scripts\activate_github_actions_version_env.ps1 + + - name: Install OpenSSL shared + run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy + + - name: Copy OpenSSL shared (Powershell) + run: | + cp openssl/bin/*.dll ./cura_inst/Scripts/ + cp openssl/lib/*.lib ./cura_inst/Lib/ + + - name: Create the Cura dist + run: pyinstaller ./cura_inst/UltiMaker-Cura.spec + + - name: Output the name file name and extension + id: filename + shell: python + run: | + import os + enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-${{ inputs.architecture }}" + output_env = os.environ["GITHUB_OUTPUT"] + content = "" + if os.path.exists(output_env): + with open(output_env, "r") as f: + content = f.read() + with open(output_env, "w") as f: + f.write(content) + f.writelines(f"INSTALLER_FILENAME={installer_filename}\n") + + - name: Summarize the used Conan dependencies + shell: python + run: | + import os + import json + from pathlib import Path + + conan_install_info_path = Path("cura_inst/conan_install_info.json") + conan_info = {"installed": []} + if os.path.exists(conan_install_info_path): + with open(conan_install_info_path, "r") as f: + conan_info = json.load(f) + sorted_deps = sorted([dep["recipe"]["id"].replace('#', r' rev: ') for dep in conan_info["installed"]]) + + summary_env = os.environ["GITHUB_STEP_SUMMARY"] + content = "" + if os.path.exists(summary_env): + with open(summary_env, "r") as f: + content = f.read() + + with open(summary_env, "w") as f: + f.write(content) + f.writelines("# ${{ steps.filename.outputs.INSTALLER_FILENAME }}\n") + f.writelines("## Conan packages:\n") + for dep in sorted_deps: + f.writelines(f"`{dep}`\n") + + - name: Summarize the used Python modules + shell: python + run: | + import os + import pkg_resources + summary_env = os.environ["GITHUB_STEP_SUMMARY"] + content = "" + if os.path.exists(summary_env): + with open(summary_env, "r") as f: + content = f.read() + + with open(summary_env, "w") as f: + f.write(content) + f.writelines("## Python modules:\n") + for package in pkg_resources.working_set: + f.writelines(f"`{package.key}/{package.version}`\n") + + - name: Create the Windows exe installer (Powershell) + run: | + python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe" + working-directory: dist + + - name: Create the Windows msi installer (Powershell) + run: | + python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" + working-directory: dist + + - name: Sign the Windows exe installer (Powershell) + env: + PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} + run: | + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe" + working-directory: dist + + - name: Sign the Windows msi installer (Powershell) + env: + PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} + run: | + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi" + working-directory: dist + + - name: Upload the exe + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-exe + path: | + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe + retention-days: 5 + + - name: Upload the msi + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-msi + path: | + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi + retention-days: 5 + + notify-export: + if: ${{ always() }} + needs: [ cura-installer-create ] + + uses: ultimaker/cura/.github/workflows/notify.yml@main + with: + success: ${{ contains(join(needs.*.result, ','), 'success') }} + success_title: "Create the Cura distributions" + success_body: "Installers for ${{ inputs.cura_conan_version }}" + failure_title: "Failed to create the Cura distributions" + failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}" + secrets: inherit \ No newline at end of file From e184e4f15af0c51692a80f34347d6612985f8e34 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:10:51 +0200 Subject: [PATCH 16/31] removed redundant if check Contributes to CURA-8415 --- .github/workflows/macos.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4ea9db5010..75eefb1528 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -140,7 +140,6 @@ jobs: run: conan profile update settings.arch=x86_64 default - name: Create the Packages (Bash) - if: ${{ runner.os != 'Windows' }} run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" - name: Set Environment variables for Cura (bash) From d934f06d1b7472f8e426a4279048139a398280fe Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:30:57 +0200 Subject: [PATCH 17/31] ported linux workflow Contributes to CURA-8415 --- .github/workflows/linux.yml | 178 +++++++++++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e307354c0a..38e520f766 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -86,4 +86,180 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 \ No newline at end of file + uses: actions/checkout@v3 + + - name: Setup Python and pip + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + cache: 'pip' + cache-dependency-path: .github/workflows/requirements-conan-package.txt + + - name: Install Python requirements for runner + run: pip install -r .github/workflows/requirements-conan-package.txt + + - name: Use Conan download cache (Bash) + run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" + + - name: Cache Conan local repository packages (Bash) + uses: actions/cache@v3 + with: + path: | + $HOME/.conan/data + $HOME/.conan/conan_download_cache + key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache + + - name: Hack needed specifically for ubuntu-22.04 from mid-Feb 2023 onwards + if: ${{ startsWith(inputs.operating_system, 'ubuntu-22.04') }} + run: sudo apt remove libodbc2 libodbcinst2 unixodbc-common -y + + # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest. + # This is maybe because grub caches the disk it uses last time, which is recreated each time. + - name: Install Linux system requirements + run: | + sudo rm /var/cache/debconf/config.dat + sudo dpkg --configure -a + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt update + sudo apt upgrade + 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 -y + wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool + chmod +x $GITHUB_WORKSPACE/appimagetool + echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV + + - name: Install GCC-12 on ubuntu-22.04 + if: ${{ startsWith(inputs.operating_system, 'ubuntu-22.04') }} + run: | + sudo apt install g++-12 gcc-12 -y + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12 + + - name: Use GCC-10 on ubuntu-20.04 + if: ${{ startsWith(inputs.operating_system, 'ubuntu-20.04') }} + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 + + - name: Create the default Conan profile + run: conan profile new default --detect --force + + - name: Configure GPG Key Linux (Bash) + run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import + + - name: Get Conan configuration + run: conan config install https://github.com/Ultimaker/conan-config.git + + - name: Create the Packages (Bash) + run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" + + - name: Set Environment variables for Cura (bash) + run: | + . ./cura_inst/bin/activate_github_actions_env.sh + . ./cura_inst/bin/activate_github_actions_version_env.sh + + # FIXME: This is a workaround to ensure that we use and pack a shared library for OpenSSL 1.1.1l. We currently compile + # OpenSSL statically for CPython, but our Python Dependenies (such as PyQt6) require a shared library. + # Because Conan won't allow for building the same library with two different options (easily) we need to install it explicitly + # and do a manual copy to the VirtualEnv, such that Pyinstaller can find it. + + - name: Install OpenSSL shared + run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy + + - name: Copy OpenSSL shared (Bash) + run: | + cp ./openssl/lib/*.so* ./cura_inst/bin/ || true + cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true + + - name: Create the Cura dist + run: pyinstaller ./cura_inst/UltiMaker-Cura.spec + + - name: Output the name file name and extension + id: filename + shell: python + run: | + import os + enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}" + if ${{ inputs.operating_system }} == "ubuntu-22.04": + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-modern-${{ inputs.architecture }}" + else: + installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}" + output_env = os.environ["GITHUB_OUTPUT"] + content = "" + if os.path.exists(output_env): + with open(output_env, "r") as f: + content = f.read() + with open(output_env, "w") as f: + f.write(content) + f.writelines(f"INSTALLER_FILENAME={installer_filename}\n") + + - name: Summarize the used Conan dependencies + shell: python + run: | + import os + import json + from pathlib import Path + + conan_install_info_path = Path("cura_inst/conan_install_info.json") + conan_info = {"installed": []} + if os.path.exists(conan_install_info_path): + with open(conan_install_info_path, "r") as f: + conan_info = json.load(f) + sorted_deps = sorted([dep["recipe"]["id"].replace('#', r' rev: ') for dep in conan_info["installed"]]) + + summary_env = os.environ["GITHUB_STEP_SUMMARY"] + content = "" + if os.path.exists(summary_env): + with open(summary_env, "r") as f: + content = f.read() + + with open(summary_env, "w") as f: + f.write(content) + f.writelines("# ${{ steps.filename.outputs.INSTALLER_FILENAME }}\n") + f.writelines("## Conan packages:\n") + for dep in sorted_deps: + f.writelines(f"`{dep}`\n") + + - name: Summarize the used Python modules + shell: python + run: | + import os + import pkg_resources + summary_env = os.environ["GITHUB_STEP_SUMMARY"] + content = "" + if os.path.exists(summary_env): + with open(summary_env, "r") as f: + content = f.read() + + with open(summary_env, "w") as f: + f.write(content) + f.writelines("## Python modules:\n") + for package in pkg_resources.working_set: + f.writelines(f"`{package.key}/{package.version}`\n") + + - name: Create the Linux AppImage (Bash) + run: | + python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage" + chmod +x "${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage" + working-directory: dist + + - name: Upload the AppImage + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-AppImage + path: | + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.AppImage + retention-days: 5 + + notify-export: + if: ${{ always() }} + needs: [ cura-installer-create ] + + uses: ultimaker/cura/.github/workflows/notify.yml@main + with: + success: ${{ contains(join(needs.*.result, ','), 'success') }} + success_title: "Create the Cura distributions" + success_body: "Installers for ${{ inputs.cura_conan_version }}" + failure_title: "Failed to create the Cura distributions" + failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}" + secrets: inherit From ce5fb3d403969e33af6d2198ea0ba4f445d06fc4 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:32:12 +0200 Subject: [PATCH 18/31] run download cache after config Contributes to CURA-8415 --- .github/workflows/linux.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 38e520f766..30f1f73705 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -98,9 +98,6 @@ jobs: - name: Install Python requirements for runner run: pip install -r .github/workflows/requirements-conan-package.txt - - name: Use Conan download cache (Bash) - run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" - - name: Cache Conan local repository packages (Bash) uses: actions/cache@v3 with: @@ -149,6 +146,9 @@ jobs: - name: Get Conan configuration run: conan config install https://github.com/Ultimaker/conan-config.git + - name: Use Conan download cache (Bash) + run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" + - name: Create the Packages (Bash) run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" From 8501c7113a3771ccbe1e5fbae874b66bc92c9ee6 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:33:20 +0200 Subject: [PATCH 19/31] use caching of conan data Contributes to CURA-8415 --- .github/workflows/macos.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 75eefb1528..00ef703cd5 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -106,6 +106,14 @@ jobs: - name: Install Python requirements for runner run: pip install -r .github/workflows/requirements-conan-package.txt + - name: Cache Conan local repository packages (Bash) + uses: actions/cache@v3 + with: + path: | + $HOME/.conan/data + $HOME/.conan/conan_download_cache + key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache + - name: Install MacOS system requirements run: brew install cmake autoconf automake ninja create-dmg @@ -135,6 +143,9 @@ jobs: - name: Get Conan configuration run: conan config install https://github.com/Ultimaker/conan-config.git + - name: Use Conan download cache (Bash) + run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" + - name: Set architecture conan profile if: ${{ inputs.architecture == 'X64' }} run: conan profile update settings.arch=x86_64 default From fce1aba6a6e265e231b6b669e0c0ff9ddf8ab475 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:34:09 +0200 Subject: [PATCH 20/31] run conan config download cache after config install Contributes to CURA-8415 --- .github/workflows/windows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 27621c9055..816092dd0f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -98,9 +98,6 @@ jobs: - name: Install Python requirements for runner run: pip install -r .github/workflows/requirements-conan-package.txt - - name: Use Conan download cache (Powershell) - run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" - - name: Cache Conan local repository packages (Powershell) uses: actions/cache@v3 with: @@ -126,6 +123,9 @@ jobs: - name: Get Conan configuration run: conan config install https://github.com/Ultimaker/conan-config.git + - name: Use Conan download cache (Powershell) + run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" + - name: Create the Packages (Powershell) run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING --json "cura_inst/conan_install_info.json" From 67caa185db83ba7822edea46dbc6acc158afe0d5 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 00:43:49 +0200 Subject: [PATCH 21/31] fixed missing qoutes Contributes to CURA-8415 --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 30f1f73705..42312219d6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -180,7 +180,7 @@ jobs: import os enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}" - if ${{ inputs.operating_system }} == "ubuntu-22.04": + if "${{ inputs.operating_system }}" == "ubuntu-22.04": installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-modern-${{ inputs.architecture }}" else: installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}" From f2c68fe2ce766491b2ec3e0e270f661f012c9f43 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:03:08 +0200 Subject: [PATCH 22/31] parallelize msi and exe creation Contributes to CURA-8415 --- .github/workflows/windows.yml | 97 ++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 29 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 816092dd0f..25aca0d2c9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -84,6 +84,9 @@ jobs: cura-installer-create: runs-on: ${{ inputs.operating_system }} + outputs: + INSTALLER_FILENAME: ${{ steps.filename.outputs.INSTALLER_FILENAME }} + steps: - name: Checkout uses: actions/checkout@v3 @@ -110,16 +113,6 @@ jobs: - name: Create the default Conan profile run: conan profile new default --detect --force - - name: Create PFX certificate from BASE64_PFX_CONTENT secret - id: create-pfx - env: - PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} - run: | - $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; - $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); - Set-Content $pfxPath -Value $encodedBytes -AsByteStream; - echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; - - name: Get Conan configuration run: conan config install https://github.com/Ultimaker/conan-config.git @@ -206,49 +199,95 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") + - name: upload the dist folder + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + dist/ + retention-days: 5 + + cura-installer-create-exe: + needs: [ cura-installer-create ] + runs-on: ${{ inputs.operating_system }} + steps: + - name: Download the dist + uses: actions/download-artifact@v3 + with: + name: dist + + - name: Create PFX certificate from BASE64_PFX_CONTENT secret + id: create-pfx + env: + PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} + run: | + $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; + $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); + Set-Content $pfxPath -Value $encodedBytes -AsByteStream; + echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; + - name: Create the Windows exe installer (Powershell) run: | - python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe" - working-directory: dist - - - name: Create the Windows msi installer (Powershell) - run: | - python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" + python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe" working-directory: dist - name: Sign the Windows exe installer (Powershell) env: PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe" + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe" + working-directory: dist + + - name: Upload the exe + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-exe + path: | + dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe + retention-days: 5 + + cura-installer-create-msi: + needs: [ cura-installer-create ] + runs-on: ${{ inputs.operating_system }} + steps: + - name: Download the dist + uses: actions/download-artifact@v3 + with: + name: dist + + - name: Create PFX certificate from BASE64_PFX_CONTENT secret + id: create-pfx + env: + PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} + run: | + $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; + $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); + Set-Content $pfxPath -Value $encodedBytes -AsByteStream; + echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; + + - name: Create the Windows msi installer (Powershell) + run: | + python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" working-directory: dist - name: Sign the Windows msi installer (Powershell) env: PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi" + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi" working-directory: dist - - name: Upload the exe - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-exe - path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.exe - retention-days: 5 - - name: Upload the msi uses: actions/upload-artifact@v3 with: - name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-msi + name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-msi path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.msi + dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi retention-days: 5 notify-export: if: ${{ always() }} - needs: [ cura-installer-create ] + needs: [ cura-installer-create-exe, cura-installer-create-msi ] uses: ultimaker/cura/.github/workflows/notify.yml@main with: From 8ea4dabcea1815eec8bc82ae5d5bfc3f29e5e371 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:12:43 +0200 Subject: [PATCH 23/31] parallelize dmg and pkg creation Contributes to CURA-8415 --- .github/workflows/macos.yml | 103 +++++++++++++++++++++++++++++++----- 1 file changed, 91 insertions(+), 12 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 00ef703cd5..086cfd1cf1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -92,6 +92,9 @@ jobs: cura-installer-create: runs-on: ${{ inputs.operating_system }} + outputs: + INSTALLER_FILENAME: ${{ steps.filename.outputs.INSTALLER_FILENAME }} + steps: - name: Checkout uses: actions/checkout@v3 @@ -238,29 +241,105 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") + - name: upload the dist folder + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + dist/ + retention-days: 5 + + cura-installer-create-dmg: + needs: [ cura-installer-create ] + runs-on: macos-11 + steps: + - name: Download the dist + uses: actions/download-artifact@v3 + with: + name: dist + + - name: Remove Macos keychain (Bash) + run: security delete-keychain signing_temp.keychain || true + + - name: Configure Macos keychain Developer Cert(Bash) + id: macos-keychain-developer-cert + uses: apple-actions/import-codesign-certs@v1 + with: + keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} + p12-file-base64: ${{ secrets.MACOS_CERT_P12 }} + p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} + + - name: Configure Macos keychain Installer Cert (Bash) + id: macos-keychain-installer-cert + uses: apple-actions/import-codesign-certs@v1 + with: + keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} + create-keychain: false # keychain is created in previous use of action. + p12-file-base64: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} + p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} + + - name: Install MacOS system requirements + run: brew install create-dmg + - name: Create the Macos dmg and pkg (Bash) - run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ steps.filename.outputs.INSTALLER_FILENAME }}" --build_pkg --build_dmg --app_name "$CURA_APP_NAME" + run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_dmg --app_name "$CURA_APP_NAME" + working-directory: dist + + - name: Upload the dmg + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-dmg + path: | + dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.dmg + retention-days: 5 + + cura-installer-create-pkg: + needs: [ cura-installer-create ] + runs-on: macos-11 + steps: + - name: Download the dist + uses: actions/download-artifact@v3 + with: + name: dist + + - name: Remove Macos keychain (Bash) + run: security delete-keychain signing_temp.keychain || true + + - name: Configure Macos keychain Developer Cert(Bash) + id: macos-keychain-developer-cert + uses: apple-actions/import-codesign-certs@v1 + with: + keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} + p12-file-base64: ${{ secrets.MACOS_CERT_P12 }} + p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} + + - name: Configure Macos keychain Installer Cert (Bash) + id: macos-keychain-installer-cert + uses: apple-actions/import-codesign-certs@v1 + with: + keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} + create-keychain: false # keychain is created in previous use of action. + p12-file-base64: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} + p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} + + - name: Install MacOS system requirements + run: brew install create-dmg + + - name: Create the Macos dmg and pkg (Bash) + run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_pkg --app_name "$CURA_APP_NAME" working-directory: dist - name: Upload the pkg uses: actions/upload-artifact@v3 with: - name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-pkg + name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-pkg path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.pkg - retention-days: 5 - - - name: Upload the dmg - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-dmg - path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.dmg + dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.pkg retention-days: 5 notify-export: if: ${{ always() }} - needs: [ cura-installer-create ] + needs: [ cura-installer-create-dmg, cura-installer-create-pkg ] uses: ultimaker/cura/.github/workflows/notify.yml@main with: From c1e27a9016f22932b5ef045c5ba11aea9531de9d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:21:45 +0200 Subject: [PATCH 24/31] zip dist Contributes to CURA-8415 --- .github/workflows/windows.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 25aca0d2c9..715b05056b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -199,23 +199,32 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") - - name: upload the dist folder + + - name: Archive the artifacts (Powershell) + run: Compress-Archive -Path ".\UltiMaker-Cura" -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" + working-directory: dist + + - name: upload the zipped dist folder uses: actions/upload-artifact@v3 with: name: dist path: | - dist/ + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip retention-days: 5 cura-installer-create-exe: needs: [ cura-installer-create ] runs-on: ${{ inputs.operating_system }} steps: - - name: Download the dist + - name: Download the zipped dist uses: actions/download-artifact@v3 with: name: dist + - name: Extract the zipped dist + run: Expand-Archive -Path ".\dist\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath ".\dist" + shell: powershell + - name: Create PFX certificate from BASE64_PFX_CONTENT secret id: create-pfx env: @@ -255,6 +264,10 @@ jobs: with: name: dist + - name: Extract the zipped dist + run: Expand-Archive -Path ".\dist\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath ".\dist" + shell: powershell + - name: Create PFX certificate from BASE64_PFX_CONTENT secret id: create-pfx env: From 5e7a71c914f00b6c7fbe4133a704027fea6fd5df Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:23:26 +0200 Subject: [PATCH 25/31] zip dist Contributes to CURA-8415 --- .github/workflows/macos.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 086cfd1cf1..7ba83ca70b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -241,12 +241,16 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") - - name: upload the dist folder + - name: Archive the artifacts (bash) + run: tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./UltiMaker-Cura/" + working-directory: dist + + - name: upload the tarred dist folder uses: actions/upload-artifact@v3 with: name: dist path: | - dist/ + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz retention-days: 5 cura-installer-create-dmg: @@ -258,6 +262,10 @@ jobs: with: name: dist + - name: untar the dist folder + run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + working-directory: dist + - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true @@ -302,6 +310,10 @@ jobs: with: name: dist + - name: untar the dist folder + run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + working-directory: dist + - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true From 0cc286a159a4975831c860088d61d16c4d7ffd15 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:37:01 +0200 Subject: [PATCH 26/31] level up Contributes to CURA-8415 --- .github/workflows/macos.yml | 7 ++----- .github/workflows/windows.yml | 9 ++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7ba83ca70b..4c77692cff 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -242,15 +242,14 @@ jobs: f.writelines(f"`{package.key}/{package.version}`\n") - name: Archive the artifacts (bash) - run: tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./UltiMaker-Cura/" - working-directory: dist + run: tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./dist/" - name: upload the tarred dist folder uses: actions/upload-artifact@v3 with: name: dist path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz + ${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz retention-days: 5 cura-installer-create-dmg: @@ -264,7 +263,6 @@ jobs: - name: untar the dist folder run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" - working-directory: dist - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true @@ -312,7 +310,6 @@ jobs: - name: untar the dist folder run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" - working-directory: dist - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 715b05056b..f335605b91 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -201,15 +201,14 @@ jobs: - name: Archive the artifacts (Powershell) - run: Compress-Archive -Path ".\UltiMaker-Cura" -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" - working-directory: dist + run: Compress-Archive -Path ".\dist" -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" - name: upload the zipped dist folder uses: actions/upload-artifact@v3 with: name: dist path: | - dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip + ${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip retention-days: 5 cura-installer-create-exe: @@ -222,7 +221,7 @@ jobs: name: dist - name: Extract the zipped dist - run: Expand-Archive -Path ".\dist\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath ".\dist" + run: Expand-Archive -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath "." shell: powershell - name: Create PFX certificate from BASE64_PFX_CONTENT secret @@ -265,7 +264,7 @@ jobs: name: dist - name: Extract the zipped dist - run: Expand-Archive -Path ".\dist\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath ".\dist" + run: Expand-Archive -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath "." shell: powershell - name: Create PFX certificate from BASE64_PFX_CONTENT secret From c686326e2220e36997b63f1590547567ce3b0943 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 01:56:23 +0200 Subject: [PATCH 27/31] Parallelization fixes Contributes to CURA-8415 --- .github/workflows/installers.yml | 7 +++++- .github/workflows/linux.yml | 1 - .github/workflows/macos.yml | 35 ++++++++++++++++++++++++------ .github/workflows/windows.yml | 37 +++++++++++++++++++++++--------- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/.github/workflows/installers.yml b/.github/workflows/installers.yml index 283fc76ee5..ead3b7a87a 100644 --- a/.github/workflows/installers.yml +++ b/.github/workflows/installers.yml @@ -35,6 +35,7 @@ jobs: staging: ${{ inputs.staging }} architecture: X64 operating_system: windows-2022 + secrets: inherit linux-modern-installer: uses: ./.github/workflows/linux.yml @@ -45,6 +46,7 @@ jobs: staging: ${{ inputs.staging }} architecture: X64 operating_system: ubuntu-22.04 + secrets: inherit linux-legacy-installer: uses: ./.github/workflows/linux.yml @@ -55,6 +57,7 @@ jobs: staging: ${{ inputs.staging }} architecture: X64 operating_system: ubuntu-20.04 + secrets: inherit macos-installer: uses: ./.github/workflows/macos.yml @@ -65,6 +68,7 @@ jobs: staging: ${{ inputs.staging }} architecture: X64 operating_system: macos-11.0 + secrets: inherit macos-arm-installer: uses: ./.github/workflows/macos.yml @@ -74,4 +78,5 @@ jobs: enterprise: ${{ inputs.enterprise }} staging: ${{ inputs.staging }} architecture: ARM64 - operating_system: self-hosted \ No newline at end of file + operating_system: self-hosted + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 42312219d6..70a15bcbb5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -179,7 +179,6 @@ jobs: run: | import os enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" - installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-${{ inputs.architecture }}" if "${{ inputs.operating_system }}" == "ubuntu-22.04": installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-modern-${{ inputs.architecture }}" else: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4c77692cff..e5e8ead2cd 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -242,27 +242,40 @@ jobs: f.writelines(f"`{package.key}/{package.version}`\n") - name: Archive the artifacts (bash) - run: tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./dist/" + run: | + tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./dist/" + tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}-package.tar.gz" "./cura_inst/packaging/" - - name: upload the tarred dist folder + - name: upload the tarred dist and packaging folder uses: actions/upload-artifact@v3 with: name: dist path: | ${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz + ${{ steps.filename.outputs.INSTALLER_FILENAME }}-package.tar.gz retention-days: 5 cura-installer-create-dmg: needs: [ cura-installer-create ] runs-on: macos-11 steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + - name: Download the dist uses: actions/download-artifact@v3 with: name: dist - name: untar the dist folder - run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + run: | + tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-package.tar.gz" - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true @@ -287,7 +300,7 @@ jobs: - name: Install MacOS system requirements run: brew install create-dmg - - name: Create the Macos dmg and pkg (Bash) + - name: Create the Macos dmg (Bash) run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_dmg --app_name "$CURA_APP_NAME" working-directory: dist @@ -303,13 +316,23 @@ jobs: needs: [ cura-installer-create ] runs-on: macos-11 steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + - name: Download the dist uses: actions/download-artifact@v3 with: name: dist - name: untar the dist folder - run: tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + run: | + tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" + tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-package.tar.gz" - name: Remove Macos keychain (Bash) run: security delete-keychain signing_temp.keychain || true @@ -334,7 +357,7 @@ jobs: - name: Install MacOS system requirements run: brew install create-dmg - - name: Create the Macos dmg and pkg (Bash) + - name: Create the Macos pkg (Bash) run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_pkg --app_name "$CURA_APP_NAME" working-directory: dist diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f335605b91..99327f9602 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -199,29 +199,38 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") - - name: Archive the artifacts (Powershell) - run: Compress-Archive -Path ".\dist" -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" + run: Compress-Archive -Force -CompressionLevel NoCompression -Path @('.\dist', '.\cura_inst\packaging') -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" + shell: powershell - - name: upload the zipped dist folder + - name: upload the zipped dist and packaging folder uses: actions/upload-artifact@v3 with: - name: dist + name: dist-windows path: | ${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip - retention-days: 5 + retention-days: 1 + if-no-files-found: error cura-installer-create-exe: needs: [ cura-installer-create ] runs-on: ${{ inputs.operating_system }} steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + - name: Download the zipped dist uses: actions/download-artifact@v3 with: - name: dist + name: dist-windows - name: Extract the zipped dist - run: Expand-Archive -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath "." + run: Expand-Archive -Force -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath . shell: powershell - name: Create PFX certificate from BASE64_PFX_CONTENT secret @@ -258,13 +267,21 @@ jobs: needs: [ cura-installer-create ] runs-on: ${{ inputs.operating_system }} steps: - - name: Download the dist + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10.x' + + - name: Download the zipped dist uses: actions/download-artifact@v3 with: - name: dist + name: dist-windows - name: Extract the zipped dist - run: Expand-Archive -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath "." + run: Expand-Archive -Force -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath . shell: powershell - name: Create PFX certificate from BASE64_PFX_CONTENT secret From 78d555144ebb1e8d905859e8435a46f42cc2aa4a Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 16:26:24 +0200 Subject: [PATCH 28/31] Don't parallelize installer creation Zipping -> uploading -> downloading unzipping cost the same amount of time, while it also increased the complexity. Contributes to CURA-8415 --- .github/workflows/macos.yml | 121 ++-------------------------------- .github/workflows/windows.yml | 115 +++++++------------------------- 2 files changed, 32 insertions(+), 204 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e5e8ead2cd..736c906dab 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -241,137 +241,30 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") - - name: Archive the artifacts (bash) - run: | - tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./dist/" - tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}-package.tar.gz" "./cura_inst/packaging/" - - - name: upload the tarred dist and packaging folder - uses: actions/upload-artifact@v3 - with: - name: dist - path: | - ${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz - ${{ steps.filename.outputs.INSTALLER_FILENAME }}-package.tar.gz - retention-days: 5 - - cura-installer-create-dmg: - needs: [ cura-installer-create ] - runs-on: macos-11 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - - - name: Download the dist - uses: actions/download-artifact@v3 - with: - name: dist - - - name: untar the dist folder - run: | - tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" - tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-package.tar.gz" - - - name: Remove Macos keychain (Bash) - run: security delete-keychain signing_temp.keychain || true - - - name: Configure Macos keychain Developer Cert(Bash) - id: macos-keychain-developer-cert - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - p12-file-base64: ${{ secrets.MACOS_CERT_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Configure Macos keychain Installer Cert (Bash) - id: macos-keychain-installer-cert - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - create-keychain: false # keychain is created in previous use of action. - p12-file-base64: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Install MacOS system requirements - run: brew install create-dmg - - name: Create the Macos dmg (Bash) - run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_dmg --app_name "$CURA_APP_NAME" + run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ steps.filename.outputs.INSTALLER_FILENAME }}" --build_dmg --build_pkg --app_name "$CURA_APP_NAME" working-directory: dist - name: Upload the dmg uses: actions/upload-artifact@v3 with: - name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-dmg + name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-dmg path: | - dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.dmg + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.dmg retention-days: 5 - cura-installer-create-pkg: - needs: [ cura-installer-create ] - runs-on: macos-11 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - - - name: Download the dist - uses: actions/download-artifact@v3 - with: - name: dist - - - name: untar the dist folder - run: | - tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.tar.gz" - tar -zxf "./${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-package.tar.gz" - - - name: Remove Macos keychain (Bash) - run: security delete-keychain signing_temp.keychain || true - - - name: Configure Macos keychain Developer Cert(Bash) - id: macos-keychain-developer-cert - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - p12-file-base64: ${{ secrets.MACOS_CERT_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Configure Macos keychain Installer Cert (Bash) - id: macos-keychain-installer-cert - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - create-keychain: false # keychain is created in previous use of action. - p12-file-base64: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Install MacOS system requirements - run: brew install create-dmg - - - name: Create the Macos pkg (Bash) - run: python ../cura_inst/packaging/MacOS/build_macos.py --source_path ../cura_inst --dist_path . --cura_conan_version $CURA_CONAN_VERSION --filename "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}" --build_pkg --app_name "$CURA_APP_NAME" - working-directory: dist - - name: Upload the pkg uses: actions/upload-artifact@v3 with: - name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-pkg + name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-pkg path: | - dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.pkg + dist/${{ steps.filename.outputs.INSTALLER_FILENAME }}.pkg retention-days: 5 + notify-export: if: ${{ always() }} - needs: [ cura-installer-create-dmg, cura-installer-create-pkg ] + needs: [ cura-installer-create ] uses: ultimaker/cura/.github/workflows/notify.yml@main with: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 99327f9602..57bace2fef 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -199,91 +199,6 @@ jobs: for package in pkg_resources.working_set: f.writelines(f"`{package.key}/{package.version}`\n") - - name: Archive the artifacts (Powershell) - run: Compress-Archive -Force -CompressionLevel NoCompression -Path @('.\dist', '.\cura_inst\packaging') -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" - shell: powershell - - - name: upload the zipped dist and packaging folder - uses: actions/upload-artifact@v3 - with: - name: dist-windows - path: | - ${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip - retention-days: 1 - if-no-files-found: error - - cura-installer-create-exe: - needs: [ cura-installer-create ] - runs-on: ${{ inputs.operating_system }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - - - name: Download the zipped dist - uses: actions/download-artifact@v3 - with: - name: dist-windows - - - name: Extract the zipped dist - run: Expand-Archive -Force -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath . - shell: powershell - - - name: Create PFX certificate from BASE64_PFX_CONTENT secret - id: create-pfx - env: - PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} - run: | - $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; - $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); - Set-Content $pfxPath -Value $encodedBytes -AsByteStream; - echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; - - - name: Create the Windows exe installer (Powershell) - run: | - python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe" - working-directory: dist - - - name: Sign the Windows exe installer (Powershell) - env: - PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} - run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe" - working-directory: dist - - - name: Upload the exe - uses: actions/upload-artifact@v3 - with: - name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-exe - path: | - dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.exe - retention-days: 5 - - cura-installer-create-msi: - needs: [ cura-installer-create ] - runs-on: ${{ inputs.operating_system }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - - - name: Download the zipped dist - uses: actions/download-artifact@v3 - with: - name: dist-windows - - - name: Extract the zipped dist - run: Expand-Archive -Force -Path ".\${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.zip" -DestinationPath . - shell: powershell - - name: Create PFX certificate from BASE64_PFX_CONTENT secret id: create-pfx env: @@ -296,27 +211,47 @@ jobs: - name: Create the Windows msi installer (Powershell) run: | - python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" + python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{steps.filename.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" working-directory: dist - name: Sign the Windows msi installer (Powershell) env: PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi" + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{steps.filename.outputs.INSTALLER_FILENAME }}.msi" + working-directory: dist + + - name: Create the Windows exe installer (Powershell) + run: | + python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{steps.filename.outputs.INSTALLER_FILENAME }}.exe" + working-directory: dist + + - name: Sign the Windows exe installer (Powershell) + env: + PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} + run: | + & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{steps.filename.outputs.INSTALLER_FILENAME }}.exe" working-directory: dist - name: Upload the msi uses: actions/upload-artifact@v3 with: - name: ${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}-msi + name: ${{steps.filename.outputs.INSTALLER_FILENAME }}-msi path: | - dist/${{ needs.cura-installer-create.outputs.INSTALLER_FILENAME }}.msi + dist/${{steps.filename.outputs.INSTALLER_FILENAME }}.msi + retention-days: 5 + + - name: Upload the exe + uses: actions/upload-artifact@v3 + with: + name: ${{steps.filename.outputs.INSTALLER_FILENAME }}-exe + path: | + dist/${{steps.filename.outputs.INSTALLER_FILENAME }}.exe retention-days: 5 notify-export: if: ${{ always() }} - needs: [ cura-installer-create-exe, cura-installer-create-msi ] + needs: [ cura-installer-create ] uses: ultimaker/cura/.github/workflows/notify.yml@main with: From 7011c8f85ab022b0e297416ac8983d0f06fa82b7 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 19 Aug 2023 16:53:25 +0200 Subject: [PATCH 29/31] Removed old installer workflows Contributes to CURA-8415 --- .github/workflows/cura-all-installers.yml | 157 --------- .github/workflows/cura-installer.yml | 399 ---------------------- 2 files changed, 556 deletions(-) delete mode 100644 .github/workflows/cura-all-installers.yml delete mode 100644 .github/workflows/cura-installer.yml diff --git a/.github/workflows/cura-all-installers.yml b/.github/workflows/cura-all-installers.yml deleted file mode 100644 index 96071756fe..0000000000 --- a/.github/workflows/cura-all-installers.yml +++ /dev/null @@ -1,157 +0,0 @@ -name: Cura All Installers -run-name: ${{ inputs.cura_conan_version }} for exe ${{ inputs.build_windows_exe }}, msi ${{ inputs.build_windows_msi }}, dmg ${{ inputs.build_macos }}, pkg ${{ inputs.build_macos_installer }}, appimage ${{ inputs.build_linux }} - enterprise ${{ inputs.enterprise }} - -on: - workflow_dispatch: - inputs: - cura_conan_version: - description: 'Cura Conan Version' - default: 'cura/latest@ultimaker/testing' - required: true - type: string - conan_args: - description: 'Conan args: eq.: --require-override' - default: '' - required: false - type: string - conan_config: - description: 'Conan config branch to use' - default: '' - required: false - type: string - enterprise: - description: 'Build Cura as an Enterprise edition' - default: false - required: true - type: boolean - staging: - description: 'Use staging API' - default: false - required: true - type: boolean - installer: - description: 'Create the installer' - default: true - required: true - type: boolean - build_windows_exe: - description: 'Build for Windows exe' - default: false - required: true - type: boolean - build_windows_msi: - description: 'Build for msi+pkg' - default: true - required: true - type: boolean - build_linux: - description: 'Build for Linux' - default: true - required: true - type: boolean - build_macos: - description: 'Build dmg for MacOS' - default: true - required: true - type: boolean - - # Run the nightly at 3:25 UTC on working days - schedule: - - cron: '25 3 * * 1-5' - -jobs: - windows-installer-create-exe: - if: ${{ inputs.build_windows_exe }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'windows-2022' - platform: 'windows-2022' - os_name: 'win64' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: false - secrets: inherit - - windows-installer-create-msi: - if: ${{ inputs.build_windows_msi }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'windows-2022' - platform: 'windows-2022' - os_name: 'win64' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: true - secrets: inherit - - linux-installer-create: - if: ${{ inputs.build_linux }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'ubuntu-20.04' - platform: 'ubuntu-20.04' - os_name: 'linux' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: false - secrets: inherit - - linux-modern-installer-create: - if: ${{ inputs.build_linux }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'ubuntu-22.04' - platform: 'ubuntu-22.04' - os_name: 'linux-modern' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: false - secrets: inherit - - macos-dmg-create: - if: ${{ inputs.build_macos }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'self-hosted' - platform: 'macos-11' - os_name: 'mac' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: false - secrets: inherit - - macos-installer-create: - if: ${{ inputs.build_macos }} - uses: ./.github/workflows/cura-installer.yml - with: - runner: 'self-hosted' - platform: 'macos-11' - os_name: 'mac' - cura_conan_version: ${{ inputs.cura_conan_version }} - conan_args: ${{ inputs.conan_args }} - conan_config: ${{ inputs.conan_config }} - enterprise: ${{ inputs.enterprise }} - staging: ${{ inputs.staging }} - installer: ${{ inputs.installer }} - msi_installer: true - secrets: inherit diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml deleted file mode 100644 index 4b4df0a5bd..0000000000 --- a/.github/workflows/cura-installer.yml +++ /dev/null @@ -1,399 +0,0 @@ -name: Cura Installer -run-name: ${{ inputs.cura_conan_version }} for ${{ inputs.platform }} by @${{ github.actor }} - -on: - workflow_call: - inputs: - runner: - description: 'Selected runner' - default: 'ubuntu-20.04' - required: true - type: string - platform: - description: 'Selected Installer OS' - default: 'ubuntu-20.04' - required: true - type: string - os_name: - description: 'OS Friendly Name' - default: 'linux' - required: true - type: string - cura_conan_version: - description: 'Cura Conan Version' - default: 'cura/latest@ultimaker/testing' - required: true - type: string - conan_args: - description: 'Conan args: eq.: --require-override' - default: '' - required: false - type: string - conan_config: - description: 'Conan config branch to use' - default: '' - required: false - type: string - enterprise: - description: 'Build Cura as an Enterprise edition' - default: false - required: true - type: boolean - staging: - description: 'Use staging API' - default: false - required: true - type: boolean - installer: - description: 'Create the installer' - default: true - required: true - type: boolean - msi_installer: - description: 'Create the msi' - default: false - required: true - type: boolean - -env: - CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }} - CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }} - CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }} - CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }} - CONAN_LOG_RUN_TO_OUTPUT: 1 - CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }} - CONAN_NON_INTERACTIVE: 1 - CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }} - MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }} - MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }} - MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }} - MACOS_CERT_INSTALLER_P12: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} - MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - MACOS_CERT_PASSPHRASE: ${{ secrets.MACOS_CERT_PASSPHRASE }} - WIN_CERT_INSTALLER_CER: ${{ secrets.WIN_CERT_INSTALLER_CER }} - WIN_CERT_INSTALLER_CER_PASS: ${{ secrets.WIN_CERT_INSTALLER_CER_PASS }} - CURA_CONAN_VERSION: ${{ inputs.cura_conan_version }} - ENTERPRISE: ${{ inputs.enterprise }} - STAGING: ${{ inputs.staging }} - -jobs: - cura-installer-create: - runs-on: ${{ inputs.runner }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python and pip - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - cache: 'pip' - cache-dependency-path: .github/workflows/requirements-conan-package.txt - - - name: Install Python requirements for runner - run: pip install -r https://raw.githubusercontent.com/Ultimaker/Cura/main/.github/workflows/requirements-conan-package.txt - # Note the runner requirements are always installed from the main branch in the Ultimaker/Cura repo - - - name: Use Conan download cache (Bash) - if: ${{ runner.os != 'Windows' }} - run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" - - - name: Use Conan download cache (Powershell) - if: ${{ runner.os == 'Windows' }} - run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" - - - name: Cache Conan local repository packages (Bash) - uses: actions/cache@v3 - if: ${{ runner.os != 'Windows' }} - with: - path: | - $HOME/.conan/data - $HOME/.conan/conan_download_cache - key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache - - - name: Cache Conan local repository packages (Powershell) - uses: actions/cache@v3 - if: ${{ runner.os == 'Windows' }} - with: - path: | - C:\Users\runneradmin\.conan\data - C:\.conan - C:\Users\runneradmin\.conan\conan_download_cache - key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache - - - name: Install MacOS system requirements - if: ${{ runner.os == 'Macos' }} - run: brew install autoconf automake ninja create-dmg # Delete create-dmg when deprecating dmg - - - name: Hack needed specifically for ubuntu-22.04 from mid-Feb 2023 onwards - if: ${{ runner.os == 'Linux' && startsWith(inputs.platform, 'ubuntu-22.04') }} - run: sudo apt remove libodbc2 libodbcinst2 unixodbc-common -y - - # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest. - # This is maybe because grub caches the disk it uses last time, which is recreated each time. - - name: Install Linux system requirements - if: ${{ runner.os == 'Linux' }} - run: | - sudo rm /var/cache/debconf/config.dat - sudo dpkg --configure -a - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt update - sudo apt upgrade - 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 -y - wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool - chmod +x $GITHUB_WORKSPACE/appimagetool - echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV - - - name: Install GCC-12 on ubuntu-22.04 - if: ${{ startsWith(inputs.platform, 'ubuntu-22.04') }} - run: | - sudo apt install g++-12 gcc-12 -y - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12 - - - name: Use GCC-10 on ubuntu-20.04 - if: ${{ startsWith(inputs.platform, 'ubuntu-20.04') }} - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 - - - name: Create the default Conan profile - run: conan profile new default --detect --force - - - name: Configure GPG Key Linux (Bash) - if: ${{ runner.os == 'Linux' }} - run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import - - - name: Remove Macos keychain (Bash) - if: ${{ runner.os == 'Macos' && inputs.runner == 'self-hosted' }} - run: security delete-keychain signing_temp.keychain || true - - - name: Configure Macos keychain Developer Cert(Bash) - id: macos-keychain-developer-cert - if: ${{ runner.os == 'Macos' }} - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - p12-file-base64: ${{ secrets.MACOS_CERT_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Configure Macos keychain Installer Cert (Bash) - id: macos-keychain-installer-cert - if: ${{ runner.os == 'Macos' }} - uses: apple-actions/import-codesign-certs@v1 - with: - keychain-password: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} - create-keychain: false # keychain is created in previous use of action. - p12-file-base64: ${{ secrets.MACOS_CERT_INSTALLER_P12 }} - p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - - - name: Create PFX certificate from BASE64_PFX_CONTENT secret - if: ${{ runner.os == 'Windows' }} - id: create-pfx - env: - PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} - run: | - $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; - $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); - Set-Content $pfxPath -Value $encodedBytes -AsByteStream; - echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; - - - name: Get Conan configuration from branch - if: ${{ inputs.conan_config != '' }} - run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config }}" - - - name: Get Conan configuration - if: ${{ inputs.conan_config == '' }} - run: conan config install https://github.com/Ultimaker/conan-config.git - - - name: Create the Packages (Bash) - if: ${{ runner.os != 'Windows' }} - run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" - - - name: Create the Packages (Powershell) - if: ${{ runner.os == 'Windows' }} - run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING --json "cura_inst/conan_install_info.json" - - - name: Set Environment variables for Cura (bash) - if: ${{ runner.os != 'Windows' }} - run: | - . ./cura_inst/bin/activate_github_actions_env.sh - . ./cura_inst/bin/activate_github_actions_version_env.sh - - - name: Set Environment variables for Cura (Powershell) - if: ${{ runner.os == 'Windows' }} - run: | - echo "${Env:WIX}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - .\cura_inst\Scripts\activate_github_actions_env.ps1 - .\cura_inst\Scripts\activate_github_actions_version_env.ps1 - - - name: Unlock Macos keychain (Bash) - if: ${{ runner.os == 'Macos' }} - run: security unlock -p $TEMP_KEYCHAIN_PASSWORD signing_temp.keychain - env: - TEMP_KEYCHAIN_PASSWORD: ${{ steps.macos-keychain-developer-cert.outputs.keychain-password }} - - # FIXME: This is a workaround to ensure that we use and pack a shared library for OpenSSL 1.1.1l. We currently compile - # OpenSSL statically for CPython, but our Python Dependenies (such as PyQt6) require a shared library. - # Because Conan won't allow for building the same library with two different options (easily) we need to install it explicitly - # and do a manual copy to the VirtualEnv, such that Pyinstaller can find it. - - - name: Install OpenSSL shared - run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy - - - name: Copy OpenSSL shared (Bash) - if: ${{ runner.os != 'Windows' }} - run: | - cp ./openssl/lib/*.so* ./cura_inst/bin/ || true - cp ./openssl/lib/*.dylib* ./cura_inst/bin/ || true - - - name: Copy OpenSSL shared (Powershell) - if: ${{ runner.os == 'Windows' }} - run: | - cp openssl/bin/*.dll ./cura_inst/Scripts/ - cp openssl/lib/*.lib ./cura_inst/Lib/ - - - name: Create the Cura dist - run: pyinstaller ./cura_inst/UltiMaker-Cura.spec - - - name: Output the name file name and extension - id: filename - shell: python - run: | - import os - enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" - installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-${{ inputs.os_name }}-${{ inputs.arch }}" - if "${{ runner.os }}" == "Windows": - installer_ext = "msi" if "${{ inputs.msi_installer }}" == "true" else "exe" - elif "${{ runner.os }}" == "macOS": - installer_ext = "pkg" if "${{ inputs.msi_installer }}" == "true" else "dmg" - else: - installer_ext = "AppImage" - output_env = os.environ["GITHUB_OUTPUT"] - content = "" - if os.path.exists(output_env): - with open(output_env, "r") as f: - content = f.read() - with open(output_env, "w") as f: - f.write(content) - f.writelines(f"INSTALLER_FILENAME={installer_filename}\n") - f.writelines(f"INSTALLER_EXT={installer_ext}\n") - f.writelines(f"FULL_INSTALLER_FILENAME={installer_filename}.{installer_ext}\n") - - - name: Summarize the used Conan dependencies - shell: python - run: | - import os - import json - from pathlib import Path - - conan_install_info_path = Path("cura_inst/conan_install_info.json") - conan_info = {"installed": []} - if os.path.exists(conan_install_info_path): - with open(conan_install_info_path, "r") as f: - conan_info = json.load(f) - sorted_deps = sorted([dep["recipe"]["id"].replace('#', r' rev: ') for dep in conan_info["installed"]]) - - summary_env = os.environ["GITHUB_STEP_SUMMARY"] - content = "" - if os.path.exists(summary_env): - with open(summary_env, "r") as f: - content = f.read() - - with open(summary_env, "w") as f: - f.write(content) - f.writelines("# ${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}\n") - f.writelines("## Conan packages:\n") - for dep in sorted_deps: - f.writelines(f"`{dep}`\n") - - - name: Summarize the used Python modules - shell: python - run: | - import os - import pkg_resources - summary_env = os.environ["GITHUB_STEP_SUMMARY"] - content = "" - if os.path.exists(summary_env): - with open(summary_env, "r") as f: - content = f.read() - - with open(summary_env, "w") as f: - f.write(content) - f.writelines("## Python modules:\n") - for package in pkg_resources.working_set: - f.writelines(f"`{package.key}/{package.version}`\n") - - - name: Archive the artifacts (bash) - if: ${{ !inputs.installer && runner.os != 'Windows' }} - run: tar -zcf "./${{ steps.filename.outputs.INSTALLER_FILENAME }}.tar.gz" "./UltiMaker-Cura/" - working-directory: dist - - - name: Archive the artifacts (Powershell) - if: ${{ !inputs.installer && runner.os == 'Windows' }} - run: Compress-Archive -Path ".\UltiMaker-Cura" -DestinationPath ".\${{ steps.filename.outputs.INSTALLER_FILENAME }}.zip" - working-directory: dist - - - name: Create the Windows exe installer (Powershell) - if: ${{ inputs.installer && runner.os == 'Windows' && !inputs.msi_installer }} - run: | - python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" - working-directory: dist - - - name: Create the Windows msi installer (Powershell) - if: ${{ inputs.installer && runner.os == 'Windows' && inputs.msi_installer }} - run: | - python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" "$Env:CURA_APP_NAME" - working-directory: dist - - - name: Sign the Windows exe installer (Powershell) - if: ${{ inputs.installer && runner.os == 'Windows' && !inputs.msi_installer }} - env: - PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} - run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" - working-directory: dist - - - name: Sign the Windows msi installer (Powershell) - if: ${{ inputs.installer && runner.os == 'Windows' && inputs.msi_installer }} - env: - PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} - run: | - & "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" - working-directory: dist - - - name: Create the Linux AppImage (Bash) - if: ${{ inputs.installer && runner.os == 'Linux' }} - run: python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" - working-directory: dist - - - name: Create the MacOS dmg and/or pkg (Bash) - if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} - run: python ../cura_inst/packaging/MacOS/build_macos.py ../cura_inst . $CURA_CONAN_VERSION "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" "$CURA_APP_NAME" - working-directory: dist - - - name: Upload the artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.filename.outputs.INSTALLER_FILENAME }}-${{ steps.filename.outputs.INSTALLER_EXT }} - path: | - dist/*.tar.gz - dist/*.zip - dist/${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }} - dist/*.asc - retention-days: 5 - - notify-export: - if: ${{ always() }} - needs: [ cura-installer-create ] - - uses: ultimaker/cura/.github/workflows/notify.yml@main - with: - success: ${{ contains(join(needs.*.result, ','), 'success') }} - success_title: "Create the Cura distributions" - success_body: "Installers for ${{ inputs.cura_conan_version }}" - failure_title: "Failed to create the Cura distributions" - failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}" - secrets: inherit From bd57b43931c1c192e4bce50b0bac2b2cbb1cc4b4 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sun, 20 Aug 2023 12:49:25 +0200 Subject: [PATCH 30/31] Use runner OS and Arch specific configurations https://github.com/Ultimaker/Cura/issues/11841#issuecomment-1685076361 Contributes to CURA-8415 and CURA-10855 --- .github/workflows/linux.yml | 4 +++- .github/workflows/macos.yml | 8 +++----- .github/workflows/windows.yml | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 70a15bcbb5..4d58dcee34 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -144,7 +144,9 @@ jobs: run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import - name: Get Conan configuration - run: conan config install https://github.com/Ultimaker/conan-config.git + run: | + conan config install https://github.com/Ultimaker/conan-config.git + conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - name: Use Conan download cache (Bash) run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 736c906dab..4690d27878 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -144,15 +144,13 @@ jobs: p12-password: ${{ secrets.MACOS_CERT_PASSPHRASE }} - name: Get Conan configuration - run: conan config install https://github.com/Ultimaker/conan-config.git + run: | + conan config install https://github.com/Ultimaker/conan-config.git + conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - name: Use Conan download cache (Bash) run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" - - name: Set architecture conan profile - if: ${{ inputs.architecture == 'X64' }} - run: conan profile update settings.arch=x86_64 default - - name: Create the Packages (Bash) run: conan install $CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$ENTERPRISE -o cura:staging=$STAGING --json "cura_inst/conan_install_info.json" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 57bace2fef..88d9d84e94 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -114,7 +114,9 @@ jobs: run: conan profile new default --detect --force - name: Get Conan configuration - run: conan config install https://github.com/Ultimaker/conan-config.git + run: | + conan config install https://github.com/Ultimaker/conan-config.git + conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - name: Use Conan download cache (Powershell) run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" From 9000730ce72ebd395ca662e37513584acb45678c Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Wed, 23 Aug 2023 11:39:54 +0200 Subject: [PATCH 31/31] use template strings --- packaging/MacOS/build_macos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/MacOS/build_macos.py b/packaging/MacOS/build_macos.py index bde28afab0..eae9afceff 100644 --- a/packaging/MacOS/build_macos.py +++ b/packaging/MacOS/build_macos.py @@ -153,6 +153,6 @@ if __name__ == "__main__": app_name = f"{args.app_name}.app" if args.build_pkg: - create_pkg_installer(args.filename + ".pkg", args.dist_path, cura_version, app_name) + create_pkg_installer(f"{args.filename}.pkg", args.dist_path, cura_version, app_name) if args.build_dmg: - create_dmg(args.filename + ".dmg", args.dist_path, args.source_path, app_name) + create_dmg(f"{args.filename}.dmg", args.dist_path, args.source_path, app_name)