-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (76 loc) · 2.95 KB
/
pythonpackage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: RunTests
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
# Use pip requirements.txt cache https://github.com/actions/cache/blob/master/examples.md#python---pip
# Apparently you can't use cache when using pipenv (but perhaps when specifying the pipenv environment folder?)
- name: Install poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest
- name: Run radon (cyclomatic complexity report)
# './' denotes the current directory
run: |
poetry run radon cc ./ -a -nb
# Copy sc2reader contents from library to local folder, because pyinstaller doesn't include the .csv files from the library folder
- name: Copy sc2reader folder contents
run: |
pip install sc2reader
echo $env:pythonLocation
xcopy $env:pythonLocation\lib\site-packages\sc2reader\* sc2reader /s /i
ls
pip uninstall sc2reader -y
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'
- name: Build windows binary
run: |
poetry run pyinstaller ReplayRenamer.py --onefile --clean --noconfirm --add-data "sc2reader;sc2reader"
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'
- name: List contents of dist folder
run: |
ls dist
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'
# TODO Run .exe file with arguments
# Push to github releases
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: windows
release_name: Windows Release
draft: true
prerelease: false
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/ReplayRenamer.exe
asset_name: ReplayRenamer.exe
asset_content_type: application/zip
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
if: matrix.os == 'windows-latest' && matrix.python-version == '3.7'