Skip to content

Commit

Permalink
ci: add build CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jul 15, 2023
1 parent 877e8f9 commit f5c4789
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 4 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: build cli

on:
push:
tags:
- 'v*'
paths:
- '.github/workflows/ci.yml'
- 'source/cli/**'
pull_request:
paths:
- '.github/workflows/ci.yml'
- 'source/cli/**'
workflow_dispatch:

jobs:
meta:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
- id: set_tag
run: |
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
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
with:
submodules: true

- name: Download MaaFramework
uses: robinraju/[email protected]
with:
repository: MaaAssistantArknights/MaaFramework
latest: true
fileName: "MAA-win-${{ matrix.msbuild_target }}*"
out-file-path: "source/cli/${{ matrix.msbuild_target }}/Release"
extract: true

- run: ls -l source/cli/${{ matrix.msbuild_target }}/Release

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1

- name: Build MAA
run: |
MSBUILD source/cli/MAA1999_CLI.sln /t:rebuild /p:Configuration="Release" /p:Platform="${{ matrix.msbuild_target }}" /m /p:MAA_VERSION="${{ needs.meta.outputs.tag }}"
- name: Install
shell: bash
run: |
cd source/cli/${{ matrix.msbuild_target }}/Release
mkdir -p install
cp -r docs include resource MaaAgentBinary *.exe *.dll install
- uses: actions/upload-artifact@v3
with:
name: MAA1999-win-${{ matrix.msbuild_target }}
path: source/cli/${{ matrix.msbuild_target }}/Release/install

release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [meta, windows]
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/*
tag_name: ${{ needs.meta.outputs.tag }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "MaaFramework"]
path = MaaFramework
url = https://github.com/MaaAssistantArknights/MaaFramework.git
[submodule "assets/MaaAgentBinary"]
path = assets/MaaAgentBinary
url = https://github.com/MaaAssistantArknights/MaaAgentBinary.git
2 changes: 1 addition & 1 deletion MaaFramework
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
_只是一个临时的编译方法,因为 MAA 新架构还缺少一块重要拼图 [MaaCommon](https://github.com/MaaAssistantArknights/MaaCommon)(欢迎大佬们来带带),所以先简单糊一下_

1. 更新子模块 `git submodule update --init --recursive`
2. 下载 MaaFramework 的 Release 包,解压到 `source\cli\x64\Release`
2. 下载 MaaFramework 的 [Release 包](https://github.com/MaaAssistantArknights/MAA1999/releases),解压到 `source\cli\x64\Release`
3. 使用 Visual Studio 编译 `source\cli\MAA1999_CLI.sln`

## Join us
Expand Down
1 change: 1 addition & 0 deletions assets/MaaAgentBinary
Submodule MaaAgentBinary added at a1832c
4 changes: 2 additions & 2 deletions source/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ void save_config(const std::string& adb, const std::string& adb_address, const s
config["adb_address_Doc"] = "adb 连接地址,例如 127.0.0.1:5555";
config["tasks"] = json::array(tasks);
config["tasks_Doc"] = "要执行的任务,Wilderness, Psychube, Awards";
config["touch"] = ctrl_type & MaaAdbControllerType_Touch_Mask;
config["touch"] = (ctrl_type & MaaAdbControllerType_Touch_Mask) >> 0;
config["touch_Doc"] = "点击方式:1: Adb, 2: MiniTouch, 3: MaaTouch";
// config["key"] = key;
// config["key_Doc"] = "按键方式:1: Adb, 2: MaaTouch";
config["screencap"] = ctrl_type & MaaAdbControllerType_Screencap_Mask;
config["screencap"] = (ctrl_type & MaaAdbControllerType_Screencap_Mask) >> 16;
config["screencap_Doc"] = "截图方式:1: 自动测速, 2: RawByNetcat, 3: RawWithGzip, 4: Encode, 5: EncodeToFile, 6: "
"MinicapDirect, 7: MinicapStream";

Expand Down

0 comments on commit f5c4789

Please sign in to comment.