Skip to content

Commit

Permalink
Merge pull request #1614 from mhsmith/workflows
Browse files Browse the repository at this point in the history
Update release workflow
  • Loading branch information
freakboy3742 committed Oct 19, 2022
2 parents 138b673 + 1cbe045 commit 96881f0
Show file tree
Hide file tree
Showing 385 changed files with 302 additions and 299 deletions.
11 changes: 9 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
[run]
branch = True
source = src/core/toga
source_pkgs = toga
omit =
src/core/toga/**/__init__.py
**/__init__.py

[paths]
# Paths which may contain the packages listed in source_pkgs. The first path will be used
# to generate the filenames in the report.
source =
src/core/src
**/site-packages

[report]
show_missing = True
Expand Down
246 changes: 77 additions & 169 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,64 @@ on:
push:
branches:
- main
workflow_call:

env:
min_python_version: "3.7"

defaults:
run:
shell: bash

jobs:
beefore:
name: Pre-test checks
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
task:
- flake8
# - towncrier-check
- docs
- package
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
- uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
python-version: ${{ env.min_python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install tox
- name: Run pre-test checks
run: |
tox -e ${{ matrix.task }}
- run: tox -e ${{ matrix.task }}

smoke:
name: Smoke test (3.7)
needs:
- beefore
package:
needs: beefore
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
- uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade tox
- name: Test
run: |
tox -e py
- name: Check coverage
uses: codecov/codecov-action@v1
python-version: ${{ env.min_python_version }}
- run: pip install tox
- run: tox -e package
- name: Collect packages
run: |
mkdir packages
mv {.,demo,src/*}/dist/* packages
- uses: actions/upload-artifact@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true
name: packages
path: packages
if-no-files-found: error

python-versions:
# Only run this and subsequent steps on branches.
# `github.head_ref` only exists on pull requests.
if: github.head_ref
name: Python compatibility test
needs: smoke
runs-on: ubuntu-latest
core:
needs: package
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"]
platform: ['macos', 'ubuntu', 'windows']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"]
runs-on: ${{ matrix.platform }}-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -81,152 +73,68 @@ jobs:
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade tox
- name: Get packages
uses: actions/download-artifact@v3
with:
name: packages
path: packages
- name: Test
env:
TOGA_INSTALL_COMMAND: 'bash -c "pip install packages/toga_{core,dummy}*.whl"'
run: |
tox -e py
- if: matrix.platform == 'ubuntu' && matrix.python-version == env.min_python_version
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: true

windows:
name: Winforms backend tests
needs: python-versions
runs-on: windows-latest
backend:
needs: package
strategy:
matrix:
backend: [android, cocoa, gtk, iOS, web, winforms]
include:
- runs-on: ubuntu-latest
- python-version: "3.7" # Should be env.min_python_version (https://github.com/actions/runner/issues/480)
- pre-command:
- test-command: pytest
- backend: cocoa
runs-on: macos-latest
- backend: gtk
pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config"
test-command: "xvfb-run -a -s '-screen 0 2048x1536x24' pytest"
- backend: iOS
runs-on: macos-latest
- backend: winforms
runs-on: windows-latest
# Py3.9 is the first Python version for which
# a wheel of pythonnet isn't available on PyPI.
python-version: "3.9"
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.9
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3.1.2
with:
# Py3.9 is the first Python version for which
# a wheel of pythonnet isn't available on PyPI.
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/winforms
- name: Test
run: |
cd src/winforms
pytest
- name: Core Test
run: |
cd src/core
pytest
macOS:
name: macOS backend tests
needs: python-versions
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/cocoa
- name: Test
run: |
cd src/cocoa
pytest
iOS:
name: iOS backend tests
needs: python-versions
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/iOS
- name: Test
run: |
cd src/iOS
pytest
gtk:
name: GTK+ backend tests
needs: python-versions
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/gtk
- name: Test
run: |
cd src/gtk
xvfb-run -a -s '-screen 0 2048x1536x24' pytest
android:
name: Android backend tests
needs: python-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/android
- name: Test
run: |
cd src/android
pytest
web:
name: Web backend tests
needs: python-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v3.1.2
python-version: ${{ matrix.python-version }}
- name: Get packages
uses: actions/download-artifact@v3
with:
python-version: "3.7"
name: packages
path: packages
- name: Install dependencies
run: |
${{ matrix.pre-command }}
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install pytest-tldr
python -m pip install -e src/core
python -m pip install -e src/dummy
python -m pip install -e src/web
python -m pip install packages/toga_{core,dummy,${{ matrix.backend }}}*.whl
- name: Test
run: |
cd src/web
pytest
cd src/${{ matrix.backend }}
${{ matrix.test-command }}
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Upload Python Package

on:
release:
types: published

jobs:
deploy:
strategy:
matrix:
package: ["toga", "toga_android", "toga_cocoa", "toga_core", "toga_demo",
"toga_dummy", "toga_gtk", "toga_iOS", "toga_web", "toga_winforms"]
runs-on: ubuntu-latest
steps:
- name: Get packages
uses: dsaltares/fetch-gh-release-asset@1.0.0
with:
version: tags/${{ github.event.release.tag_name }}
file: ${{ github.event.repository.name }}.*
regex: true
target: packages/
- name: Extract ${{ matrix.package }}
run: |
mkdir dist
mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets[format('PYPI_PASSWORD_{0}', matrix.package)] }}
Loading

0 comments on commit 96881f0

Please sign in to comment.