From dd92fcc4d814a746f90adbab22416ca4561c13f1 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 20:02:17 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 196 +++++++++++++++++++++++++++ README.md | 8 +- 2 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-app-test.yml diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml new file mode 100644 index 0000000..93184c0 --- /dev/null +++ b/.github/workflows/build-app-test.yml @@ -0,0 +1,196 @@ +# AUTO_MAA:A MAA Multi Account Management and Automation Tool +# Copyright © 2024-2025 DLmaster361 + +# This file is part of AUTO_MAA. + +# AUTO_MAA is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. + +# AUTO_MAA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with AUTO_MAA. If not, see . + +# Contact: DLmaster_361@163.com + +name: Build AUTO_MAA Test + +on: + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + + pre_check: + name: Pre Checks + runs-on: ubuntu-latest + + steps: + - name: Repo Check + id: repo_check + run: | + if [[ "$GITHUB_REPOSITORY" != "DLmaster361/AUTO_MAA" ]]; then + echo "When forking this repository to make your own builds, you have to adjust this check." + exit 1 + fi + exit 0 + + build_AUTO_MAA: + runs-on: windows-latest + needs: pre_check + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + pip install -r requirements.txt + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Get version + id: get_version + run: | + $version = (Get-Content resources/version.json | ConvertFrom-Json).main_version + echo "main_version=$version" >> $env:GITHUB_OUTPUT + + - name: Nuitka build main program + uses: Nuitka/Nuitka-Action@main + with: + script-name: main.py + mode: app + enable-plugins: pyside6 + onefile-tempdir-spec: "{TEMP}/AUTO_MAA" + windows-console-mode: disable + windows-icon-from-ico: resources/icons/AUTO_MAA.ico + company-name: AUTO_MAA Team + product-name: AUTO_MAA + file-version: ${{ steps.get_version.outputs.main_version }} + product-version: ${{ steps.get_version.outputs.main_version }} + file-description: AUTO_MAA Component + copyright: Copyright © 2024-2025 DLmaster361 + assume-yes-for-downloads: true + output-file: AUTO_MAA + output-dir: AUTO_MAA + + - name: Upload unsigned artifact + id: upload-unsigned-artifact + uses: actions/upload-artifact@v4 + with: + path: AUTO_MAA/AUTO_MAA.exe + + - name: Sign main program + id: sign_main_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_Test' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "single-exe" + github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA' + + - name: Add resources to AUTO_MAA directory + shell: pwsh + run: | + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + Copy-Item "$root/app" "$root/AUTO_MAA/app" -Recurse + Copy-Item "$root/resources" "$root/AUTO_MAA/resources" -Recurse + Copy-Item "$root/main.py" "$root/AUTO_MAA/" + Copy-Item "$root/requirements.txt" "$root/AUTO_MAA/" + Copy-Item "$root/README.md" "$root/AUTO_MAA/" + Copy-Item "$root/LICENSE" "$root/AUTO_MAA/" + + - name: Create Inno Setup script + shell: pwsh + run: | + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + $iss = Get-Content "$root/app/utils/AUTO_MAA.iss" -Raw + $iss = $iss -replace '#define MyAppVersion ""', "#define MyAppVersion `"$ver`"" + $iss = $iss -replace '#define MyAppPath ""', "#define MyAppPath `"$root/AUTO_MAA`"" + $iss = $iss -replace '#define OutputDir ""', "#define OutputDir `"$root`"" + Set-Content -Path "$root/AUTO_MAA.iss" -Value $iss + + - name: Build setup program + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 + with: + path: AUTO_MAA.iss + + - name: Compress setup exe + shell: pwsh + run: | + $root = "${{ github.workspace }}" + New-Item -ItemType Directory -Force -Path "$root/AUTO_MAA_Setup" + Move-Item "$root/AUTO_MAA-Setup.exe" "$root/AUTO_MAA_Setup/" + Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + + - name: Generate version info + shell: python + run: | + import json + from pathlib import Path + def version_text(version_numb): + while len(version_numb) < 4: + version_numb.append(0) + if version_numb[3] == 0: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}" + else: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}" + def version_info_markdown(info): + version_info = "" + for key, value in info.items(): + version_info += f"## {key}\n" + for v in value: + version_info += f"- {v}\n" + return version_info + root_path = Path(".") + version = json.loads((root_path / "resources/version.json").read_text(encoding="utf-8")) + main_version_numb = list(map(int, version["main_version"].split("."))) + all_version_info = {} + for v_i in version["version_info"].values(): + for key, value in v_i.items(): + if key in all_version_info: + all_version_info[key] += value.copy() + else: + all_version_info[key] = value.copy() + (root_path / "version_info.txt").write_text( + f"{version_text(main_version_numb)}\n\n\n{version_info_markdown(all_version_info)}", + encoding="utf-8", + ) + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA_${{ steps.get_version.outputs.main_version }} + path: AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + + - name: Upload Version_Info Artifact + uses: actions/upload-artifact@v4 + with: + name: version_info + path: version_info.txt \ No newline at end of file diff --git a/README.md b/README.md index aa5331d..e8343ed 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,12 @@ 可在[《AUTO_MAA开发者协作文档》](https://docs.qq.com/aio/DQ3Z5eHNxdmxFQmZX)的`开发任务`页面中查看开发进度。 +## 特别鸣谢 + +- 下载服务器:由[AoXuan (@ClozyA)](https://github.com/ClozyA) 个人为项目赞助。 + +- EXE签名: Free code signing provided by [SignPath.io](https://signpath.io/), certificate by [SignPath Foundation](https://signpath.org/) + ## 贡献者 感谢以下贡献者对本项目做出的贡献 @@ -87,8 +93,6 @@ ![Alt](https://repobeats.axiom.co/api/embed/6c2f834141eff1ac297db70d12bd11c6236a58a5.svg "Repobeats analytics image") -感谢 [AoXuan (@ClozyA)](https://github.com/ClozyA) 为本项目提供的下载服务器 - ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=DLmaster361/AUTO_MAA&type=Date)](https://star-history.com/#DLmaster361/AUTO_MAA&Date)