Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Screenshot test #2031

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
adaf069
Add a ctypes wrapper for fontconfig.
freakboy3742 Apr 5, 2023
cd0fcb2
Add Changenote.
freakboy3742 Apr 5, 2023
f706ade
Improved error reporting for unknown fonts.
freakboy3742 Apr 6, 2023
d2afb95
Fonts core API to 100%. Also fixes some stray canvas tests dependent …
freakboy3742 Apr 6, 2023
2732de1
Add an extra test for registering font variants.
freakboy3742 Apr 6, 2023
dca074d
Removed measure as a public API on font.
freakboy3742 Apr 6, 2023
11777d3
Removed a now-redundant test.
freakboy3742 Apr 6, 2023
1395706
Add fonts to testbed
studioph Apr 25, 2023
da65018
Quote font family when creating CSS stylesheet
studioph Apr 25, 2023
bc2823d
Use dict to convert Pango enums to Toga
studioph Apr 25, 2023
c4778d7
Add widget_probe fixture to testbed conftest
studioph Apr 25, 2023
0d31ea0
Add font tests to testbed
studioph Apr 25, 2023
d20ea5b
Move font measure to canvas
studioph Apr 25, 2023
32b18e9
Add changenote
studioph Apr 25, 2023
2e27817
Fix app path in tests
studioph Apr 26, 2023
8451948
Use app fixture
studioph Apr 26, 2023
6f3325f
Merge branch 'main' into fontconfig
freakboy3742 Apr 26, 2023
0ae230e
Merge branch 'main' into fontconfig
freakboy3742 May 3, 2023
3cd10a8
Corrected a spelling error.
freakboy3742 May 3, 2023
2822635
Merge branch 'fontconfig' into gtk-font-tests
freakboy3742 May 3, 2023
67e17c1
Remove redundant platform font test.
freakboy3742 May 3, 2023
30e638b
Minor cleanup of GTK probe implementation.
freakboy3742 May 3, 2023
bf78924
Modify the not-a-font file to make the purpose explicit.
freakboy3742 May 3, 2023
d1ea0e7
Minor code format cleanup.
freakboy3742 May 3, 2023
93a5874
Small tweaks to tests.
freakboy3742 May 3, 2023
707a0b8
Tweaked the GTK font tests.
freakboy3742 May 3, 2023
1405606
Merge branch 'main' into gtk-font-tests
freakboy3742 May 3, 2023
c8134fc
Ensure webkit2 libraries are available for testing.
freakboy3742 May 3, 2023
fc9ada3
Update Winforms to get 100% font test coverage.
freakboy3742 May 3, 2023
3a814ad
Update docs to reflect support status and Winforms limitations.
freakboy3742 May 3, 2023
6572d97
Clarify comment around coverage case.
freakboy3742 May 14, 2023
9d644e4
Clarify description of default font size.
freakboy3742 May 14, 2023
ffc3424
Restructured code to avoid false KeyError hits.
freakboy3742 May 14, 2023
16c4930
Clarified comment about FontConfig singleton.
freakboy3742 May 14, 2023
510abc9
Check for additional failure modes when loading custom fonts.
freakboy3742 May 14, 2023
a58e376
Rework font tests to test all variants.
freakboy3742 May 15, 2023
a267763
Restructure winforms font loading to isolate keyerror failures.
freakboy3742 May 15, 2023
5fa3011
Moved all Winforms font handling into the font class to allow for cus…
freakboy3742 May 15, 2023
6fa4f6f
Made the winforms font test more complete.
freakboy3742 May 15, 2023
58b9039
Interpret OBLIQUE as ITALIC.
freakboy3742 May 17, 2023
a27be03
Correct typo.
freakboy3742 May 17, 2023
bc832e9
Merge branch 'main' into gtk-font-tests
freakboy3742 Jun 13, 2023
c4d8a57
Refactor app path into interface layer.
freakboy3742 Jun 14, 2023
95d6b3c
Merge branch 'main' into gtk-font-tests
freakboy3742 Jun 24, 2023
e53c7ea
Corrections to Winforms and testbed tests.
freakboy3742 Jun 25, 2023
34cc18d
Try a different approach to avoid path discrepancy issues.
freakboy3742 Jul 2, 2023
c6b63c1
Merge remote-tracking branch 'upstream/main' into gtk-font-tests
freakboy3742 Jul 2, 2023
f863568
Add 100% font coverage for Cocoa.
freakboy3742 Jul 2, 2023
0d32913
Restructure font probe into a standalone mixin.
freakboy3742 Jul 3, 2023
d246db4
100% coverage for iOS fonts.
freakboy3742 Jul 3, 2023
c5836d2
Android fonts working for all but custom fonts.
freakboy3742 Jul 3, 2023
dca6219
Correct GTK test for custom font.
freakboy3742 Jul 3, 2023
dbafa75
Add safety rail when using Dummy backend.
freakboy3742 Jul 3, 2023
424014d
Small tweak to box child creation to ensure custom fonts work on GTK.
freakboy3742 Jul 4, 2023
c58d20e
Merge branch 'main' into gtk-font-tests
freakboy3742 Jul 9, 2023
bd1a2a9
Updated documentation for Canvas.
freakboy3742 Jul 9, 2023
dc57388
Update docstrings, core API, and canvas examples.
freakboy3742 Jul 11, 2023
ab6f9f6
Complete documentation audit and add changenotes.
freakboy3742 Jul 12, 2023
20b3556
Core Canvas widget tests ported.
freakboy3742 Jul 12, 2023
c87c837
Initial canvas probe implementations for Cocoa and iOS.
freakboy3742 Jul 14, 2023
c8aa596
Initial GTK Cairo fixes plus probe.
freakboy3742 Jul 14, 2023
6281eb0
Merge branch 'main' into gtk-font-tests
freakboy3742 Jul 14, 2023
83a2b72
Merge branch 'gtk-font-tests' into audit-canvas
freakboy3742 Jul 14, 2023
440f3be
Make the Cocoa sRGB conversion conditional on an ICC profile existing.
freakboy3742 Jul 15, 2023
2a4fb29
Add a __len__ operation to context, and expanded canvas tutorial.
freakboy3742 Jul 15, 2023
3ae60c1
Allow for a default font on write_text, and correct docs on text origin.
freakboy3742 Jul 15, 2023
1b09a23
Cocoa Canvas at 100% coverage.
freakboy3742 Jul 15, 2023
43d765a
iOS canvas at 100% coverage.
freakboy3742 Jul 15, 2023
c9453d4
Mark Dummy interface as not required, and update Winforms/Android int…
freakboy3742 Jul 15, 2023
91648c9
GTK Canvas at 100% coverage.
freakboy3742 Jul 15, 2023
4e88fb2
Correct GTK multiline text handling.
freakboy3742 Jul 15, 2023
dd03691
Correct transparency handling on iOS.
freakboy3742 Jul 15, 2023
5dc4c2c
Exclude Font from dummy interface checks.
freakboy3742 Jul 15, 2023
de81c39
Disable multiline text test on GTK.
freakboy3742 Jul 15, 2023
892a39b
Attempt to extract screenshots on testbed failure.
freakboy3742 Jul 15, 2023
b986a19
Try to preserve app data.
freakboy3742 Jul 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
334 changes: 177 additions & 157 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,174 +24,175 @@ 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]"
# 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]"
# towncrier:
# name: Check towncrier
# uses: beeware/.github/.github/workflows/towncrier-run.yml@main
# with:
# tox-source: "./core[dev]"

