From fc98477d394269d79de03e653b7f212c382957d8 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 24 Jul 2023 18:37:11 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8D=E4=BA=A7=E7=89=A9?= =?UTF-8?q?=E5=8C=85=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 93 ++++++++++++---------------- CMakeLists.txt | 2 +- assets/resource/pipeline/main.json | 13 ---- assets/resource/pipeline/sample.json | 3 + 4 files changed, 42 insertions(+), 69 deletions(-) delete mode 100644 assets/resource/pipeline/main.json create mode 100644 assets/resource/pipeline/sample.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c56b6036c..60f42d41f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ on: - "cmake/**" - "CMakeLists.txt" - "*.sln" + pull_request: branches: - "**" @@ -44,60 +45,15 @@ jobs: windows: needs: meta - strategy: - matrix: - include: - - msbuild_target: x64 - lowercase_target: x64 - - msbuild_target: ARM64 - lowercase_target: arm64 - env: - MAABUILDER_TARGET_PLATFORM: ${{ matrix.msbuild_target }} runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - # Download host arch tools for Thrift of CustomThriftController - - name: Download host tools from MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py x64-windows - - - name: Bootstrap MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py ${{ matrix.lowercase_target }}-windows - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Build MAA - run: | - MSBUILD MAA.sln /t:rebuild /p:MAA_VERSION="${{ needs.meta.outputs.tag }}" /p:Configuration="Release" /p:Platform="${{ matrix.msbuild_target }}" /m - - - name: Install - shell: bash - run: | - cp -r docs ${{ matrix.msbuild_target }}/Release - rm -rf ${{ matrix.msbuild_target }}/Release/MaaThriftController - - - uses: actions/upload-artifact@v3 - with: - name: MAA-win-${{ matrix.lowercase_target }}-vcx - path: ${{ matrix.msbuild_target }}/Release - - windows-cmake: - needs: meta strategy: matrix: arch: [aarch64, x86_64] - runs-on: windows-latest steps: - uses: actions/checkout@v3 + with: + submodules: true # Download host arch tools for Thrift of CustomThriftController - name: Download host tools from MaaDeps @@ -119,21 +75,30 @@ jobs: cmake --build build --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }} - Release" cmake --install build --prefix install + - name: Remove msvc-debug + shell: bash + run: | + rm -rf install/bin/msvc-debug + + - name: Copy docs + shell: bash + run: | + cp -r docs install + - uses: actions/upload-artifact@v3 with: name: MAA-win-${{ matrix.arch }} path: "install" ubuntu: - runs-on: ubuntu-latest needs: meta + runs-on: ubuntu-latest + container: archlinux:base-devel strategy: matrix: arch: [aarch64, x86_64] - container: archlinux:base-devel - steps: - - uses: actions/checkout@v3 + steps: # maybe should explicitly update some pkg instead of all? - name: Update system run: | @@ -142,7 +107,12 @@ jobs: - name: Install dep run: | pacman -Sy - pacman -S --noconfirm cmake python ccache ninja + pacman -S --noconfirm cmake python ccache ninja git + + # https://github.com/MaaAssistantArknights/MaaFramework/actions/runs/5643408179/job/15285186255 + - uses: actions/checkout@v3 + with: + submodules: true - name: Install cross compile toolchains if: ${{ matrix.arch != 'x86_64' }} @@ -179,19 +149,26 @@ jobs: cmake --build build --preset 'NinjaMulti - Release' cmake --install build --prefix install + - name: Copy docs + run: | + cp -r docs install + - uses: actions/upload-artifact@v3 with: name: MAA-linux-${{ matrix.arch }} path: "install" macos: - runs-on: macos-latest needs: meta + runs-on: macos-latest strategy: matrix: arch: [aarch64, x86_64] + steps: - uses: actions/checkout@v3 + with: + submodules: true - name: Install dep run: | @@ -231,6 +208,10 @@ jobs: cmake --build build --preset 'NinjaMulti - Release' cmake --install build --prefix install + - name: Copy docs + run: | + cp -r docs install + - uses: actions/upload-artifact@v3 with: name: MAA-macos-${{ matrix.arch }} @@ -238,18 +219,20 @@ jobs: release: if: startsWith(github.ref, 'refs/tags/v') - # needs: [meta, windows, ubuntu] - needs: [meta, macos] + needs: [meta, windows, ubuntu] runs-on: ubuntu-latest + steps: - uses: actions/download-artifact@v3 with: path: assets + - run: | cd assets for f in *; do (cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .) done + - uses: softprops/action-gh-release@v1 with: files: assets/*.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index 341931707..a17a8878b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;") -option(BUILD_SAMPLE "build a demo" ON) +option(BUILD_SAMPLE "build a demo" OFF) option(BUILD_BUSYBOX "build the busybox" OFF) # option(INSTALL_DEVEL "install development files" OFF) # option(INSTALL_THIRD_LIBS "install third party libraries" ON) diff --git a/assets/resource/pipeline/main.json b/assets/resource/pipeline/main.json deleted file mode 100644 index 7f7d9e705..000000000 --- a/assets/resource/pipeline/main.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "EmptyTask": {}, - "ClickTest": { - "name": "ClickTest", - "action": "Click", - "target": [ - 0, - 0, - 0, - 0 - ] - } -} \ No newline at end of file diff --git a/assets/resource/pipeline/sample.json b/assets/resource/pipeline/sample.json new file mode 100644 index 000000000..f24088d36 --- /dev/null +++ b/assets/resource/pipeline/sample.json @@ -0,0 +1,3 @@ +{ + "EmptyTask": {} +}