Skip to content

Commit

Permalink
chore: 更新CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Feb 13, 2024
1 parent acb3520 commit 115d4c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 206 deletions.
17 changes: 0 additions & 17 deletions .github/update_resource_version.py

This file was deleted.

92 changes: 6 additions & 86 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build cli
name: install

on:
push:
Expand All @@ -8,23 +8,13 @@ on:
- "**"
paths:
- ".github/workflows/ci.yml"
- "source/cli/**"
- "MaaFramework/**"
- "assets/**"
- "cmake/**"
- "CMakelists.txt"
- "CMakePresets.json"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/ci.yml"
- "source/cli/**"
- "MaaFramework/**"
- "assets/**"
- "cmake/**"
- "CMakelists.txt"
- "CMakePresets.json"
- ".github/workflows/ci.yml"
- "assets/**"
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -70,10 +60,6 @@ jobs:
with:
submodules: true

- name: Update resource version
run: |
python3 .github/update_resource_version.py assets/resource/properties.json ${{ needs.meta.outputs.tag }}
- name: Download MaaFramework
uses: robinraju/[email protected]
with:
Expand All @@ -83,16 +69,10 @@ jobs:
out-file-path: "deps"
extract: true

- name: Build M9A
run: |
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DM9A_HASH_VERSION='${{ needs.meta.outputs.tag }}'
cmake --build build --config Release -j 16
- name: Install
shell: bash
run: |
cmake --install build --prefix install
python ./install.py ${{ needs.meta.outputs.tag }}
- uses: actions/upload-artifact@v3
with:
Expand All @@ -109,36 +89,11 @@ jobs:
fail-fast: false

steps:
# maybe should explicitly update some pkg instead of all?
- name: Update system
run: |
pacman -Syu --noconfirm
- name: Install dep
run: |
pacman -Sy
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' }}
run: |
pacman -Sy
pacman -S --noconfirm aarch64-linux-gnu-gcc
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
remove_stale_cache: false

- name: Update resource version
run: |
python3 .github/update_resource_version.py assets/resource/properties.json ${{ needs.meta.outputs.tag }}
- name: Download MaaFramework
uses: robinraju/[email protected]
with:
Expand All @@ -148,20 +103,10 @@ jobs:
out-file-path: "deps"
extract: true

- name: Build M9A
env:
CC: ${{ matrix.arch == 'x86_64' && 'ccache gcc' || 'ccache aarch64-linux-gnu-gcc' }}
CXX: ${{ matrix.arch == 'x86_64' && 'ccache g++' || 'ccache aarch64-linux-gnu-g++' }}
run: |
cmake --preset 'NinjaMulti' \
-DM9A_HASH_VERSION='${{ needs.meta.outputs.tag }}'
cmake --build build --config Release -j 16
- name: Install
shell: bash
run: |
cmake --install build --prefix install
python ./install.py ${{ needs.meta.outputs.tag }}
- uses: actions/upload-artifact@v3
with:
Expand All @@ -181,20 +126,6 @@ jobs:
with:
submodules: true

- name: Install dep
run: |
brew install cmake python ninja
# ccache?

- name: Install compiler
run: |
brew install llvm
# 16

- name: Update resource version
run: |
python3 .github/update_resource_version.py assets/resource/properties.json ${{ needs.meta.outputs.tag }}
- name: Download MaaFramework
uses: robinraju/[email protected]
with:
Expand All @@ -204,21 +135,10 @@ jobs:
out-file-path: "deps"
extract: true

- name: Build M9A
env:
CC: "/usr/local/opt/llvm/bin/clang"
CXX: "/usr/local/opt/llvm/bin/clang++"
run: |
cmake --preset 'NinjaMulti' \
-DARCH='${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}' \
-DM9A_HASH_VERSION='${{ needs.meta.outputs.tag }}'
cmake --build build --config Release -j 16
- name: Install
shell: bash
run: |
cmake --install build --prefix install
python ./install.py ${{ needs.meta.outputs.tag }}
- uses: actions/upload-artifact@v3
with:
Expand Down
103 changes: 0 additions & 103 deletions CMakePresets.json

This file was deleted.

20 changes: 20 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from pathlib import Path

import shutil
import sys
import json

working_dir = Path(__file__).parent
install_path = working_dir / Path("install")
version = len(sys.argv) > 1 and sys.argv[1] or "v0.0.1"

if __name__ == "__main__":
shutil.copytree(
Expand Down Expand Up @@ -36,3 +40,19 @@
install_path / "resource" / "base" / "model" / "ocr",
dirs_exist_ok=True,
)
shutil.copy2(
working_dir / "README.md",
install_path,
)
shutil.copy2(
working_dir / "LICENSE",
install_path,
)

with open(install_path / "interface.json", "r", encoding="utf-8") as f:
interface = json.load(f)

interface["version"] = version

with open(install_path / "interface.json", "w", encoding="utf-8") as f:
json.dump(interface, f, ensure_ascii=False, indent=4)

0 comments on commit 115d4c5

Please sign in to comment.