-
Notifications
You must be signed in to change notification settings - Fork 4
240 lines (218 loc) · 7.38 KB
/
pythonapp.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
229
230
231
232
233
234
235
236
237
238
239
240
name: Python application
on: [push, pull_request]
jobs:
lint_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Lint with pycodestyle
run: |
python3 -m pip install flake8
python3 -m flake8 . --count --ignore=E125,E126,E127,E128,E402,E741,E731,W503,F401,W504,F841 --show-source --statistics --max-line-length=80 --exclude=__pycache__,.tox,.git/,doc/
linux_test:
runs-on: ubuntu-20.04
env:
DISPLAY: :99.0
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Make sdist
run: python3 setup.py sdist --formats=gztar
- name: Install dependencies
run: |
sudo apt update
sudo apt-get -y install python3-setuptools build-essential libgl1-mesa-dev libgles2-mesa-dev
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1280x720x24 -ac +extension GLX
- name: Install project
run: python3 -m pip install -e .[dev]
- name: Make wheel
run: |
python3 -m pip install wheel
python3 setup.py bdist_wheel --universal
- name: Upload wheels as artifact
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
- name: Test with pytest
run: |
python3 -m pytest --cov=kivy_pong_demo --cov-report term --cov-branch kivy_pong_demo/tests
windows_test:
runs-on: windows-latest
env:
KIVY_GL_BACKEND: angle_sdl2
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install pyinstaller
# use kivy's hook, not the one included in pyinstaller
python -c "import os, PyInstaller; os.remove(os.path.join(os.path.dirname(PyInstaller.__file__), 'hooks', 'hook-kivy.py'))"
python -m pip install -e .[dev]
- name: Make PyInstaller app
run: |
cd packaging
python -m PyInstaller kivy_pong_demo_exe.spec
- name: Upload app as artifact
uses: actions/upload-artifact@v3
with:
name: app
path: packaging/dist
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: packaging/dist/*
- name: Test with pytest
run: |
python -m pytest --cov=kivy_pong_demo --cov-report term --cov-branch kivy_pong_demo/tests
osx_app:
runs-on: macos-10.15
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Get Kivy dependencies
run: |
cd ..
git clone https://github.com/kivy/kivy-sdk-packager.git
cd kivy-sdk-packager/osx
curl -O -L https://github.com/kivy/kivy/releases/download/2.0.0/Kivy.dmg
hdiutil attach Kivy.dmg -mountroot .
cp -R Kivy/Kivy.app PongDemo.app
- name: Install PongDemo pip dependencies
run: |
pushd ../kivy-sdk-packager/osx/PongDemo.app/Contents/Resources/venv/bin
source activate
popd
python -m pip install .
- name: Finalize PongDemo bundle
run: |
cd ../kivy-sdk-packager/osx
pushd PongDemo.app/Contents/Resources/
ln -s ./venv/bin/kivy_pong_demo yourapp
popd
./fix-bundle-metadata.sh PongDemo.app -n PongDemo -v "0.1.0.dev0" -a "Kivy devs" -o \
"org.kivy.kivy_pong_demo" -i "../../kivy_pong_demo/doc/source/kivy_pong_demo_logo.png"
./cleanup-app.sh PongDemo.app -g 1
./relocate.sh PongDemo.app
- name: Create dmg
run: |
pushd ../kivy-sdk-packager/osx
./create-osx-dmg.sh PongDemo.app PongDemo
popd
mkdir osx_app
cp ../kivy-sdk-packager/osx/PongDemo.dmg osx_app/
- name: Upload app as artifact
uses: actions/upload-artifact@v3
with:
name: osx_app
path: osx_app
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: osx_app/*
android_app:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
# used to cache dependencies with a timeout
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Cache Buildozer global directory
uses: actions/cache@v3
with:
path: .buildozer_global
key: buildozer-global-${{ hashFiles('packaging/buildozer.spec') }}
- uses: actions/cache@v3
with:
path: .buildozer
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('buildozer.spec') }}
- name: Build with Buildozer
uses: ArtemSBulgakov/buildozer-action@v1
id: buildozer
with:
command: buildozer android debug
workdir: packaging
buildozer_version: master
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: android_app
path: ${{ steps.buildozer.outputs.filename }}
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.buildozer.outputs.filename }}
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
env:
KIVY_DOC_INCLUDE: 1
KIVY_DOC: 1
run: |
python3 -m pip install -e .[dev]
- name: Generate docs
run: |
cd doc
make html
- name: gh-pages upload
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp -r doc/build/html ~/docs_temp
git config --global user.email "[email protected]"
git config --global user.name "Kivy devs"
git remote rm origin || true
git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git checkout --orphan gh-pages
cp -r .git ~/docs_git
cd ..
rm -rf kivy_pong_demo
mkdir kivy_pong_demo
cd kivy_pong_demo
cp -r ~/docs_git .git
cp -r ~/docs_temp/* .
touch .nojekyll
git add .
git commit -a -m "Docs for git-$GITHUB_SHA"
git push origin gh-pages -f