Skip to content

Commit

Permalink
Merge pull request #38 from Ledenel/pyinstaller-compactibility
Browse files Browse the repository at this point in the history
add macos and create release only on create.
  • Loading branch information
Ledenel authored Jan 24, 2020
2 parents 0a322e7 + f2922bb commit ee826c5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/pyinstallerbuild.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Pyinstaller build windows exectuable

on: release
on:
release:
types: [created]

jobs:
build:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- name: Setup Python environment
Expand All @@ -15,13 +20,14 @@ jobs:
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Build windows exectuable
- name: Build exectuable
run: |
./pyinstaller-build.bat
python pyinstaller_build.py
shell: bash
- name: Publish to github
run: |
chmod +x upload-script.sh
./upload-script.sh 'dist/*.exe'
./upload-script.sh 'dist/*'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions mahjong/win_rate_demo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from collections import Counter, defaultdict
from time import perf_counter

Expand Down Expand Up @@ -99,6 +100,7 @@ def main():
win_count * 100 / try_count,
win_count, try_count
, rough * 100, infinite * 100))
os.system('pause')


if __name__ == '__main__':
Expand Down
23 changes: 23 additions & 0 deletions pyinstaller_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import shlex

resources = [
os.path.join("mahjong", "templates"),
]
# pyinstaller --add-data=mahjong\templates;mahjong\templates -c --onefile mahjong\tenhou_record_check.py

targets = [
os.path.join("mahjong", "tenhou_record_check.py"),
os.path.join("mahjong", "win_rate_demo.py"),
]

resources_all = ' '.join(
"--add-data={}".format(
os.pathsep.join([res, res])
) for res in resources
)

for target in targets:
command = "pyinstaller {res} -c --onefile {target}".format(res=resources_all, target=target)
print("executing '{}'".format(command))
os.system(command)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="auto_white_reimu",
version="0.1.2",
version="0.1.3",
packages=find_packages(),
url="",
license="GPL",
Expand Down

0 comments on commit ee826c5

Please sign in to comment.