Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Python Build and Package

on:
push:
branches: [ main, pr0 ]
pull_request:
branches: [ main ]
release:
types: [published]

jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# Windows builds
- os: windows
arch: x86_64
runner: windows-latest
executable_suffix: ".exe"
archive_ext: zip
# Linux builds
- os: linux
arch: x86_64
runner: ubuntu-latest
executable_suffix: ""
archive_ext: tar.gz
- os: linux
arch: aarch64
runner: ubuntu-latest
executable_suffix: ""
archive_ext: tar.gz

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.arch == 'aarch64' && 'arm64' || 'x64' }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller

- name: Build executable (Windows)
if: matrix.os == 'windows'
run: |
pyinstaller --clean `
--name "Minecraft-mod-classifier" `
--onefile `
--console `
--add-data "config/mods_data.json;." `
src/python/main.py
shell: pwsh

- name: Build executable (Linux)
if: matrix.os == 'linux'
run: |
pyinstaller --clean \
--name "Minecraft-mod-classifier" \
--onefile \
--console \
--add-data "config/mods_data.json:." \
src/python/main.py

- name: Prepare release package (Windows)
if: matrix.os == 'windows'
run: |
mkdir -p release/Minecraft-mod-classifier
copy dist\Minecraft-mod-classifier.exe release\Minecraft-mod-classifier\
copy README.md release\Minecraft-mod-classifier\
copy docs\QUICKSTART.md release\Minecraft-mod-classifier\
copy LICENSE release\Minecraft-mod-classifier\
mkdir release\Minecraft-mod-classifier\Input
mkdir release\Minecraft-mod-classifier\Output
mkdir release\Minecraft-mod-classifier\Output\ClientOnly
mkdir release\Minecraft-mod-classifier\Output\ServerOnly
mkdir release\Minecraft-mod-classifier\Output\ClientRequiredServerOptional
mkdir release\Minecraft-mod-classifier\Output\ClientOptionalServerRequired
mkdir release\Minecraft-mod-classifier\Output\ClientAndServerRequired
mkdir release\Minecraft-mod-classifier\Output\ClientOptionalServerOptional
mkdir release\Minecraft-mod-classifier\Output\Unknown
shell: pwsh

- name: Prepare release package (Linux)
if: matrix.os == 'linux'
run: |
mkdir -p release/Minecraft-mod-classifier
cp dist/Minecraft-mod-classifier release/Minecraft-mod-classifier/
cp README.md release/Minecraft-mod-classifier/
cp docs/QUICKSTART.md release/Minecraft-mod-classifier/
cp LICENSE release/Minecraft-mod-classifier/
mkdir -p release/Minecraft-mod-classifier/Input
mkdir -p release/Minecraft-mod-classifier/Output/{ClientOnly,ServerOnly,ClientRequiredServerOptional,ClientOptionalServerRequired,ClientAndServerRequired,ClientOptionalServerOptional,Unknown}
chmod +x release/Minecraft-mod-classifier/Minecraft-mod-classifier

- name: Create archive (Windows)
if: matrix.os == 'windows'
run: |
cd release
Compress-Archive -Path Minecraft-mod-classifier -DestinationPath "minecraft-mod-classifier-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}"
shell: pwsh

- name: Create archive (Linux)
if: matrix.os == 'linux'
run: |
cd release
tar -czf "minecraft-mod-classifier-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}" Minecraft-mod-classifier

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: minecraft-mod-classifier-${{ matrix.os }}-${{ matrix.arch }}
path: release/minecraft-mod-classifier-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}
retention-days: 30

release:
if: github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts

- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
release-artifacts/*/*.zip
release-artifacts/*/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
165 changes: 130 additions & 35 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,140 @@
# Prerequisites
*.d
# ============================================
# Minecraft Mod Classifier - .gitignore
# ============================================

# Compiled Object files
*.slo
*.lo
*.o
*.obj
# --------------------------------------------
# Python 相关
# --------------------------------------------
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*.pyc

# Precompiled Headers
*.gch
*.pch
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Linker files
*.ilk
# PyInstaller
*.manifest
*.spec

# Debugger Files
*.pdb
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Environments
.env
.venv
env/
venv/
ENV/

# Fortran module files
*.mod
*.smod
# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# --------------------------------------------
# IDE 和编辑器
# --------------------------------------------
.vscode/
*.code-workspace
.idea/
*.iml
*.iws
*.ipr

# Executables
*.exe
*.out
*.app
# Vim
*.swp
*.swo
*~

# --------------------------------------------
# 操作系统文件
# --------------------------------------------
# macOS
.DS_Store
.AppleDouble
.LSOverride

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# --------------------------------------------
# 项目特定文件
# --------------------------------------------
# 日志文件
*.log
mod_classifier.log

# 配置文件(包含用户数据,不应版本控制)
config/mods_data.json
config/mods_data.json.backup
config/settings.json

# debug information files
*.dwo
# 输入输出目录(用户数据)
Input/
Output/

/.idea
/build
/cmake-build-debug
# 测试文件
test_*.py
*_test.py

# 临时文件
*.tmp
*.temp
*~

# --------------------------------------------
# 构建和发布产物(不应版本控制)
# --------------------------------------------
# PyInstaller 构建输出
build/
dist/

# 发布包(应该在release时生成,不提交到仓库)
release/

# --------------------------------------------
# C++ 遗留文件
# --------------------------------------------
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
Makefile
*.o
*.obj
*.exe
*.dll
*.so
*.dylib
*.a
*.lib
21 changes: 0 additions & 21 deletions CMakeLists.txt

This file was deleted.

44 changes: 44 additions & 0 deletions Minecraft-mod-classifier.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['src\\python\\main.py'],
pathex=['src/python'],
binaries=[],
datas=[('config/mods_data.json', 'config')],
hiddenimports=['mod_classifier', 'logger', 'config_manager', 'jar_parser', 'file_utils', 'i18n'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='Minecraft-mod-classifier',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Minecraft-mod-classifier',
)
Loading
Loading