From 1feadb4be71c1b60515f61daa00458a772a2b70e Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Tue, 26 Nov 2024 08:33:53 +0100 Subject: [PATCH] Update/fix nightly build (untested) --- .github/workflows/installers.yml | 16 +-- .github/workflows/nightly-stable.yml | 17 ++++ .github/workflows/nightly-testing.yml | 17 ++++ .github/workflows/nightly.yml | 99 +++++++++++++++++++ ...d.jinja => nightly_release_notes.md.jinja} | 4 +- 5 files changed, 136 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/nightly-stable.yml create mode 100644 .github/workflows/nightly-testing.yml create mode 100644 .github/workflows/nightly.yml rename .github/workflows/{release_notes.md.jinja => nightly_release_notes.md.jinja} (98%) diff --git a/.github/workflows/installers.yml b/.github/workflows/installers.yml index 134b2f5e89..b2b91b7e73 100644 --- a/.github/workflows/installers.yml +++ b/.github/workflows/installers.yml @@ -6,7 +6,7 @@ on: inputs: cura_conan_version: description: 'Cura Conan Version' - default: 'cura/latest@ultimaker/testing' + default: 'cura/[*]@ultimaker/testing' required: true type: string conan_args: @@ -24,11 +24,6 @@ on: default: false required: true type: boolean - nightly: - description: 'Upload to nightly release' - default: false - required: true - type: boolean workflow_call: inputs: @@ -48,15 +43,6 @@ on: default: false required: true type: boolean - nightly: - default: false - required: true - type: boolean - - schedule: - # Daily at 4:15 CET (main-branch) and 5:15 CET (release-branch) - - cron: '15 3 * * *' - - cron: '15 4 * * *' env: CONAN_ARGS: ${{ inputs.conan_args || '' }} diff --git a/.github/workflows/nightly-stable.yml b/.github/workflows/nightly-stable.yml new file mode 100644 index 0000000000..d8e1754fcf --- /dev/null +++ b/.github/workflows/nightly-stable.yml @@ -0,0 +1,17 @@ +name: Nightly build - stable release +run-name: Nightly build - stable release + +on: + schedule: + # Daily at 5:15 CET + - cron: '15 4 * * *' + +jobs: + build-nightly: +# FIXME: Use main once merged + uses: ultimaker/cura/.github/workflows/nightly.yml@CURA-11622_conan_v2 + with: +# FIXME: Use stable channel once merged + cura_conan_version: "cura/[*]@ultimaker/cura_11622" + release_tag: "nightly" + caller_workflow: "nightly-stable.yml" diff --git a/.github/workflows/nightly-testing.yml b/.github/workflows/nightly-testing.yml new file mode 100644 index 0000000000..e00d65ab85 --- /dev/null +++ b/.github/workflows/nightly-testing.yml @@ -0,0 +1,17 @@ +name: Nightly build - dev release +run-name: Nightly build - dev release + +on: + schedule: + # Daily at 4:15 CET + - cron: '15 3 * * *' + +jobs: + build-nightly: +# FIXME: Use main once merged + uses: ultimaker/cura/.github/workflows/nightly.yml@CURA-11622_conan_v2 + with: +# FIXME: Use testing channel once merged + cura_conan_version: "cura/[*]@ultimaker/cura_11622" + release_tag: "nightly-5.6" # Fixed version, we reuse the same tag forever + caller_workflow: "nightly-testing.yml" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..92c7ba64a0 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,99 @@ +name: Nightly build +run-name: Nightly build + +on: + workflow_call: + inputs: + cura_conan_version: + default: '' + required: true + type: string + release_tag: + default: '' + required: true + type: string + caller_workflow: + default: '' + required: true + type: string + + +jobs: + create-installers: + name: Create installers + id: create-installers +# FIXME: Use main once merged + uses: ultimaker/cura/github/workflows/installers.yml@CURA-11622_conan_v2 + with: + cura_conan_version: ${{ inputs.cura_conan_version }} + secrets: inherit + + update-nightly-release: + runs-on: ubuntu-latest + needs: [ create-installers ] + steps: + - name: Download installers jobs artifacts + uses: actions/download-artifact@v4 + with: + path: installers + merge-multiple: true + + - name: Rename the installers + id: rename-installers + shell: python + working-directory: installers + run: | + import os + + first_file = True + + for file in os.listdir("."): + if file.startswith("UltiMaker-Cura-"): + # Find the commit tag, and replace it with "nightly" + index_plus = file.index("+") + file_start = file[:index_plus] + file_end = file[index_plus:] + file_end = file_end[file_end.index("-")+1:] + + new_file_name = f"{file_start}-nightly-{file_end}" + os.rename(file, new_file_name) + + if first_file: + first_file = False + + short_version = file_start.split("-")[2] + short_version = ".".join(short_version.split(".")[:2]) + + with open(os.environ["GITHUB_OUTPUT"], "a") as github_output: + github_output.write(f"cura_version={file_start}\n") + github_output.write(f"short_version={file_start}\n") + + + - name: create the release notes + shell: python + run: | + import os + import datetime + from jinja2 import Template + + with open(".github/workflows/nightly_release_notes.md.jinja", "r") as f: + release_notes = Template(f.read()) + + short_version = "${{ steps.rename-installers.outputs.short_version }}" + caller_workflow = "${{ inputs.caller_workflow }}" + is_main = os.getenv("GITHUB_REF") == "refs/heads/main" + + with open("release-notes.md", "w") as f: + f.write(release_notes.render( + timestamp=str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")), + caller_workflow=caller_workflow, + branch="" if is_main else short_version, + branch_specific="" is_main else f"?branch={short_version}", + )) + + - name: Update nightly release description (with date) + if: always() + run: | + gh release edit ${{ inputs.release_tag }} --title "${{ steps.rename-installers.outputs.cura_version }}" --notes-file release-notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_notes.md.jinja b/.github/workflows/nightly_release_notes.md.jinja similarity index 98% rename from .github/workflows/release_notes.md.jinja rename to .github/workflows/nightly_release_notes.md.jinja index e66eeca677..62edf16408 100644 --- a/.github/workflows/release_notes.md.jinja +++ b/.github/workflows/nightly_release_notes.md.jinja @@ -4,7 +4,7 @@ | | | |--------------:|--------------------------------------------------------------------------------------------| -| **Nightlies** | [![nightly {{ branch }}](https://github.com/Ultimaker/Cura/actions/workflows/installers.yml/badge.svg{{ branch_specific }} +| **Nightlies** | [![nightly {{ branch }}](https://github.com/Ultimaker/Cura/actions/workflows/{{ caller_workflow }}/badge.svg{{ branch_specific }} ?event=schedule)](https://github.com/Ultimaker/Cura/actions/workflows/installers.yml) | # Unit Test results @@ -36,4 +36,4 @@ | **libSavitar** | [![conan-package](https://github.com/Ultimaker/libSavitar/actions/workflows/conan-package.yml/badge.svg)](https://github.com/Ultimaker/libSavitar/actions/workflows/conan-package.yml) | | **pySavitar** | [![conan-package](https://github.com/Ultimaker/pySavitar/actions/workflows/conan-package.yml/badge.svg)](https://github.com/Ultimaker/pySavitar/actions/workflows/conan-package.yml) | | **libnest2d** | [![conan-package](https://github.com/Ultimaker/libnest2d/actions/workflows/conan-package.yml/badge.svg)](https://github.com/Ultimaker/libnest2d/actions/workflows/conan-package.yml) | -| **pynest2d** | [![conan-package](https://github.com/Ultimaker/pynest2d/actions/workflows/conan-package.yml/badge.svg)](https://github.com/Ultimaker/pynest2d/actions/workflows/conan-package.yml) | \ No newline at end of file +| **pynest2d** | [![conan-package](https://github.com/Ultimaker/pynest2d/actions/workflows/conan-package.yml/badge.svg)](https://github.com/Ultimaker/pynest2d/actions/workflows/conan-package.yml) |