Skip to content

Commit

Permalink
加入自动检测
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Jul 23, 2022
1 parent 5059788 commit af41663
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/Windows_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ jobs:
#- name: Create Zip Package # 创建压缩包
# run: |
# zip -r ./dist/MacOS_ARM64.zip ./dist/app
- name: Run App Test # 运行程序检查是否返回 app run success
run: |
./dist/my_app.exe test
if [ $? -eq 0 ]; then
echo "app run success"
else
echo "app run failed"
exit 1
fi
- name: Upload Artifact # 上传构建产物,这里我们的源码目录是根目录,而实际运行的代码是构建后的 dist 目录
uses: actions/upload-artifact@v3
with:
Expand Down
10 changes: 5 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# -*- coding: utf-8 -*-
import os


def 查看系统所有环境变量():
from icecream import ic
# 打印系统所有的环境变量
for item in os.environ:
name = item
value = os.environ[item]
ic(name, value)
查看系统所有环境变量()

# 查看系统所有环境变量()
tagName = os.environ.get('GITHUB_REF_NAME')
print("tagName:", tagName)
# 获取运行目录
print("run dir:", os.getcwd())
# print("run dir:", os.getcwd())
# 获取文件目录
文件目录 = os.path.dirname(__file__)
print("file dir:", os.path.dirname(__file__))
versionFilePath = os.path.join(文件目录, "version.txt")
print("edit file {versionFilePath} output: version = {tagName}")
# 覆盖写出文件 version.py 中
with open(f'{文件目录}/version.py', 'w') as f:
with open(versionFilePath, 'w') as f:
f.write(f'version = "{tagName}"')

exit()

0 comments on commit af41663

Please sign in to comment.