Skip to content

Refactor PR Body regexing into independent GH Action #866

Refactor PR Body regexing into independent GH Action

Refactor PR Body regexing into independent GH Action #866

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
FORCE_COLOR: "1"
jobs:
pre-commit:
name: Pre-commit Checks
uses: ./.github/workflows/pre-commit-run.yml
with:
pre-commit-source: pre-commit
test-docs-build-verify:
name: Verify Docs Build
needs: pre-commit
# inherited secrets are not exposed to forked repos
if: ${{ github.event.pull_request.head.repo.owner.login == 'beeware' }}
uses: ./.github/workflows/docs-build-verify.yml
secrets: inherit
with:
project-name: ${{ matrix.name }}
project-version: ${{ matrix.version }}
strategy:
matrix:
name: [ briefcase, toga ]
include:
- name: briefcase
version: v0.3.13
- name: toga
version: v0.3.1
test-install-briefcase:
name: Install Briefcase
needs: pre-commit
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
test-case:
- "main"
- "PR Repo & Ref"
- "PR Repo & Ref (irregular)"
- "PR Ref"
- "refs/tags/v0.3.17"
- "refs/tags/v40.0.5"
- "refs/heads/v0.3.17"
- "refs/heads/v40.0.5"
- "refs/pull/v0.3.17"
- "refs/pull/v40.0.5"
include:
# Test override logic
- test-case: "main"
version: "main"
expected: "main"
# Test PR body override
- test-case: "PR Repo & Ref"
testing-pr-body: "sadf asdf BRIEFCASE_REPO: https://github.com/freakboy3742/briefcase.git xcvbwer BRIEFCASE_REF: 19215d9 xczvb https://example.com/asdf?q=repo%3Aindygreg%2"
expected: "19215d9"
- test-case: "PR Repo & Ref (irregular)"
testing-pr-body: "sadf asdf BrIeFcAsE__REpo: https://github.com/freakboy3742/briefcase.git xcvbwer BRIEFcaseREF:19215d9 xczvb https://example.com/asdf?q=repo%3Aindygreg%2"
expected: "19215d9"
- test-case: "PR Ref"
testing-pr-body: "sadf asdf BRIEFcaseREF: v0.3.17"
expected: "v0.3.17"
# Test version derivation for Releases
- test-case: "refs/tags/v0.3.17"
testing-trigger-ref: "refs/tags/v0.3.17"
testing-ref-name: "v0.3.17"
expected: "v0.3.17"
- test-case: "refs/tags/v40.0.5"
testing-trigger-ref: "refs/tags/v40.0.5"
testing-ref-name: "v40.0.5"
expected: "main"
- test-case: "refs/heads/v0.3.17"
testing-trigger-ref: "refs/heads/v0.3.17"
testing-ref-name: "v0.3.17"
expected: "v0.3.17"
- test-case: "refs/heads/v40.0.5"
testing-trigger-ref: "refs/heads/v40.0.5"
testing-ref-name: "v40.0.5"
expected: "main"
# Test version derivation for PRs
- test-case: "refs/pull/v0.3.17"
testing-trigger-ref: "refs/pull/18/merge"
testing-pr-ref: "refs/heads/v0.3.17"
expected: "v0.3.17"
- test-case: "refs/pull/v40.0.5"
testing-trigger-ref: "refs/pull/25/merge"
testing-pr-ref: "v40.0.5"
expected: "main"
steps:
- name: Checkout beeware/.github
uses: actions/checkout@v4.1.7
- name: Set up Python
uses: actions/setup-python@v5.1.1
with:
python-version: 3.X
cache: pip
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
.pre-commit-config.yaml
- name: Install Briefcase
id: briefcase
uses: ./.github/actions/install-briefcase
with:
briefcase-override-version: ${{ matrix.version }}
testing-pr-body: ${{ matrix.testing-pr-body }}
testing-trigger-ref: ${{ matrix.testing-trigger-ref }}
testing-pr-ref: ${{ matrix.testing-pr-ref }}
testing-ref-name: ${{ matrix.testing-ref-name }}
- name: Briefcase @ ${{ matrix.test-case }}
run: |
if [[ "${{ matrix.expected }}" != "${{ steps.briefcase.outputs.installed-version }}" ]]; then
echo "installed-version: ${{ steps.briefcase.outputs.installed-version }}"
echo "Found Briefcase version v$(briefcase -V)"
echo "Expected Briefcase version ${{ matrix.expected }}"
exit 1
fi
test-pre-commit-run:
name: Pre-commit
needs: pre-commit
uses: ./.github/workflows/pre-commit-run.yml
with:
repository: beeware/${{ matrix.repo }}
pre-commit-source: ${{ matrix.pre-commit-source }}
strategy:
fail-fast: false
matrix:
repo: [ briefcase, gbulb, Python-support-testbed, rubicon-objc, toga ]
include:
- pre-commit-source: .[dev]
- repo: gbulb
pre-commit-source: pre-commit
- repo: Python-support-testbed
pre-commit-source: pre-commit
- repo: toga
pre-commit-source: ./core[dev]
test-package-python:
name: Create Package
needs: pre-commit
uses: ./.github/workflows/python-package-create.yml
with:
repository: beeware/${{ matrix.repo || matrix.name }}
build-subdirectory: ${{ matrix.build-subdir }}
strategy:
fail-fast: false
matrix:
name:
- briefcase
- briefcase-automation
- gbulb
- rubicon-objc
- toga-core
- toga-android
include:
- name: briefcase-automation
repo: briefcase
build-subdir: automation
- name: toga-core
repo: toga
build-subdir: core
- name: toga-android
repo: toga
build-subdir: android
test-install-requirements:
name: Install Requirements
needs: pre-commit
runs-on: ${{ matrix.runner-os }}
strategy:
fail-fast: false
matrix:
runner-os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- name: Checkout beeware/briefcase
uses: actions/checkout@v4.1.7
with:
repository: beeware/briefcase
- name: Checkout beeware/briefcase to path
uses: actions/checkout@v4.1.7
with:
repository: beeware/briefcase
path: repos/briefcase
- name: Checkout beeware/.github
uses: actions/checkout@v4.1.7
with:
repository: beeware/.github
path: repos/.github-beeware
- name: Set up Python
uses: actions/setup-python@v5.1.1
with:
python-version: "3.x"
- name: Test Install Requirements with Path
uses: ./repos/.github-beeware/.github/actions/install-requirement
with:
requirements: "pre-commit tox"
extra: "dev"
project-root: "repos/briefcase"
- name: Test Install Requirements with Extra
uses: ./repos/.github-beeware/.github/actions/install-requirement
with:
requirements: "coverage"
extra: "dev"
- name: Test Install Requirements
uses: ./repos/.github-beeware/.github/actions/install-requirement
with:
requirements: "cookiecutter"
- name: Verify Requirements Installed
run: |
if ! python -m pip list | grep tox; then
echo '::error::Failed to install tox'
exit 1
fi
if ! python -m pip list | grep pre-commit; then
echo '::error::Failed to install pre-commit'
exit 1
fi
if ! python -m pip list | grep coverage; then
echo '::error::Failed to install coverage'
exit 1
fi
if ! python -m pip list | grep cookiecutter; then
echo '::error::Failed to install cookiecutter'
exit 1
fi
test-verify-projects-briefcase:
name: Verify Project
needs: [ pre-commit, test-package-python ]
uses: ./.github/workflows/app-create-verify.yml
with:
python-version: "3.10" # must match system python for ubuntu version
repository: beeware/briefcase
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga, pyside6 ]
runner-os: [ macos-latest, windows-latest, ubuntu-22.04 ]
test-verify-apps-briefcase:
name: Verify Briefcase
needs: [ pre-commit, test-package-python ]
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.10" # must match system python for ubuntu version
repository: beeware/briefcase
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga ]
runner-os: [ macos-latest, windows-latest, ubuntu-22.04 ]
test-verify-apps-briefcase-template:
name: Verify Briefcase Template
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-template
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga ]
runner-os: [ macos-latest, windows-latest, ubuntu-latest ]
test-verify-apps-android-templates:
name: Verify Android
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-android-gradle-template
runner-os: ${{ matrix.runner-os }}
target-platform: android
target-format: gradle
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga ] # toga only
runner-os: [ macos-latest, windows-latest, ubuntu-latest ]
test-verify-apps-iOS-templates:
name: Verify iOS
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-iOS-xcode-template
runner-os: macos-latest
target-platform: iOS
target-format: xcode
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga ] # toga only
test-verify-apps-linux-system-templates:
name: Verify Linux
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.10" # must match system python for ubuntu version
repository: beeware/briefcase-linux-system-template
runner-os: ubuntu-22.04
target-platform: linux
target-format: system
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga, pyside6, pygame, console ]
test-verify-apps-appimage-templates:
name: Verify AppImage
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-linux-appimage-template
runner-os: ubuntu-latest
target-platform: linux
target-format: appimage
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
# 2024-07-11 (beeware/briefcase#1908): pyside6 segfaults on AppImage start.
framework: [ toga, pygame, console ]
test-verify-apps-flatpak-templates:
name: Verify Flatpak
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-linux-flatpak-template
runner-os: ubuntu-latest
target-platform: linux
target-format: flatpak
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga, pyside6, pygame, console ]
test-verify-apps-macOS-templates:
name: Verify macOS
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-macos-${{ matrix.format }}-template
runner-os: macos-latest
target-platform: macOS
target-format: ${{ matrix.format }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga, pyside6, pygame, console ]
format: [ app, Xcode ]
test-verify-apps-web-templates:
name: Verify Web
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-web-static-template
runner-os: ubuntu-latest
target-platform: web
target-format: static
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga ] # toga only
test-verify-apps-windows-templates:
name: Verify Windows
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.11"
repository: beeware/briefcase-windows-${{ matrix.format }}-template
runner-os: windows-latest
target-platform: windows
target-format: ${{ matrix.format }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ toga, pyside6, pygame, console ]
format: [ app, VisualStudio ]