修改打包将test打包进去
This commit is contained in:
46
.github/workflows/reusable-release-skill.yaml
vendored
46
.github/workflows/reusable-release-skill.yaml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
python3.12 -c "import os,base64,pathlib,subprocess; os.environ['PATH']='/usr/local/bin:/usr/local/python3.12/bin:'+os.environ.get('PATH',''); p=pathlib.Path('/tmp/pyarmor-reg.zip'); p.write_bytes(base64.standard_b64decode(os.environ['PYARMOR_REG_B64'])); subprocess.run(['pyarmor','reg',str(p)],check=True); p.unlink(missing_ok=True)"
|
||||
fi
|
||||
|
||||
# 递归加密整个 scripts/(含 cli、service、db、util 等子包);产物保留与源码一致的 scripts/ 层级,入口为 scripts/main.py。
|
||||
# Obfuscate scripts recursively. Copy package support files as plain text.
|
||||
- name: Encrypt Source Code
|
||||
run: |
|
||||
export PATH="/usr/local/bin:/usr/local/python3.12/bin:${PATH:-}"
|
||||
@@ -78,9 +78,47 @@ jobs:
|
||||
set -euo pipefail
|
||||
test -d scripts
|
||||
( cd scripts && pyarmor gen --platform "${PYARMOR_PLATFORM}" -r -O ../dist/package/scripts . )
|
||||
cp SKILL.md dist/package/
|
||||
if [ -d references ]; then cp -r references dist/package/; fi
|
||||
if [ -d assets ]; then cp -r assets dist/package/; fi
|
||||
|
||||
printf '%s\n' \
|
||||
'import os' \
|
||||
'import shutil' \
|
||||
'' \
|
||||
"PACKAGE = 'dist/package'" \
|
||||
'' \
|
||||
'def common_ignore(dir_path, names):' \
|
||||
' ignored = set()' \
|
||||
' for name in names:' \
|
||||
' lower = name.lower()' \
|
||||
" if name in ('__pycache__', '.pytest_cache', 'artifacts'):" \
|
||||
' ignored.add(name)' \
|
||||
" elif lower.endswith('.pyc') or lower.endswith('.pyo') or lower.endswith('.db'):" \
|
||||
' ignored.add(name)' \
|
||||
' return list(ignored)' \
|
||||
'' \
|
||||
"ref_src = os.path.abspath('references')" \
|
||||
'' \
|
||||
'def references_ignore(dir_path, names):' \
|
||||
' ignored = set(common_ignore(dir_path, names))' \
|
||||
" if os.path.abspath(dir_path) == ref_src and 'REQUIREMENTS.md' in names:" \
|
||||
" ignored.add('REQUIREMENTS.md')" \
|
||||
' return list(ignored)' \
|
||||
'' \
|
||||
'def copy_dir(src, dst, ignore_fn):' \
|
||||
' if os.path.isdir(src):' \
|
||||
' shutil.copytree(src, dst, ignore=ignore_fn, dirs_exist_ok=True)' \
|
||||
'' \
|
||||
"shutil.copy2('SKILL.md', os.path.join(PACKAGE, 'SKILL.md'))" \
|
||||
"copy_dir('references', os.path.join(PACKAGE, 'references'), references_ignore)" \
|
||||
"copy_dir('assets', os.path.join(PACKAGE, 'assets'), common_ignore)" \
|
||||
"copy_dir('tests', os.path.join(PACKAGE, 'tests'), common_ignore)" \
|
||||
"copy_dir('evals', os.path.join(PACKAGE, 'evals'), common_ignore)" \
|
||||
'' \
|
||||
"print('Package top-level entries:')" \
|
||||
'for name in sorted(os.listdir(PACKAGE)):' \
|
||||
" print(' -', name)" \
|
||||
> /tmp/package_skill_release_copy.py
|
||||
|
||||
python3.12 /tmp/package_skill_release_copy.py
|
||||
|
||||
- name: Parse Metadata and Pack
|
||||
id: build_task
|
||||
|
||||
Reference in New Issue
Block a user