-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.61 KB
/
python-app.yml
File metadata and controls
85 lines (75 loc) · 2.61 KB
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
name: Python application test and build
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
release:
types: [published]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pynput pydualsense
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
build-windows:
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
needs: test
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Download and Extract DLLs
shell: pwsh
run: |
# Download and extract hidapi.dll
Invoke-WebRequest -Uri https://github.com/libusb/hidapi/releases/download/hidapi-0.14.0/hidapi-win.zip -OutFile hidapi.zip
Expand-Archive -Path hidapi.zip -DestinationPath .
Copy-Item -Path "x64\hidapi.dll" -Destination "."
# Download and extract SDL2.dll
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-2.30.2/SDL2-devel-2.30.2-VC.zip -OutFile SDL2.zip
Expand-Archive -Path SDL2.zip -DestinationPath .
Copy-Item -Path "SDL2-2.30.2\lib\x64\SDL2.dll" -Destination "."
- name: Build executable with PyInstaller
shell: pwsh
run: |
pyinstaller --name "DualSenseMotionToKey" `
--windowed `
--onefile `
--add-data "SDL2.dll;." `
--add-data "hidapi.dll;." `
--hidden-import "pynput.keyboard._win32" `
--hidden-import "pynput.mouse._win32" `
main_app.py
- name: Create Release and Upload Asset
uses: softprops/action-gh-release@v1
with:
files: dist/DualSenseMotionToKey.exe