diff --git a/.github/workflows/ci_osx.yml b/.github/workflows/ci_osx.yml new file mode 100644 index 000000000..4e385dd3d --- /dev/null +++ b/.github/workflows/ci_osx.yml @@ -0,0 +1,25 @@ +name: Continuous Integration with OSX + +on: [push, pull_request] + +jobs: + tests: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install dependencies + run: | + source ci/ci_osx.sh + dependencies + + - name: Tests + run: | + source ci/ci_osx.sh + tests diff --git a/.github/workflows/ci_ubuntu.yml b/.github/workflows/ci_ubuntu.yml new file mode 100644 index 000000000..bade4ae8a --- /dev/null +++ b/.github/workflows/ci_ubuntu.yml @@ -0,0 +1,55 @@ +name: Continuous Integration with Ubuntu + +on: [push, pull_request] + +jobs: + + style: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install Dependencies + run: | + source ci/ci_ubuntu.sh + style_dependencies + + - name: Style + run: | + source ci/ci_ubuntu.sh + style + + tests: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install dependencies + run: | + source ci/ci_ubuntu.sh + dependencies + + - name: Tests + run: | + source ci/ci_ubuntu.sh + tests + + - name: Upload Coverage + if: github.event_name == 'push' && github.ref == 'refs/head/master' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + source ci/ci_ubuntu.sh + upload_coverage diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml new file mode 100644 index 000000000..477d8a143 --- /dev/null +++ b/.github/workflows/ci_windows.yml @@ -0,0 +1,25 @@ +name: Continuous Integration with Windows + +on: [push, pull_request] + +jobs: + tests: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install dependencies + run: | + . .\ci\ci_windows.ps1 + Dependencies + + - name: Tests + run: | + . .\ci\ci_windows.ps1 + Tests diff --git a/.github/workflows/plyer_deploy.yml b/.github/workflows/plyer_deploy.yml new file mode 100644 index 000000000..b620d1ccc --- /dev/null +++ b/.github/workflows/plyer_deploy.yml @@ -0,0 +1,51 @@ +name: Deploy to PyPI + +on: + create + +jobs: + deploy: + if: startsWith(github.ref, 'refs/tags/') + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + source ci/ci_ubuntu.sh + deployment_dependencies + + - name: Build Package + run: | + source ci/ci_ubuntu.sh + build + + - name: Create artifacts + uses: actions/upload-artifact@v1 + with: + name: plyer_artifact + path: dist + + - name: Upload to GitHub Releases + uses: softprops/action-gh-release@v0.1.5 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_RELEASE }} + + with: + files: dist/* + draft: true + + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + + run: | + source ci/ci_ubuntu.sh + deploy diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0298f8467..000000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -sudo: required - -services: - - docker - -matrix: - fast_finish: true - include: - - env: DOCK=1 IMAGE=bionic PY=2 RUN=unit - python: 2.7 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=bionic PY=3 RUN=unit COVERALLS=1 - python: 3.5 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=bionic PY=3 RUN=style - python: 3.5 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=fedora28 PY=2 RUN=unit - python: 2.7 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=fedora28 PY=3 RUN=unit - python: 3.5 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=archlinux PY=2 RUN=unit - python: 2.7 - os: linux - dist: trusty - - - env: DOCK=1 IMAGE=archlinux PY=3 RUN=unit - python: 3.5 - os: linux - dist: trusty - - - language: generic - env: RUN=unit PY=2 HOMEBREW_NO_AUTO_UPDATE=1 - os: osx - - - language: generic - env: RUN=unit PY=3 HOMEBREW_NO_AUTO_UPDATE=1 - os: osx - - -before_install: - - echo PATH=$PATH; - - ./ci/osx_fix_cellar.sh - - ./ci/github_checkout_branch.sh - -install: - - ./ci/osx_get_py3.sh - - ./ci/osx_get_pipvirtualenv.sh - - ./ci/docker_build.sh - -script: - - ./ci/osx_run_tests.sh - - ./ci/docker_run.sh diff --git a/README.md b/README.md index 944bd3084..2c2c033e9 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,12 @@ Plyer is a platform-independent api to use features commonly found on various platforms, notably mobile ones, in Python. [![coverage](https://coveralls.io/repos/kivy/plyer/badge.svg?branch=master)](https://coveralls.io/r/kivy/plyer?branch=master) -[![travis](https://travis-ci.org/kivy/plyer.svg?branch=master)](https://travis-ci.org/kivy/plyer) -[![appveyor](https://ci.appveyor.com/api/projects/status/k1bwhdie0tfmdq96?svg=true)](https://ci.appveyor.com/project/KivyOrg/plyer) [![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors) +![Continuous Integration with Ubuntu](https://github.com/kivy/plyer/workflows/Continuous%20Integration%20with%20Ubuntu/badge.svg) +![Continuous Integration with OSX](https://github.com/kivy/plyer/workflows/Continuous%20Integration%20with%20OSX/badge.svg) +![Continuous Integration with Windows](https://github.com/kivy/plyer/workflows/Continuous%20Integration%20with%20Windows/badge.svg) +![Deploy to PyPI](https://github.com/kivy/plyer/workflows/Deploy%20to%20PyPI/badge.svg) ## How @@ -117,5 +119,3 @@ Support this project by becoming a sponsor. Your logo will show up here with a l - - diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 23e67d787..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 1.0.{build} -clone_depth: 1 -clone_folder: c:\projects\app - -environment: - matrix: - - PY: 27 - - PY: 36 - - STYLE: 1 - -install: - - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1')) - -build_script: - - ci\win_set_python.bat - - ci\win_install.bat - - ci\win_style.bat - - ci\win_tests.bat diff --git a/ci/ci_osx.sh b/ci/ci_osx.sh new file mode 100644 index 000000000..d53f64ce9 --- /dev/null +++ b/ci/ci_osx.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +dependencies() +{ + python -m pip install --upgrade pip + + pip install --upgrade -r devrequirements.txt + pip install https://github.com/kivy/pyobjus/zipball/master +} + +tests() +{ + pip install --editable . + coverage run \ + --source ./plyer \ + -m unittest discover \ + --start-directory ./plyer/tests \ + --top-level-directory . \ + --failfast + coverage report -m +} diff --git a/ci/ci_ubuntu.sh b/ci/ci_ubuntu.sh new file mode 100644 index 000000000..d8d5773a5 --- /dev/null +++ b/ci/ci_ubuntu.sh @@ -0,0 +1,80 @@ +#!/bin/sh +set -ex + +dependencies() +{ + # install default packages + sudo apt-get update && \ + sudo apt-get -y --force-yes install \ + build-essential \ + openjdk-8-jdk \ + lshw \ + wget \ + git \ + && apt-get -y autoremove \ + && apt-get -y clean + + # generate user folder locations (Pictures, Downloads, ...) + xdg-user-dirs-update + + # install PIP + python -V + python -m pip install --upgrade pip + + # install dev packages + python -m pip install \ + --upgrade \ + --requirement devrequirements.txt + python -m pip install pyjnius + + python -m pip install . +} + +deployment_dependencies() +{ + python -m pip install --upgrade pip + + pip install setuptools wheel twine +} + +style_dependencies() +{ + python -m pip install --upgrade pip + + pip install flake8 +} + +style() +{ + python -m flake8 . --show-source +} + +tests() +{ + # tests and coverage for plyer package + python -m coverage run \ + --source plyer \ + -m unittest discover \ + --start-directory plyer/tests \ + --top-level-directory . \ + --failfast + + coverage report -m +} + +upload_coverage() +{ + python -m coveralls +} + +build() +{ + python setup.py sdist + python setup.py bdist_wheel --universal +} + +deploy() +{ + # deploy to PyPI + python -m twine upload dist/* +} diff --git a/ci/ci_windows.ps1 b/ci/ci_windows.ps1 new file mode 100644 index 000000000..c38176675 --- /dev/null +++ b/ci/ci_windows.ps1 @@ -0,0 +1,19 @@ +function Dependencies { + python -m pip install --requirement devrequirements.txt + python -m pip install . + echo Plyer version is + python -c "import plyer;print(plyer.__version__)" +} + +function Tests { + $current_directory = (pwd).Path + + python -m coverage run ` + --source "$current_directory\plyer" ` + -m unittest discover ` + --start-directory "$current_directory\plyer\tests" ` + --top-level-directory "$current_directory" ` + --failfast + + python -m coverage report -m +} diff --git a/devrequirements.txt b/devrequirements.txt index 858a3e649..986100695 100644 --- a/devrequirements.txt +++ b/devrequirements.txt @@ -1,7 +1,4 @@ mock -pycodestyle -pylint coverage coveralls cython -twine