Skip to content

Commit

Permalink
Merge branch 'constraint-cleanup' into ios-ci-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jun 29, 2024
2 parents 2ba0fc0 + 96128fd commit 7bbbdfa
Show file tree
Hide file tree
Showing 347 changed files with 8,904 additions and 4,995 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ updates:
interval: "weekly"
day: "sunday"
time: "20:00"

- package-ecosystem: "pip"
directory: "/testbed"
ignore:
# pin PIL for Android and iOS
- dependency-name: "pillow"
schedule:
# Check for updates on Sunday, 8PM UTC
interval: "weekly"
day: "sunday"
time: "20:00"
106 changes: 75 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
branches:
- main
workflow_call:
inputs:
attest-package:
description: "Create GitHub provenance attestation for the package."
default: "false"
type: string
outputs:
artifact-name:
description: "Name of the uploaded artifact; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-name }}
artifact-basename:
description: "Base name of the uploaded artifacts; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-basename }}

env:
min_python_version: "3.8"
Expand Down Expand Up @@ -38,12 +43,11 @@ jobs:
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/*"
name: Package Toga
permissions:
id-token: write
contents: read
attestations: write
strategy:
matrix:
subdir:
Expand All @@ -58,6 +62,10 @@ jobs:
- "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
Expand Down Expand Up @@ -93,30 +101,34 @@ jobs:
python-version: "3.13-dev"
steps:
- name: Checkout
uses: actions/checkout@v4.1.6
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.1.0
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: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.package.outputs.artifact-name }}-*
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 core/dist/toga_core-*.whl)[dev] ../$(ls dummy/dist/toga_dummy-*.whl)" \
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 }}
Expand All @@ -134,7 +146,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.6
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

Expand All @@ -145,11 +157,12 @@ jobs:
# https://github.com/nedbat/coveragepy/issues/1572#issuecomment-1522546425
python-version: ${{ env.min_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: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
project-root: core

- name: Retrieve Coverage Data
uses: actions/download-artifact@v4.1.7
Expand All @@ -159,7 +172,7 @@ jobs:
merge-multiple: true

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

- name: Upload HTML Coverage Report
uses: actions/upload-artifact@v4.3.3
Expand All @@ -175,7 +188,7 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: [ "macOS-x86_64", "macOS-arm64", "windows", "linux", "android", "iOS" ]
backend: [ "macOS-x86_64", "macOS-arm64", "windows", "linux-x11", "linux-wayland","android", "iOS" ]
include:
- pre-command: ""
briefcase-run-prefix: ""
Expand All @@ -195,7 +208,7 @@ jobs:
# 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
# the system Python version to become inconsistent from run to run.
- backend: "linux"
- backend: "linux-x11"
platform: "linux"
runs-on: "ubuntu-22.04"
# The package list should be the same as in tutorial-0.rst, and the BeeWare
Expand All @@ -210,19 +223,45 @@ jobs:
sudo apt install -y --no-install-recommends \
blackbox pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-webkit2-4.1
# Start Virtual X server
# Start Virtual X Server
echo "Start X server..."
Xvfb :99 -screen 0 2048x1536x24 &
sleep 1
# Start Window manager
# Start Window Mmanager
echo "Start window manager..."
DISPLAY=:99 blackbox &
sleep 1
briefcase-run-prefix: 'DISPLAY=:99'
setup-python: false # Use the system Python packages
app-user-data-path: "$HOME/.local/share/testbed"

- backend: "linux-wayland"
platform: "linux"
runs-on: "ubuntu-22.04"
# The package list should be the same as in tutorial-0.rst, and the BeeWare
# tutorial, plus mutter to provide a window manager, and libjpeg-dev for Pillow.
pre-command: |
sudo apt update -y
sudo apt install -y --no-install-recommends \
mutter pkg-config python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-webkit2-4.1
# Start Virtual X Server
echo "Start X server..."
Xvfb :99 -screen 0 2048x1536x24 &
sleep 1
# Start Window Manager
echo "Start window manager..."
# mutter is being run inside a virtual X server because mutter's headless
# mode is not compatible with Gtk
DISPLAY=:99 MUTTER_DEBUG_DUMMY_MODE_SPECS=2048x1536 \
mutter --nested --wayland --no-x11 --wayland-display toga &
sleep 1
briefcase-run-prefix: "WAYLAND_DISPLAY=toga"
setup-python: false # Use the system Python packages
app-user-data-path: "$HOME/.local/share/testbed"

- backend: "windows"
platform: "windows"
runs-on: "windows-latest"
Expand All @@ -238,7 +277,7 @@ jobs:
platform: "android"
runs-on: "ubuntu-latest"
briefcase-run-prefix: JAVA_HOME=${JAVA_HOME_17_X64}
briefcase-run-args: >
briefcase-run-args: >-
--device '{"avd":"beePhone","skin":"pixel_3a"}'
--Xemulator=-no-window
--Xemulator=-no-snapshot
Expand All @@ -252,8 +291,13 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
steps:
# Github runners seem to have intermittent connectivity issues.
# See https://github.com/beeware/toga/issues/2632
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1.0.0

- name: Checkout
uses: actions/checkout@v4.1.6
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

Expand All @@ -279,7 +323,7 @@ jobs:
timeout-minutes: 15
run: |
${{ matrix.briefcase-run-prefix }} \
briefcase run ${{ matrix.platform }} --test ${{ matrix.briefcase-run-args }}
briefcase run ${{ matrix.platform }} --log --test ${{ matrix.briefcase-run-args }} -- --ci
- name: Upload Logs
uses: actions/upload-artifact@v4.3.3
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
ci:
uses: ./.github/workflows/ci.yml
with:
attest-package: "true"

docs:
name: Verify Docs Build
Expand All @@ -24,28 +26,29 @@ jobs:
permissions:
contents: write
steps:
- name: Set build variables
- name: Set Build Variables
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV
- name: Get packages
- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.ci.outputs.artifact-name }}-*
pattern: ${{ format('{0}-*', needs.ci.outputs.artifact-basename) }}
merge-multiple: true
path: dist

- name: Create release
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
name: ${{ env.VERSION }}
draft: true
artifacts: "*/dist/*"
artifacts: "dist/*"
artifactErrorsFailBuild: true

deploy-test:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: [ci, release]
needs: [ ci, release ]
permissions:
# This permission is required for trusted publishing.
id-token: write
Expand All @@ -68,16 +71,17 @@ jobs:
- "toga_web"
- "toga_winforms"
steps:
- name: Get packages
- name: Get Packages
uses: actions/download-artifact@v4.1.7
with:
pattern: ${{ needs.ci.outputs.artifact-name }}-*
pattern: ${{ format('{0}-*', needs.ci.outputs.artifact-basename) }}
merge-multiple: true
path: staging_dist

- name: Extract ${{ matrix.package }}
run: |
mkdir dist
mv */dist/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist
mv staging_dist/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -24,7 +24,7 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.0
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
Expand Down
2 changes: 1 addition & 1 deletion android/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools==70.0.0",
"setuptools==70.1.0",
"setuptools_scm==8.1.0",
"setuptools_dynamic_dependencies @ git+https://github.com/beeware/setuptools_dynamic_dependencies",
]
Expand Down
Loading

0 comments on commit 7bbbdfa

Please sign in to comment.