-
Notifications
You must be signed in to change notification settings - Fork 0
228 lines (216 loc) · 8.91 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Release (All)
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
env:
WIN_TARGET: windows
LINUX_TARGET: linux
MAC_TARGET: macosx
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-${{env.WIN_TARGET}}
- 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-${{env.WIN_TARGET}}
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-${{env.WIN_TARGET}}
cp .\.github\pyinstaller\gesture-mouse.spec.${{env.WIN_TARGET}} gesture-mouse.spec
poetry run pyinstaller.exe gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-${{env.WIN_TARGET}}/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-${{env.LINUX_TARGET}}
# 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-${{env.LINUX_TARGET}}
#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-${{env.LINUX_TARGET}}
cp ./.github/pyinstaller/gesture-mouse.spec.${{env.LINUX_TARGET}} gesture-mouse.spec
poetry run pyinstaller gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-${{env.LINUX_TARGET}}/dist/gesture-mouse
build-macosx:
# Windows is currently the only platform this action supports
needs: [version]
runs-on: macos-12
steps:
# Check-out repository
- uses: actions/checkout@v4
with:
path: build-${{env.MAC_TARGET}}
# 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-${{env.MAC_TARGET}}
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-${{env.MAC_TARGET}}
cp ./.github/pyinstaller/gesture-mouse.spec.${{env.MAC_TARGET}} gesture-mouse.spec
poetry run pyinstaller gesture-mouse.spec --clean --noconfirm
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: gesture-mouse-${{env.MAC_TARGET}}-${{ needs.version.outputs.version }}
include-hidden-files: true
path: build-${{env.MAC_TARGET}}/dist/gesture-mouse
release:
needs: [version, build-windows, build-linux, build-macosx]
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, build-linux, build-macosx, 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-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{env.WIN_TARGET}}-${{ needs.version.outputs.version }}/
zip -r gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{env.LINUX_TARGET}}-${{ needs.version.outputs.version }}/
zip -r gesture-mouse-${{env.MAC_TARGET}}-${{ needs.version.outputs.version }}.zip ./gesture-mouse-${{env.MAC_TARGET}}-${{ 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: ./*.zip
# #asset_name: gesture-mouse-${{ needs.version.outputs.version }}.zip
# asset_content_type: application/zip
- name: Upload Multiple Release Assets
# You may pin to the exact commit or the version.
# uses: NBTX/upload-release-assets@f68d1c91ca950f33ee35514883819c2bb053f487
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: NBTX/upload-release-assets@v1
with:
# The URL for uploading assets to the release
upload_url: ${{ needs.release.outputs.upload_url }}
# A glob of assets to upload
targets: ./*.zip
asset_content_type: application/zip