-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (160 loc) · 6.21 KB
/
pyinstaller_windows.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Release (Windows)
on:
workflow_dispatch:
inputs:
version:
description: "Version Number (x.y.z)"
required: true
type: string
release:
description: "Create Release?"
required: false
default: false
type: boolean
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version || steps.custom.outputs.version || steps.tag.outputs.version }}
steps:
- name: Output Version
id: version
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version == '' ) }}
run: echo "version=$(date +'%Y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: Output Custom Version
id: custom
if: ${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }}
run: echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Output Tag
id: tag
if: ${{ github.event_name == 'push' }}
run: echo "version=$(echo ${GITHUB_REF#refs/*/} | sed -e 's/v//')" >> $GITHUB_OUTPUT
build-windows:
# Windows is currently the only platform this action supports
needs: [version]
runs-on: windows-2019
steps:
# Check-out repository
- uses: actions/checkout@v4
with:
path: build-windows
- name: Install Visual C++ Redistributable
run: |
choco install vcredist2015
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
# cache-dependency-path: |
# **/requirements*.txt
# Install dependencies
- name: Install Dependencies
run: |
cd .\build-windows
pip install poetry
poetry config virtualenvs.in-project true
poetry install --no-root
# Uncomment to printout environment paths and python setup
# poetry run python .\python-env.py
# Build zip folder with executable using pyinstaller
- name: Build zip file
run: |
cd .\build-windows
cp .\.github\pyinstaller\gesture-mouse.spec.win gesture-mouse.spec
poetry run pyinstaller.exe gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-windows/dist/gesture-mouse
build-linux:
# Windows is currently the only platform this action supports
needs: [version]
runs-on: ubuntu-20.04
steps:
# Check-out repository
- uses: actions/checkout@v4
with:
path: build-linux
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
# cache-dependency-path: |
# **/requirements*.txt
# Install dependencies
- name: Install Dependencies
run: |
cd ./build-linux
#install linux dependencies
sudo apt update -q
sudo apt install -y -q build-essential libgl1-mesa-dev
sudo apt install -y -q libxkbcommon-x11-0
sudo apt install -y -q libxcb-image0
sudo apt install -y -q libxcb-keysyms1
sudo apt install -y -q libxcb-render-util0
sudo apt install -y -q libxcb-xinerama0
sudo apt install -y -q libxcb-icccm4
sudo apt-get install -y libegl1
pip install poetry
poetry config virtualenvs.in-project true
poetry install --no-root
# Uncomment to printout environment paths and python setup
# poetry run python .\python-env.py
# Build zip folder with executable using pyinstaller
- name: Build zip file
run: |
cd ./build-linux
cp ./.github/pyinstaller/gesture-mouse.spec.linux gesture-mouse.spec
poetry run pyinstaller gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-linux-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-linux/dist/gesture-mouse
release:
needs: [version, build-windows]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }} # Set job-level output
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')
steps:
- name: Create Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.version }}
release_name: Release ${{ needs.version.outputs.version }}
draft: false
prerelease: false
release-upload:
runs-on: ubuntu-latest
needs: [version, build-windows, release]
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: gesture-mouse-${{ needs.version.outputs.version }}
path: gesture-mouse-${{ needs.version.outputs.version }}
- name: Display structure of downloaded files
run: |
ls
zip -r gesture-mouse-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{ needs.version.outputs.version }}/
ls
- name: upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./gesture-mouse-${{ needs.version.outputs.version }}.zip
asset_name: gesture-mouse-${{ needs.version.outputs.version }}.zip
asset_content_type: application/zip