From df31666d0e4aee94f32119399c154fa853ae91e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Fri, 7 May 2021 14:15:57 +0200 Subject: [PATCH] CI: Fix dependencies hash (until next xmake version) --- .github/workflows/linux-build.yml | 2 +- .github/workflows/windows-build.yml | 2 +- xmake.lua | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 751c2e97c..3da0d43ef 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -53,7 +53,7 @@ jobs: # Fetch xmake dephash - name: Retrieve dependencies hash id: dep_hash - run: echo "::set-output name=hash::$(xmake l utils.ci.packageskey)" + run: echo "::set-output name=hash::$(xmake dephash)" # Cache xmake dependencies - name: Retrieve cached xmake dependencies diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 95087e1b3..499064adb 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -45,7 +45,7 @@ jobs: # Fetch xmake dephash - name: Retrieve dependencies hash id: dep_hash - run: echo "::set-output name=hash::$(xmake.exe l utils.ci.packageskey)" + run: echo "::set-output name=hash::$(xmake.exe dephash)" # Cache xmake dependencies - name: Retrieve cached xmake dependencies diff --git a/xmake.lua b/xmake.lua index 9e9f44ea0..b2429a5d8 100644 --- a/xmake.lua +++ b/xmake.lua @@ -190,3 +190,27 @@ rule("build_rendererplugins") end end end) + +-- Generates a hash key made of packages confs/version, for CI +task("dephash") + on_run(function () + import("core.project.project") + import("private.action.require.impl.package") + + local requires, requires_extra = project.requires_str() + + local key = {} + for _, instance in irpairs(package.load_packages(requires, {requires_extra = requires_extra})) do + table.insert(key, instance:name() .. "-" .. instance:version_str() .. "-" .. instance:buildhash()) + end + + table.sort(key) + + key = table.concat(key, ",") + print(hash.uuid4(key):gsub('-', ''):lower()) + end) + + set_menu { + usage = "xmake dephash", + description = "Outputs a hash key of current dependencies version/configuration" + }