Repository navigation
125 lines (119 loc) · 3.74 KB
/
Copy pathpython-app.yml
File metadata and controls
125 lines (119 loc) · 3.74 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
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
# Joy-Con Toolkit, Python / Kivy app: tests, then builds for Linux, Windows, macOS and Android.
# The builds are attached to each run (Actions > run > Artifacts); a tag v* also publishes
# them as a GitHub release.
name: Python app
on:
push:
paths: ["python/**", ".github/workflows/python-app.yml"]
tags: ["v*"]
pull_request:
paths: ["python/**", ".github/workflows/python-app.yml"]
workflow_dispatch:
defaults:
run:
working-directory: python
jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: System packages (virtual display for the app's self-test)
run: sudo apt-get update && sudo apt-get install -y xvfb libgl1-mesa-dri libmtdev1
- name: Venv
run: scripts/setup_venv.sh
- name: Tests
run: .venv/bin/python -m pytest -v
desktop:
needs: test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04 # Oldest glibc: the build runs on newer distributions too
name: linux
- os: windows-latest
name: windows
- os: macos-latest # Apple Silicon
name: macos
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Venv (Windows)
if: runner.os == 'Windows'
shell: cmd
run: scripts\setup_venv.bat
- name: Venv
if: runner.os != 'Windows'
run: scripts/setup_venv.sh
- name: Tests (protocol and features)
if: runner.os != 'Linux'
env:
JCTOOL_SKIP_GUI_TEST: "1"
run: ${{ runner.os == 'Windows' && '.venv\Scripts\python' || '.venv/bin/python' }} -m pytest
- name: Build
run: ${{ runner.os == 'Windows' && '.venv\Scripts\python' || '.venv/bin/python' }} scripts/build.py desktop
- name: Self-test the build (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y xvfb libgl1-mesa-dri libmtdev1
xvfb-run -a -s "-screen 0 1100x800x24" dist/JoyConToolkit/JoyConToolkit --selftest
- uses: actions/upload-artifact@v4
with:
name: JoyConToolkit-${{ matrix.name }}
path: |
python/dist/*.zip
python/dist/*.tar.gz
android:
needs: test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: System packages (python-for-android)
run: |
sudo apt-get update
sudo apt-get install -y git zip unzip autoconf automake libtool pkg-config zlib1g-dev \
libncurses-dev cmake libffi-dev libssl-dev
- uses: actions/cache@v4
with:
path: |
~/.buildozer
python/.buildozer
key: buildozer-${{ hashFiles('python/buildozer.spec') }}
- name: Venv
run: python -m venv .venv
- name: Build the APK
run: .venv/bin/python scripts/build.py android
- uses: actions/upload-artifact@v4
with:
name: JoyConToolkit-android
path: python/bin/*.apk
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [desktop, android]
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: .
steps:
- uses: actions/download-artifact@v4
with:
path: out
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: out/*