From 38ca264f6a9ebbe67f2ca1e0df410340204e022b Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 20 Dec 2024 16:59:03 +0800 Subject: [PATCH 1/5] ci: add build_config --- .github/workflows/build.yml | 26 ++++++++++++++++++-------- .github/workflows/meta.yml | 15 ++++++++++++++- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a4da4069..13853acc9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,16 @@ on: - "source/**" - "CMakeLists.txt" workflow_dispatch: + inputs: + build_config: + required: true + default: 'Debug' + type: choice + options: + - Debug + - RelWithDebInfo + - Release + - MinSizeRel jobs: meta: @@ -91,13 +101,13 @@ jobs: run: | cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DCMAKE_SYSTEM_VERSION="10.0.26100.0" -DMAADEPS_TRIPLET="maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows" -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' -DBUILD_NODEJS_BINDING=ON - cmake --build build --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }} - RelWithDebInfo" -j 16 + cmake --build build --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }} - ${{ inputs.build_config || needs.meta.outputs.build_config }}" -j 16 - name: Install shell: bash if: always() run: | - cmake --install build --prefix install --config RelWithDebInfo + cmake --install build --prefix install --config ${{ inputs.build_config || needs.meta.outputs.build_config }} rm -rf install/bin/msvc-debug cp -r docs install @@ -180,13 +190,13 @@ jobs: -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \ -DBUILD_NODEJS_BINDING=ON - cmake --build build --preset 'NinjaMulti - RelWithDebInfo' -j 16 + cmake --build build --preset 'NinjaMulti - ${{ inputs.build_config || needs.meta.outputs.build_config }}' -j 16 - name: Install shell: bash if: always() run: | - cmake --install build --prefix install --config RelWithDebInfo + cmake --install build --prefix install --config ${{ inputs.build_config || needs.meta.outputs.build_config }} cp -r docs install cp README*.md install @@ -262,13 +272,13 @@ jobs: -DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ \ -DBUILD_NODEJS_BINDING=ON - cmake --build build --preset 'NinjaMulti - RelWithDebInfo' -j 16 + cmake --build build --preset 'NinjaMulti - ${{ inputs.build_config || needs.meta.outputs.build_config }}' -j 16 - name: Install shell: bash if: always() run: | - cmake --install build --prefix install --config RelWithDebInfo + cmake --install build --prefix install --config ${{ inputs.build_config || needs.meta.outputs.build_config }} cp -r docs install cp README*.md install @@ -328,13 +338,13 @@ jobs: -DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-android' \ -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' - cmake --build build --preset 'NinjaMulti - RelWithDebInfo' -j 16 + cmake --build build --preset 'NinjaMulti - ${{ inputs.build_config || needs.meta.outputs.build_config }}' -j 16 - name: Install shell: bash if: always() run: | - cmake --install build --prefix install --config RelWithDebInfo + cmake --install build --prefix install --config ${{ inputs.build_config || needs.meta.outputs.build_config }} cp -r docs install cp README*.md install diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 5a7448216..ee2d50723 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -11,7 +11,8 @@ on: value: ${{ jobs.set.outputs.tag }} version: value: ${{ jobs.set.outputs.version }} - + build_config: + value: ${{ jobs.set.outputs.build_config }} jobs: set: runs-on: ubuntu-latest @@ -53,11 +54,23 @@ jobs: version=$version is_release=$is_release is_pre_release=$is_pre_release" | tee -a "$GITHUB_OUTPUT" + + if $is_release; then + if $is_pre_release; then + build_config="RelWithDebInfo" + else + build_config="Release" + fi + else + build_config="Debug" + fi + build_config=$build_config" | tee -a "$GITHUB_OUTPUT" outputs: is_release: ${{ steps.set.outputs.is_release }} is_pre_release: ${{ steps.set.outputs.is_pre_release }} tag: ${{ steps.set.outputs.tag }} # v | v version: ${{ steps.set.outputs.version }} # | + e.g ↓ + build_config: ${{ steps.set.outputs.build_config }} # Release | RelWithDebInfo | Debug # 主版本号.次版本号.修订号[-(alpha|beta|rc).预发布号] From 8e1db9fc2c811090f4b62e8fb3416e76704eec2f Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 20 Dec 2024 17:01:10 +0800 Subject: [PATCH 2/5] ci: fix meta --- .github/workflows/meta.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index ee2d50723..82e80825c 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -50,11 +50,6 @@ jobs: version=${tag#v}+${commit_hash}.$(date +%Y%m%d) fi - echo "tag=$tag - version=$version - is_release=$is_release - is_pre_release=$is_pre_release" | tee -a "$GITHUB_OUTPUT" - if $is_release; then if $is_pre_release; then build_config="RelWithDebInfo" @@ -64,7 +59,13 @@ jobs: else build_config="Debug" fi + + echo "tag=$tag + version=$version + is_release=$is_release + is_pre_release=$is_pre_release build_config=$build_config" | tee -a "$GITHUB_OUTPUT" + outputs: is_release: ${{ steps.set.outputs.is_release }} is_pre_release: ${{ steps.set.outputs.is_pre_release }} From 83521b4a1f99237edfd520f678c9e5f41eae1a9b Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 20 Dec 2024 17:05:49 +0800 Subject: [PATCH 3/5] build: add MinSizeRel --- CMakePresets.json | 50 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 729b8d53b..91c1db85d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -69,6 +69,14 @@ "configuration": "Debug", "jobs": 16 }, + { + "name": "NinjaMulti - RelWithDebInfo", + "displayName": "Ninja MultiConfig RelWithDebInfo", + "description": "Ninja MultiConfig RelWithDebInfo", + "configurePreset": "NinjaMulti", + "configuration": "RelWithDebInfo", + "jobs": 16 + }, { "name": "NinjaMulti - Release", "displayName": "Ninja MultiConfig Release", @@ -78,11 +86,11 @@ "jobs": 16 }, { - "name": "NinjaMulti - RelWithDebInfo", - "displayName": "Ninja MultiConfig RelWithDebInfo", - "description": "Ninja MultiConfig RelWithDebInfo", + "name": "NinjaMulti - MinSizeRel", + "displayName": "Ninja MultiConfig MinSizeRel", + "description": "Ninja MultiConfig MinSizeRel", "configurePreset": "NinjaMulti", - "configuration": "RelWithDebInfo", + "configuration": "MinSizeRel", "jobs": 16 }, { @@ -93,6 +101,14 @@ "configuration": "Debug", "jobs": 16 }, + { + "name": "MSVC 2022 - RelWithDebInfo", + "displayName": "MSVC 2022 RelWithDebInfo", + "description": "MSVC 2022 RelWithDebInfo", + "configurePreset": "MSVC 2022", + "configuration": "RelWithDebInfo", + "jobs": 16 + }, { "name": "MSVC 2022 - Release", "displayName": "MSVC 2022 Release", @@ -102,11 +118,11 @@ "jobs": 16 }, { - "name": "MSVC 2022 - RelWithDebInfo", - "displayName": "MSVC 2022 RelWithDebInfo", - "description": "MSVC 2022 RelWithDebInfo", + "name": "MSVC 2022 - MinSizeRel", + "displayName": "MSVC 2022 MinSizeRel", + "description": "MSVC 2022 MinSizeRel", "configurePreset": "MSVC 2022", - "configuration": "RelWithDebInfo", + "configuration": "MinSizeRel", "jobs": 16 }, { @@ -117,6 +133,14 @@ "configuration": "Debug", "jobs": 16 }, + { + "name": "MSVC 2022 ARM - RelWithDebInfo", + "displayName": "MSVC 2022 ARM RelWithDebInfo", + "description": "MSVC 2022 ARM RelWithDebInfo", + "configurePreset": "MSVC 2022 ARM", + "configuration": "RelWithDebInfo", + "jobs": 16 + }, { "name": "MSVC 2022 ARM - Release", "displayName": "MSVC 2022 ARM Release", @@ -126,12 +150,12 @@ "jobs": 16 }, { - "name": "MSVC 2022 ARM - RelWithDebInfo", - "displayName": "MSVC 2022 ARM RelWithDebInfo", - "description": "MSVC 2022 ARM RelWithDebInfo", + "name": "MSVC 2022 ARM - MinSizeRel", + "displayName": "MSVC 2022 ARM MinSizeRel", + "description": "MSVC 2022 ARM MinSizeRel", "configurePreset": "MSVC 2022 ARM", - "configuration": "RelWithDebInfo", + "configuration": "MinSizeRel", "jobs": 16 } ] -} +} \ No newline at end of file From 08dadbad6e5cbd4d0fc606c9fc8bfae8b7c3fdd2 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 20 Dec 2024 17:13:01 +0800 Subject: [PATCH 4/5] ci: remove MinSizeRel --- .github/workflows/build.yml | 1 - CMakePresets.json | 24 ------------------------ 2 files changed, 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13853acc9..6b1449c76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,6 @@ on: - Debug - RelWithDebInfo - Release - - MinSizeRel jobs: meta: diff --git a/CMakePresets.json b/CMakePresets.json index 91c1db85d..115ed7614 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -85,14 +85,6 @@ "configuration": "Release", "jobs": 16 }, - { - "name": "NinjaMulti - MinSizeRel", - "displayName": "Ninja MultiConfig MinSizeRel", - "description": "Ninja MultiConfig MinSizeRel", - "configurePreset": "NinjaMulti", - "configuration": "MinSizeRel", - "jobs": 16 - }, { "name": "MSVC 2022 - Debug", "displayName": "MSVC 2022 Debug", @@ -117,14 +109,6 @@ "configuration": "Release", "jobs": 16 }, - { - "name": "MSVC 2022 - MinSizeRel", - "displayName": "MSVC 2022 MinSizeRel", - "description": "MSVC 2022 MinSizeRel", - "configurePreset": "MSVC 2022", - "configuration": "MinSizeRel", - "jobs": 16 - }, { "name": "MSVC 2022 ARM - Debug", "displayName": "MSVC 2022 ARM Debug", @@ -148,14 +132,6 @@ "configurePreset": "MSVC 2022 ARM", "configuration": "Release", "jobs": 16 - }, - { - "name": "MSVC 2022 ARM - MinSizeRel", - "displayName": "MSVC 2022 ARM MinSizeRel", - "description": "MSVC 2022 ARM MinSizeRel", - "configurePreset": "MSVC 2022 ARM", - "configuration": "MinSizeRel", - "jobs": 16 } ] } \ No newline at end of file From 2d4d616277fca1d5379437f3e49c8be6e9ca6965 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 20 Dec 2024 17:22:59 +0800 Subject: [PATCH 5/5] ci: format --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa2f324f4..e424b6fa4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -336,7 +336,7 @@ jobs: -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \ -DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang \ -DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ \ - -DBUILD_NODEJS_BINDING=ON \ + -DBUILD_NODEJS_BINDING=ON \ -DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON cmake --build build --preset 'NinjaMulti - Debug' -j 16