Skip to content

Commit

Permalink
Experiment with running testbed with Textual
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Sep 10, 2024
1 parent 02bbfc8 commit 2e88b21
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 158 deletions.
344 changes: 188 additions & 156 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,166 +30,176 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
name: Pre-commit checks
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
with:
pre-commit-source: "./core[dev]"

towncrier:
name: Check towncrier
uses: beeware/.github/.github/workflows/towncrier-run.yml@main
with:
tox-source: "./core[dev]"

package:
name: Package Toga
permissions:
id-token: write
contents: read
attestations: write
strategy:
matrix:
subdir:
- "android"
- "cocoa"
- "core"
- "demo"
- "dummy"
- "gtk"
- "iOS"
- "toga"
- "textual"
- "web"
- "winforms"
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
build-subdirectory: ${{ matrix.subdir }}
attest: ${{ inputs.attest-package }}

core:
name: Test core
runs-on: ${{ matrix.platform }}
needs: [ pre-commit, towncrier, package ]
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
platform: [ "macos-12", "macos-14", "ubuntu-latest", "windows-latest" ]
python-version: [ "3.8", "3.12", "3.13-dev" ]
include:
- experimental: false
# Test Python 3.9-3.11 on Ubuntu only
- platform: "ubuntu-latest"
python-version: "3.9"
experimental: false
- platform: "ubuntu-latest"
python-version: "3.10"
experimental: false
- platform: "ubuntu-latest"
python-version: "3.11"
experimental: false
# Allow development Python to fail without failing entire job.
- python-version: "3.13-dev"
experimental: true
exclude:
# macos-14 (i.e. arm64) does not support Python 3.8
- platform: "macos-14"
python-version: "3.8"
# Pillow isn't available for Python 3.13 on Windows
- platform: "windows-latest"
python-version: "3.13-dev"
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Get Packages
uses: actions/[email protected]
with:
pattern: ${{ format('{0}-*', needs.package.outputs.artifact-basename) }}
merge-multiple: true
path: dist

- name: Test
run: |
# The $(ls ...) shell expansion is done in the Github environment;
# the value of TOGA_INSTALL_COMMAND will be a literal string without any shell expansions to perform
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.whl)" \
tox -e py-cov
tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")
mv core/.coverage core/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}
- name: Store Coverage Data
uses: actions/[email protected]
with:
name: core-coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
path: "core/.coverage.*"
if-no-files-found: error
include-hidden-files: true

core-coverage:
name: Coverage
needs: core
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python ${{ env.min_python_version }}
uses: actions/[email protected]
with:
# Use minimum version of python for coverage to avoid phantom branches
# https://github.com/nedbat/coveragepy/issues/1572#issuecomment-1522546425
python-version: ${{ env.min_python_version }}

- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Retrieve Coverage Data
uses: actions/[email protected]
with:
pattern: core-coverage-data-*
path: core
merge-multiple: true

- name: Generate Coverage Report
run: tox -e coverage-html-fail-platform

- name: Upload HTML Coverage Report
uses: actions/[email protected]
if: failure()
with:
name: html-coverage-report
path: core/htmlcov
# pre-commit:
# name: Pre-commit checks
# uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
# with:
# pre-commit-source: "./core[dev]"
#
# towncrier:
# name: Check towncrier
# uses: beeware/.github/.github/workflows/towncrier-run.yml@main
# with:
# tox-source: "./core[dev]"
#
# package:
# name: Package Toga
# permissions:
# id-token: write
# contents: read
# attestations: write
# strategy:
# matrix:
# subdir:
# - "android"
# - "cocoa"
# - "core"
# - "demo"
# - "dummy"
# - "gtk"
# - "iOS"
# - "toga"
# - "textual"
# - "web"
# - "winforms"
# uses: beeware/.github/.github/workflows/python-package-create.yml@main
# with:
# build-subdirectory: ${{ matrix.subdir }}
# attest: ${{ inputs.attest-package }}