package:
name: Python Package
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
tox-source: "./core[dev]"
build-subdirectory: ${{ matrix.subdir }}
distribution-path: "*/dist/*"
strategy:
matrix:
subdir:
- "android"
- "cocoa"
- "core"
- "demo"
- "dummy"
- "gtk"
- "iOS"
- "toga"
- "web"
- "winforms"
# package:
# name: Python Package
# uses: beeware/.github/.github/workflows/python-package-create.yml@main
# with:
# tox-source: "./core[dev]"
# build-subdirectory: ${{ matrix.subdir }}
# distribution-path: "*/dist/*"
# strategy:
# matrix:
# subdir:
# - "android"
# - "cocoa"
# - "core"
# - "demo"
# - "dummy"
# - "gtk"
# - "iOS"
# - "toga"
# - "web"
# - "winforms"

core:
runs-on: ${{ matrix.platform }}-latest
needs: [pre-commit, towncrier, package]
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
platform: [ "macos", "ubuntu", "windows" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12-dev" ]
include:
- experimental: false
# core:
# runs-on: ${{ matrix.platform }}-latest
# needs: [pre-commit, towncrier, package]
# continue-on-error: ${{ matrix.experimental }}
# strategy:
# matrix:
# platform: [ "macos", "ubuntu", "windows" ]
# python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12-dev" ]
# include:
# - experimental: false

- python-version: "3.12-dev"
experimental: true
steps:
- uses: actions/checkout@v3.5.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.6.1
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: |
# We don't actually want to install toga-core;
# we just want the dev extras so we have a known version of tox and coverage
python -m pip install ./core[dev]
- name: Get packages
uses: actions/download-artifact@v3.0.2
with:
name: ${{ needs.package.outputs.artifact-name }}
- 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 core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl)" tox -e py-core
cd core
mv .coverage .coverage.${{ matrix.platform }}.${{ matrix.python-version }}
- name: Store coverage data
uses: actions/upload-artifact@v3.1.2
with:
name: core-coverage-data
path: "core/.coverage.*"
if-no-files-found: error
# - python-version: "3.12-dev"
# experimental: true
# steps:
# - uses: actions/checkout@v3.5.3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4.6.1
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dev dependencies
# run: |
# # We don't actually want to install toga-core;
# # we just want the dev extras so we have a known version of tox and coverage
# python -m pip install ./core[dev]
# - name: Get packages
# uses: actions/download-artifact@v3.0.2
# with:
# name: ${{ needs.package.outputs.artifact-name }}
# - 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 core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl)" tox -e py-core
# cd core
# mv .coverage .coverage.${{ matrix.platform }}.${{ matrix.python-version }}
# - name: Store coverage data
# uses: actions/upload-artifact@v3.1.2
# with:
# name: core-coverage-data
# path: "core/.coverage.*"
# if-no-files-found: error

