Skip to content

Commit

Permalink
chore: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-para committed Nov 25, 2024
1 parent 99a85cd commit cf56a7d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 67 deletions.
70 changes: 31 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ name: build
on:
push:
tags:
- "v*"
- 'v*'
branches:
- "**"
- '**'
paths:
- ".github/workflows/build.yml"
- "3rdparty/**"
- "cmake/**"
- "include/**"
- "source/**"
- "CMakeLists.txt"
- '.github/workflows/build.yml'
- '3rdparty/**'
- 'cmake/**'
- 'include/**'
- 'source/**'
- 'CMakeLists.txt'

pull_request:
branches:
- "**"
- '**'
paths:
- ".github/workflows/build.yml"
- "3rdparty/**"
- "cmake/**"
- "include/**"
- "source/**"
- "CMakeLists.txt"
- '.github/workflows/build.yml'
- '3rdparty/**'
- 'cmake/**'
- 'include/**'
- 'source/**'
- 'CMakeLists.txt'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "D:"
disk-root: 'D:'

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Build MAA
run: |
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DCMAKE_SYSTEM_VERSION="10.0.22621.0" -DMAADEPS_TRIPLET="maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows" -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DCMAKE_SYSTEM_VERSION="10.0.22621.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' }} - Release" -j 16
Expand All @@ -111,7 +111,7 @@ jobs:
if: always()
with:
name: MAA-win-${{ matrix.arch }}
path: "install"
path: 'install'

ubuntu:
needs: meta
Expand Down Expand Up @@ -177,7 +177,8 @@ jobs:
run: |
cmake --preset 'NinjaMulti' \
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux' \
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \
-DBUILD_NODEJS_BINDING=ON
cmake --build build --preset 'NinjaMulti - Release' -j 16
Expand All @@ -198,7 +199,7 @@ jobs:
if: always()
with:
name: MAA-linux-${{ matrix.arch }}
path: "install"
path: 'install'

macos:
needs: meta
Expand Down Expand Up @@ -258,7 +259,8 @@ jobs:
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-osx' \
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \
-DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++
-DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ \
-DBUILD_NODEJS_BINDING=ON
cmake --build build --preset 'NinjaMulti - Release' -j 16
Expand All @@ -279,7 +281,7 @@ jobs:
if: always()
with:
name: MAA-macos-${{ matrix.arch }}
path: "install"
path: 'install'

android:
needs: meta
Expand Down Expand Up @@ -345,7 +347,7 @@ jobs:
if: always()
with:
name: MAA-android-${{ matrix.arch }}
path: "install"
path: 'install'

nuget_pack:
needs: [meta, windows, ubuntu, macos, android]
Expand Down Expand Up @@ -375,7 +377,7 @@ jobs:
if: always()
with:
name: MAA-nupkgs
path: "tools/nupkgs/*.nupkg"
path: 'tools/nupkgs/*.nupkg'

pip_pack:
needs: [meta, windows, ubuntu, macos, android]
Expand All @@ -397,7 +399,7 @@ jobs:
if: always()
with:
name: MAA-pip-pkgs
path: "tools/pip_pack/wheel/*.whl"
path: 'tools/pip_pack/wheel/*.whl'

nodejs_pack:
needs: [meta, windows, ubuntu, macos, android]
Expand Down Expand Up @@ -434,21 +436,11 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: MAA-nodejs-package
path: "source/binding/NodeJS/release"
path: 'source/binding/NodeJS/release'

release:
if: ${{ needs.meta.outputs.is_release == 'true' && github.repository_id == '632024122' }}
needs:
[
meta,
windows,
ubuntu,
macos,
android,
nuget_pack,
pip_pack,
nodejs_pack,
]
needs: [meta, windows, ubuntu, macos, android, nuget_pack, pip_pack, nodejs_pack]
runs-on: ubuntu-latest
env:
OUTPUT_PUBLISH_FAILED: 'echo "failed=true" >> $GITHUB_OUTPUT && echo "::error::Failed to publish packages"'
Expand Down Expand Up @@ -537,8 +529,8 @@ jobs:
if: steps.nuget.outputs.failed || steps.pip.outputs.failed
uses: actions-cool/issues-helper@v3
with:
actions: "create-issue"
title: "${{ needs.meta.outputs.tag }} failed to publish packages"
actions: 'create-issue'
title: '${{ needs.meta.outputs.tag }} failed to publish packages'
body: |
Please manually publish the following packages:
${{ steps.nuget.outputs.failed && '- nuget @moomiji' || '' }}
Expand Down
54 changes: 28 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ name: test
on:
push:
branches:
- "**"
- '**'
paths:
- ".github/workflows/test.yml"
- "3rdparty/**"
- "cmake/**"
- "include/**"
- "source/**"
- "CMakeLists.txt"
- "test/**"
- '.github/workflows/test.yml'
- '3rdparty/**'
- 'cmake/**'
- 'include/**'
- 'source/**'
- 'CMakeLists.txt'
- 'test/**'

