Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add build_config #487

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ on:
- "source/**"
- "CMakeLists.txt"
workflow_dispatch:
inputs:
build_config:
required: true
default: 'Debug'
type: choice
options:
- Debug
- RelWithDebInfo
- Release

jobs:
meta:
Expand Down Expand Up @@ -91,13 +100,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
Expand Down Expand Up @@ -180,13 +189,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
Expand Down Expand Up @@ -262,13 +271,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
Expand Down Expand Up @@ -328,13 +337,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
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,15 +50,28 @@ jobs:
version=${tag#v}+${commit_hash}.$(date +%Y%m%d)
fi

if $is_release; then
if $is_pre_release; then
build_config="RelWithDebInfo"
else
build_config="Release"
fi
else
build_config="Debug"
fi

echo "tag=$tag
version=$version
is_release=$is_release
is_pre_release=$is_pre_release" | tee -a "$GITHUB_OUTPUT"
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 }}
tag: ${{ steps.set.outputs.tag }} # v<release version> | v<ci version>
version: ${{ steps.set.outputs.version }} # <release version> | <ci version>+<build> e.g ↓
build_config: ${{ steps.set.outputs.build_config }} # Release | RelWithDebInfo | Debug


# 主版本号.次版本号.修订号[-(alpha|beta|rc).预发布号]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 25 additions & 25 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@
"configuration": "Debug",
"jobs": 16
},
{
"name": "NinjaMulti - Release",
"displayName": "Ninja MultiConfig Release",
"description": "Ninja MultiConfig Release",
"configurePreset": "NinjaMulti",
"configuration": "Release",
"jobs": 16
},
{
"name": "NinjaMulti - RelWithDebInfo",
"displayName": "Ninja MultiConfig RelWithDebInfo",
Expand All @@ -85,6 +77,14 @@
"configuration": "RelWithDebInfo",
"jobs": 16
},
{
"name": "NinjaMulti - Release",
"displayName": "Ninja MultiConfig Release",
"description": "Ninja MultiConfig Release",
"configurePreset": "NinjaMulti",
"configuration": "Release",
"jobs": 16
},
{
"name": "MSVC 2022 - Debug",
"displayName": "MSVC 2022 Debug",
Expand All @@ -93,14 +93,6 @@
"configuration": "Debug",
"jobs": 16
},
{
"name": "MSVC 2022 - Release",
"displayName": "MSVC 2022 Release",
"description": "MSVC 2022 Release",
"configurePreset": "MSVC 2022",
"configuration": "Release",
"jobs": 16
},
{
"name": "MSVC 2022 - RelWithDebInfo",
"displayName": "MSVC 2022 RelWithDebInfo",
Expand All @@ -109,6 +101,14 @@
"configuration": "RelWithDebInfo",
"jobs": 16
},
{
"name": "MSVC 2022 - Release",
"displayName": "MSVC 2022 Release",
"description": "MSVC 2022 Release",
"configurePreset": "MSVC 2022",
"configuration": "Release",
"jobs": 16
},
{
"name": "MSVC 2022 ARM - Debug",
"displayName": "MSVC 2022 ARM Debug",
Expand All @@ -117,21 +117,21 @@
"configuration": "Debug",
"jobs": 16
},
{
"name": "MSVC 2022 ARM - Release",
"displayName": "MSVC 2022 ARM Release",
"description": "MSVC 2022 ARM Release",
"configurePreset": "MSVC 2022 ARM",
"configuration": "Release",
"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",
"description": "MSVC 2022 ARM Release",
"configurePreset": "MSVC 2022 ARM",
"configuration": "Release",
"jobs": 16
}
]
}
}
Loading