core-coverage:
name: Combine & check core coverage.
runs-on: ubuntu-latest
needs: core
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
- uses: actions/setup-python@v4.6.1
with:
# Use latest, so it understands all syntax.
python-version: ${{ env.max_python_version }}
- name: Install dev dependencies
run: |
# We don't actually want to install toga-core;
# we just want the dev extras so we have a known version of coverage
python -m pip install ./core[dev]
- name: Retrieve coverage data
uses: actions/download-artifact@v3.0.2
with:
name: core-coverage-data
path: core
- name: Generate coverage report
run: |
cd core
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --rcfile ../pyproject.toml # --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v3.1.2
with:
name: html-coverage-report
path: core/htmlcov
if: ${{ failure() }}
# core-coverage:
# name: Combine & check core coverage.
# runs-on: ubuntu-latest
# needs: core
# steps:
# - uses: actions/checkout@v3.5.3
# with:
# fetch-depth: 0
# - uses: actions/setup-python@v4.6.1
# with:
# # Use latest, so it understands all syntax.
# python-version: ${{ env.max_python_version }}
# - name: Install dev dependencies
# run: |
# # We don't actually want to install toga-core;
# # we just want the dev extras so we have a known version of coverage
# python -m pip install ./core[dev]
# - name: Retrieve coverage data
# uses: actions/download-artifact@v3.0.2
# with:
# name: core-coverage-data
# path: core
# - name: Generate coverage report
# run: |
# cd core
# python -m coverage combine
# python -m coverage html --skip-covered --skip-empty
# python -m coverage report --rcfile ../pyproject.toml # --fail-under=100
# - name: Upload HTML report if check failed.
# uses: actions/upload-artifact@v3.1.2
# with:
# name: html-coverage-report
# path: core/htmlcov
# if: ${{ failure() }}

backend:
runs-on: ${{ matrix.runs-on }}
needs: [package, core]
strategy:
matrix:
backend: [ "android", "cocoa", "gtk", "iOS", "web", "winforms" ]
include:
- runs-on: ubuntu-latest
- python-version: "3.8" # Should be env.min_python_version (https://github.com/actions/runner/issues/480)
- pre-command:
# backend:
# runs-on: ${{ matrix.runs-on }}
# needs: [package, core]
# strategy:
# matrix:
# backend: [ "android", "cocoa", "gtk", "iOS", "web", "winforms" ]
# include:
# - runs-on: ubuntu-latest
# - python-version: "3.8" # Should be env.min_python_version (https://github.com/actions/runner/issues/480)
# - pre-command:

- backend: cocoa
runs-on: macos-latest
# - backend: cocoa
# runs-on: macos-latest

- backend: gtk
pre-command: |
sudo apt update -y
sudo apt install -y pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-gtk-3.0
# - backend: gtk
# pre-command: |
# sudo apt update -y
# sudo apt install -y pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-gtk-3.0

- backend: iOS
runs-on: macos-latest
# - 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"
steps:
- uses: actions/checkout@v3.5.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.6.1
with:
python-version: ${{ matrix.python-version }}
- name: Get packages
uses: actions/download-artifact@v3.0.2
with:
name: ${{ needs.package.outputs.artifact-name }}
- name: Install dev dependencies
run: |
${{ matrix.pre-command }}
# We don't actually want to install toga-core;
# we just want the dev extras so we have a known version of tox
python -m pip install ./core[dev]
- 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 core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl) ../$(ls ${{ matrix.backend }}/dist/toga_${{ matrix.backend }}-*.whl)" tox -e py-${{ matrix.backend }}
# - 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"
# steps:
# - uses: actions/checkout@v3.5.3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4.6.1
# with:
# python-version: ${{ matrix.python-version }}
# - name: Get packages
# uses: actions/download-artifact@v3.0.2
# with:
# name: ${{ needs.package.outputs.artifact-name }}
# - name: Install dev dependencies
# run: |
# ${{ matrix.pre-command }}
# # We don't actually want to install toga-core;
# # we just want the dev extras so we have a known version of tox
# python -m pip install ./core[dev]
# - 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 core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl) ../$(ls ${{ matrix.backend }}/dist/toga_${{ matrix.backend }}-*.whl)" tox -e py-${{ matrix.backend }}

testbed:
runs-on: ${{ matrix.runs-on }}
needs: core
# needs: core
strategy:
fail-fast: false
matrix:
backend: [ "macOS", "windows", "linux", "android", "iOS" ]
# backend: [ "macOS", "windows", "linux", "android", "iOS" ]
backend: [ "macOS", "iOS", "linux" ]
include:
- pre-command:
briefcase-run-prefix:
Expand All @@ -200,6 +201,7 @@ jobs:

- backend: macOS
runs-on: macos-12
app-user-data-path: /Users/runner/Library/Application Support/org.beeware.toga.testbed

# We use a fixed Ubuntu version rather than `-latest` because at some point,
# `-latest` will be updated, but it will be a soft changeover, which would cause
Expand All @@ -224,17 +226,19 @@ jobs:

briefcase-run-prefix: 'DISPLAY=:99'
setup-python: false # Use the system Python packages.
app-user-data-path: /home/runner/.local/share/testbed

- backend: windows
runs-on: windows-latest
# - backend: windows
# runs-on: windows-latest

- backend: iOS
runs-on: macos-12
briefcase-run-args: ' -d "iPhone SE (3rd generation)"'
# app data path is determined at runtime, as the path contains the Simulator and app ID.

- backend: android
runs-on: macos-12
briefcase-run-args: " -d '{\"avd\":\"beePhone\"}' --Xemulator=-no-window --Xemulator=-no-snapshot --Xemulator=-no-audio --Xemulator=-no-boot-anim --shutdown-on-exit"
# - backend: android
# runs-on: macos-12
# briefcase-run-args: " -d '{\"avd\":\"beePhone\"}' --Xemulator=-no-window --Xemulator=-no-snapshot --Xemulator=-no-audio --Xemulator=-no-boot-anim --shutdown-on-exit"
steps:
- uses: actions/checkout@v3.5.3
with:
Expand Down Expand Up @@ -263,3 +267,19 @@ jobs:
with:
name: testbed-failure-logs-${{ matrix.backend }}
path: testbed/logs/*
- name: Copy app generated user data
if: failure()
run: |
mkdir testbed/app_data
if [ "${{ matrix.backend }}" = "iOS" ]; then
APP_DATA_PATH="$(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents"
else
APP_DATA_PATH="${{ matrix.app-user-data-path }}"
fi
cp -r "$APP_DATA_PATH" testbed/app_data/testbed-app_data-${{ matrix.backend }}
- name: Upload app data
uses: actions/upload-artifact@v3.1.2
if: failure()
with:
name: testbed-failure-app-data-${{ matrix.backend }}
path: testbed/app_data/*