pull_request:
branches:
- "**"
- '**'
paths:
- ".github/workflows/test.yml"
- "3rdparty/**"
- "cmake/**"
- "include/**"
- "source/**"
- "CMakeLists.txt"
- "test/**"
- '.github/workflows/test.yml'
- '3rdparty/**'
- 'cmake/**'
- 'include/**'
- 'source/**'
- 'CMakeLists.txt'
- 'test/**'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "D:"
disk-root: 'D:'

- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Build MAA
run: |
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DMAADEPS_TRIPLET="maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows" -DCMAKE_SYSTEM_VERSION="10.0.22621.0" -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' -DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DMAADEPS_TRIPLET="maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows" -DCMAKE_SYSTEM_VERSION="10.0.22621.0" -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' -DBUILD_NODEJS_BINDING=ON -DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON
cmake --build build --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }} - Release" -j 16
Expand Down Expand Up @@ -132,13 +132,13 @@ jobs:
if: always()
with:
name: MAA-win-${{ matrix.arch }}-text_log
path: "install/bin/debug/*.log"
path: 'install/bin/debug/*.log'

- uses: actions/upload-artifact@v4
if: always()
with:
name: MAA-win-${{ matrix.arch }}-full_log
path: "install/bin/debug"
path: 'install/bin/debug'

ubuntu:
needs: meta
Expand Down Expand Up @@ -208,6 +208,7 @@ jobs:
cmake --preset 'NinjaMulti' \
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux' \
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \
-DBUILD_NODEJS_BINDING=ON \
-DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON
cmake --build build --preset 'NinjaMulti - Release' -j 16
Expand Down Expand Up @@ -250,13 +251,13 @@ jobs:
if: always()
with:
name: MAA-linux-${{ matrix.arch }}-text_log
path: "install/bin/debug/*.log"
path: 'install/bin/debug/*.log'

- uses: actions/upload-artifact@v4
if: always()
with:
name: MAA-linux-${{ matrix.arch }}-full_log
path: "install/bin/debug"
path: 'install/bin/debug'

macos:
needs: meta
Expand Down Expand Up @@ -318,9 +319,10 @@ jobs:
cmake --preset 'NinjaMulti' \
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-osx' \
-DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' \
-DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON \
-DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++
-DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ \
-DBUILD_NODEJS_BINDING=ON \
-DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON
cmake --build build --preset 'NinjaMulti - Release' -j 16
Expand Down Expand Up @@ -359,10 +361,10 @@ jobs:
if: always()
with:
name: MAA-macos-${{ matrix.arch }}-text_log
path: "install/bin/debug/*.log"
path: 'install/bin/debug/*.log'

- uses: actions/upload-artifact@v4
if: always()
with:
name: MAA-macos-${{ matrix.arch }}-full_log
path: "install/bin/debug"
path: 'install/bin/debug'
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ option(WITH_ADB_CONTROLLER "build with adb controller" ON)
option(WITH_WIN32_CONTROLLER "build with win32 controller" ON)
option(WITH_DBG_CONTROLLER "build with debugging controller" ON)
option(ENABLE_CCACHE "enable ccache if possible" ON)
option(BUILD_NODEJS_BINDING "build nodejs binding" ON)
option(BUILD_NODEJS_BINDING "build nodejs binding" OFF)

option(BUILD_SAMPLE "build a demo" OFF)

Expand Down
2 changes: 1 addition & 1 deletion source/binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(BUILD_NODEJS_BINDING)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/NodeJS/node_modules)
add_subdirectory(NodeJS)
else()
message("NodeJS/node_modules not found, install via `pnpm install` first.")
message(FATAL_ERROR "NodeJS/node_modules not found, install via `pnpm install` first.")
endif()
endif()

Expand Down

0 comments on commit cf56a7d

Please sign in to comment.