# core:
# name: Test core
# runs-on: ${{ matrix.platform }}
# needs: [ pre-commit, towncrier, package ]
# continue-on-error: ${{ matrix.experimental }}
# strategy:
# fail-fast: false
# matrix:
# platform: [ "macos-12", "macos-14", "ubuntu-latest", "windows-latest" ]
# python-version: [ "3.8", "3.12", "3.13-dev" ]
# include:
# - experimental: false
# # Test Python 3.9-3.11 on Ubuntu only
# - platform: "ubuntu-latest"
# python-version: "3.9"
# experimental: false
# - platform: "ubuntu-latest"
# python-version: "3.10"
# experimental: false
# - platform: "ubuntu-latest"
# python-version: "3.11"
# experimental: false
# # Allow development Python to fail without failing entire job.
# - python-version: "3.13-dev"
# experimental: true
# exclude:
# # macos-14 (i.e. arm64) does not support Python 3.8
# - platform: "macos-14"
# python-version: "3.8"
# # Pillow isn't available for Python 3.13 on Windows
# - platform: "windows-latest"
# python-version: "3.13-dev"
# steps:
# - name: Checkout
# uses: actions/[email protected]
# with:
# fetch-depth: 0
#
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/[email protected]
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install Tox
# uses: beeware/.github/.github/actions/install-requirement@main
# with:
# requirements: tox
# extra: dev
# project-root: core
#
# - name: Get Packages
# uses: actions/[email protected]
# with:
# pattern: ${{ format('{0}-*', needs.package.outputs.artifact-basename) }}
# merge-multiple: true
# path: dist
#
# - name: Test
# run: |
# # The $(ls ...) shell expansion is done in the Github environment;
# # the value of TOGA_INSTALL_COMMAND will be a literal string without any shell expansions to perform
# TOGA_INSTALL_COMMAND="python -m pip install ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.whl)" \
# tox -e py-cov
# tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")
# mv core/.coverage core/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}
#
# - name: Store Coverage Data
# uses: actions/[email protected]
# with:
# name: core-coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
# path: "core/.coverage.*"
# if-no-files-found: error
# include-hidden-files: true
#
# core-coverage:
# name: Coverage
# needs: core
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/[email protected]
# with:
# fetch-depth: 0
#
# - name: Set up Python ${{ env.min_python_version }}
# uses: actions/[email protected]
# with:
# # Use minimum version of python for coverage to avoid phantom branches
# # https://github.com/nedbat/coveragepy/issues/1572#issuecomment-1522546425
# python-version: ${{ env.min_python_version }}
#
# - name: Install Tox
# uses: beeware/.github/.github/actions/install-requirement@main
# with:
# requirements: tox
# extra: dev
# project-root: core
#
# - name: Retrieve Coverage Data
# uses: actions/[email protected]
# with:
# pattern: core-coverage-data-*
# path: core
# merge-multiple: true
#
# - name: Generate Coverage Report
# run: tox -e coverage-html-fail-platform
#
# - name: Upload HTML Coverage Report
# uses: actions/[email protected]
# if: failure()
# with:
# name: html-coverage-report
# path: core/htmlcov

testbed:
name: Testbed
needs: core
# needs: core
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
backend: [ "macOS-x86_64", "macOS-arm64", "windows", "linux-x11", "linux-wayland","android", "iOS" ]
backend:
- "macOS-x86_64"
- "macOS-arm64"
- "windows"
- "linux-x11"
- "linux-wayland"
- "android"
- "iOS"
- "textual-linux"
- "textual-macOS"
- "textual-windows"
include:
- pre-command: ""
briefcase-run-prefix: ""
Expand Down Expand Up @@ -265,6 +275,25 @@ jobs:
setup-python: false # Use the system Python packages
app-user-data-path: "$HOME/.local/share/testbed"

- backend: "textual-linux"
platform: "linux"
runs-on: "ubuntu-22.04"
setup-python: false # Use the system Python packages
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
app-user-data-path: "$HOME/.local/share/testbed"

- backend: "textual-macOS"
platform: "macOS"
runs-on: "macos-14"
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
app-user-data-path: "$HOME/Library/Application Support/org.beeware.toga.testbed"

- backend: "textual-windows"
platform: "windows"
runs-on: "windows-latest"
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
app-user-data-path: '$HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data'

- backend: "windows"
platform: "windows"
runs-on: "windows-latest"
Expand All @@ -274,7 +303,7 @@ jobs:
platform: "iOS"
runs-on: "macos-14"
# As of early April 2024, the XCode 15/iOS 17 simulator had a performance
# issue that rendered Github Actions testing impossible. The issue didn't
# issue that rendered GitHub Actions testing impossible. The issue didn't
# impact iOS 16.4, but that required the use of Xcode 14.3.1.
#
# Refs #2476, actions/runner-images#9591.
Expand All @@ -301,7 +330,7 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
steps:
# Github runners seem to have intermittent connectivity issues.
# GitHub runners seem to have intermittent connectivity issues.
# See https://github.com/beeware/toga/issues/2632
- name: Tune GitHub-hosted runner network
uses: smorimoto/[email protected]
Expand All @@ -328,7 +357,10 @@ jobs:
python -m pip install -U pip
# python -m pip install git+https://github.com/beeware/briefcase.git
# TODO: Use the stable release of Briefcase so that binary packages are available.
python -m pip install briefcase==0.3.19
# python -m pip install briefcase==0.3.19
- name: Install Briefcase
uses: beeware/.github/.github/actions/install-briefcase

- name: Test App
working-directory: testbed
Expand Down
1 change: 0 additions & 1 deletion testbed/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ requires = [
"../gtk",
]


[tool.briefcase.app.testbed.windows]
test_sources = [
"../winforms/tests_backend",
Expand Down
Loading

0 comments on commit 2e88b21

Please sign in to comment.