From 04300e5222604b42e7cfb7e067d14db8906d78d6 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 22 May 2024 22:13:29 +0200 Subject: [PATCH 1/3] GHA: Generate .import files for GDExtension icons --- .github/workflows/gdextension.yml | 45 +++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gdextension.yml b/.github/workflows/gdextension.yml index ac95ccb..8552229 100644 --- a/.github/workflows/gdextension.yml +++ b/.github/workflows/gdextension.yml @@ -36,6 +36,7 @@ env: SCONSFLAGS: dev_build=no debug_symbols=no EM_VERSION: 3.1.45 EM_CACHE_FOLDER: "emsdk-cache" + GODOT_VERSION: 4.2-stable jobs: gdextension: @@ -251,8 +252,8 @@ jobs: name: ${{ env.NAME }} path: out/* - merge-artifacts: - name: Merge artifacts + package-extension: + name: 📦 Package extension runs-on: ubuntu-latest needs: gdextension @@ -263,3 +264,43 @@ jobs: name: ${{needs.gdextension.outputs.name-prefix}} pattern: tmp-gdextension.* delete-merged: true + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{needs.gdextension.outputs.name-prefix}} + path: out/ + + - name: Setup Godot + shell: bash + run: | + echo "Downloading Godot ${GODOT_VERSION}" + mkdir bin + cd bin + wget "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip" -O godot.zip + unzip godot.zip + rm godot.zip + mv Godot_* godot + chmod u+x godot + ls -l + ./bin/godot --version + + - name: Generate icon .import files + shell: bash + run: | + timeout 20s ./bin/godot --headless --editor --path ./out/ || /bin/true + + - name: Change editor scale import settings + shell: bash + run: | + echo "--- Listing import files:" + ls out/addons/limboai/icons/*.import + echo "--- (end of listing)" + sed -i 's|editor/scale_with_editor_scale=false|editor/scale_with_editor_scale=true|' out/addons/limboai/icons/*.import + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{needs.gdextension.outputs.name-prefix}} + path: out/* + overwrite: true From fc1b99a5b1af0df7f36e5f8dc8b604ea7dbb43a6 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sat, 25 May 2024 10:16:40 +0200 Subject: [PATCH 2/3] GHA: Action that downloads & caches Linux toolchain TuxFamily is often down lately, maybe caching could help. --- .../actions/setup-linux-toolchain/action.yml | 42 +++++++++++++++++++ .github/workflows/gdextension.yml | 32 +++++--------- .github/workflows/linux.yml | 25 ++--------- .github/workflows/test_builds.yml | 14 ++----- 4 files changed, 61 insertions(+), 52 deletions(-) create mode 100644 .github/actions/setup-linux-toolchain/action.yml diff --git a/.github/actions/setup-linux-toolchain/action.yml b/.github/actions/setup-linux-toolchain/action.yml new file mode 100644 index 0000000..22795a1 --- /dev/null +++ b/.github/actions/setup-linux-toolchain/action.yml @@ -0,0 +1,42 @@ +name: Setup Linux toolchain + +inputs: + arch: + required: true + +runs: + using: "composite" + steps: + - name: Set TOOLCHAIN_URL (x86_64) + if: inputs.arch == 'x86_64' + shell: bash + run: | + echo "TOOLCHAIN_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2" >> "$GITHUB_ENV" + + - name: Set TOOLCHAIN_URL (x86_32) + if: inputs.arch == 'x86_32' + shell: bash + run: | + echo "TOOLCHAIN_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2" >> "$GITHUB_ENV" + + - name: Cache buildroot + id: cache-buildroot + uses: actions/cache@v4 + with: + path: buildroot + key: ${{env.TOOLCHAIN_SHA}} + + - name: Set up buildroot + if: steps.cache-buildroot.outputs.cache-hit != 'true' + shell: bash + run: | + mkdir buildroot + wget ${TOOLCHAIN_URL} -O buildroot/buildroot.tar.bz2 + cd buildroot + echo "${TOOLCHAIN_SHA} buildroot.tar.bz2" + echo "${TOOLCHAIN_SHA} buildroot.tar.bz2" | shasum --check + tar -xjf buildroot.tar.bz2 --strip-components=1 + ls -l + rm buildroot.tar.bz2 + ./relocate-sdk.sh + cd .. diff --git a/.github/workflows/gdextension.yml b/.github/workflows/gdextension.yml index 8552229..b8342db 100644 --- a/.github/workflows/gdextension.yml +++ b/.github/workflows/gdextension.yml @@ -133,25 +133,11 @@ jobs: id: output-name-prefix run: echo "name-prefix=${NAME_PREFIX}" >> $GITHUB_OUTPUT - - name: Set up Linux buildroot x86_64 - if: matrix.opts.platform == 'linux' && matrix.opts.arch == 'x86_64' - run: | - wget https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - mv x86_64-godot-linux-gnu_sdk-buildroot buildroot - cd buildroot - ./relocate-sdk.sh - cd .. - - - name: Set up Linux buildroot x86_32 - if: matrix.opts.platform == 'linux' && matrix.opts.arch == 'x86_32' - run: | - wget https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 - tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2 - mv i686-godot-linux-gnu_sdk-buildroot buildroot - cd buildroot - ./relocate-sdk.sh - cd .. + - name: Setup Linux toolchain + if: matrix.opts.platform == 'linux' + uses: ./limboai/.github/actions/setup-linux-toolchain + with: + arch: ${{matrix.opts.arch}} - name: Set up Python 3.x if: matrix.opts.platform == 'windows' || matrix.opts.platform == 'macos' @@ -283,18 +269,22 @@ jobs: mv Godot_* godot chmod u+x godot ls -l + cd .. ./bin/godot --version - name: Generate icon .import files shell: bash run: | + touch out/project.godot timeout 20s ./bin/godot --headless --editor --path ./out/ || /bin/true + rm out/project.godot + rm -rf out/.godot/ - name: Change editor scale import settings shell: bash run: | - echo "--- Listing import files:" - ls out/addons/limboai/icons/*.import + echo "--- Listing icons dir:" + ls out/addons/limboai/icons/ echo "--- (end of listing)" sed -i 's|editor/scale_with_editor_scale=false|editor/scale_with_editor_scale=true|' out/addons/limboai/icons/*.import diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 056e824..bdfbfa3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -139,27 +139,10 @@ jobs: # Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables. - uses: ./modules/limboai/.github/actions/init-version - # About sed see: https://github.com/godotengine/buildroot/issues/6 - - name: Set up buildroot x86_64 - if: matrix.opts.arch == 'x86_64' - run: | - wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - mv x86_64-godot-linux-gnu_sdk-buildroot buildroot - cd buildroot - sed -i x86_64-godot-linux-gnu/sysroot/usr/lib/pkgconfig/dbus-1.pc -e "s@/lib@/lib64@g" - ./relocate-sdk.sh - cd .. - - - name: Set up buildroot x86_32 - if: matrix.opts.arch == 'x86_32' - run: | - wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 - tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2 - mv i686-godot-linux-gnu_sdk-buildroot buildroot - cd buildroot - ./relocate-sdk.sh - cd .. + - name: Set up Linux toolchain + uses: ./modules/limboai/.github/actions/setup-linux-toolchain + with: + arch: ${{matrix.opts.arch}} - name: Set up scons cache uses: actions/cache@v4 diff --git a/.github/workflows/test_builds.yml b/.github/workflows/test_builds.yml index 4a961ab..f79e440 100644 --- a/.github/workflows/test_builds.yml +++ b/.github/workflows/test_builds.yml @@ -52,16 +52,10 @@ jobs: with: path: modules/limboai - # About sed see: https://github.com/godotengine/buildroot/issues/6 - - name: Set up buildroot x86_64 - run: | - wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 - mv x86_64-godot-linux-gnu_sdk-buildroot buildroot - cd buildroot - sed -i x86_64-godot-linux-gnu/sysroot/usr/lib/pkgconfig/dbus-1.pc -e "s@/lib@/lib64@g" - ./relocate-sdk.sh - cd .. + - name: Set up Linux toolchain + uses: ./modules/limboai/.github/actions/setup-linux-toolchain + with: + arch: x86_64 - name: Set up scons cache uses: actions/cache@v4 From e8816091e6011b70446a7008f00fd4b21c61cfc1 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sat, 25 May 2024 11:38:29 +0200 Subject: [PATCH 3/3] GHA: Verify toolchain checksum --- .../actions/setup-linux-toolchain/action.yml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-linux-toolchain/action.yml b/.github/actions/setup-linux-toolchain/action.yml index 22795a1..1a4f3df 100644 --- a/.github/actions/setup-linux-toolchain/action.yml +++ b/.github/actions/setup-linux-toolchain/action.yml @@ -7,17 +7,22 @@ inputs: runs: using: "composite" steps: - - name: Set TOOLCHAIN_URL (x86_64) - if: inputs.arch == 'x86_64' + - name: Set up environment shell: bash run: | - echo "TOOLCHAIN_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2" >> "$GITHUB_ENV" - - - name: Set TOOLCHAIN_URL (x86_32) - if: inputs.arch == 'x86_32' - shell: bash - run: | - echo "TOOLCHAIN_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2" >> "$GITHUB_ENV" + # ! Settings: + TOOLCHAIN_64_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 + TOOLCHAIN_64_SHA=16c8302fcb676c1f0fb9df73d6cff250ba1f4286 + TOOLCHAIN_32_URL=https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 + TOOLCHAIN_32_SHA=6171652abc54ef219e5187bc53660ee4e2f796f4 + # ! Export variables: + if [[ "${{ inputs.arch }}" == "x86_64" ]]; then + echo "TOOLCHAIN_URL=${TOOLCHAIN_64_URL}" >> "$GITHUB_ENV" + echo "TOOLCHAIN_SHA=${TOOLCHAIN_64_SHA}" >> "$GITHUB_ENV" + elif [[ "${{ inputs.arch }}" == "x86_32" ]]; then + echo "TOOLCHAIN_URL=${TOOLCHAIN_32_URL}" >> "$GITHUB_ENV" + echo "TOOLCHAIN_SHA=${TOOLCHAIN_32_SHA}" >> "$GITHUB_ENV" + fi - name: Cache buildroot id: cache-buildroot