Work with p4a master #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python application | |
on: [push, pull_request] | |
jobs: | |
lint_test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
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@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
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@v2 | |
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@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
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@v2 | |
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@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
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@v2 | |
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@v2 | |
# 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@v2 | |
with: | |
path: .buildozer_global | |
key: buildozer-global-${{ hashFiles('packaging/buildozer.spec') }} | |
- uses: actions/cache@v2 | |
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@v2 | |
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@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
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 |