diff --git a/.github/workflows/app-build-verify.yml b/.github/workflows/app-build-verify.yml index b2e7301..3dcb5ed 100644 --- a/.github/workflows/app-build-verify.yml +++ b/.github/workflows/app-build-verify.yml @@ -10,7 +10,7 @@ on: inputs: python-version: description: "Python version to use; defaults to latest Python release." - default: "3.X" + default: "3.x" type: string runner-os: description: "The OS to use to build the App; must be a fully qualified GitHub runner OS, e.g. ubuntu-latest." @@ -82,9 +82,6 @@ jobs: fi echo "cache-key=$(date +%Y-%m)|${CACHE_KEY}" | tee -a ${GITHUB_OUTPUT} - SYSTEM_PYTHON_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') - echo "system-python-version=${SYSTEM_PYTHON_VER}" | tee -a ${GITHUB_OUTPUT} - - name: Checkout ${{ inputs.repository }} uses: actions/checkout@v4.2.1 with: @@ -111,11 +108,14 @@ jobs: path: ${{ steps.config.outputs.briefcase-data-dir }} - name: Set Up Python - # Linux System apps requires python is System Python to run the app - if: ${{ !startsWith(inputs.runner-os, 'ubuntu') || !startsWith(inputs.python-version, steps.config.outputs.system-python-version) }} + # On Linux, accept "system" as a proxy for "don't install Python"; this will + # fall back to the system-provided Python package. Providing "system" as a value + # on macOS or Windows will cause an error. + if: ${{ !startsWith(inputs.runner-os, 'ubuntu') || inputs.python-version != 'system' }} uses: actions/setup-python@v5.2.0 with: - python-version: ${{ inputs.python-version }} + python-version: ${{ inputs.python-version || '3.x' }} + allow-prereleases: true cache: pip cache-dependency-path: | **/setup.cfg @@ -222,7 +222,7 @@ jobs: - name: Build Linux System Project (Ubuntu, local) if: > startsWith(inputs.runner-os, 'ubuntu') - && startsWith(inputs.python-version, steps.config.outputs.system-python-version) + && inputs.python-version == 'system' && contains(fromJSON('["", "Linux"]'), inputs.target-platform) && contains(fromJSON('["", "system"]'), inputs.target-format) working-directory: ${{ steps.create.outputs.project-path }} diff --git a/.github/workflows/app-create-verify.yml b/.github/workflows/app-create-verify.yml index 9496f59..cdad1e8 100644 --- a/.github/workflows/app-create-verify.yml +++ b/.github/workflows/app-create-verify.yml @@ -9,7 +9,7 @@ on: inputs: python-version: description: "Python version to use; defaults to latest Python release." - default: "3.X" + default: "3.x" type: string runner-os: description: "The OS to use to build the App; must be a fully qualified GitHub runner OS, e.g. ubuntu-latest." @@ -47,6 +47,11 @@ jobs: runs-on: ${{ inputs.runner-os }} timeout-minutes: 30 steps: + - name: Workflow Configuration + id: config + run: | + SYSTEM_PYTHON_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') + echo "system-python-version=${SYSTEM_PYTHON_VER}" | tee -a ${GITHUB_OUTPUT} - name: Checkout ${{ inputs.repository }} uses: actions/checkout@v4.2.1 @@ -68,10 +73,15 @@ jobs: path: briefcase-template - name: Set up Python + # On Linux, accept a value of "system", which will install a version of + # Python matching the system version. We can't use the actual system + # install because we need to install dependencies, which would either + # require the use of sudo, or extra workarounds for user-space packages. uses: actions/setup-python@v5.2.0 with: - python-version: ${{ inputs.python-version }} + python-version: ${{ startsWith(inputs.runner-os, 'ubuntu') && inputs.python-version == 'system' && steps.config.outputs.system-python-version || inputs.python-version || '3.x' }} cache: pip + allow-prereleases: true cache-dependency-path: | **/setup.cfg **/pyproject.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 470d932..f89dcf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.2.0 with: - python-version: 3.X + python-version: "3.x" cache: pip cache-dependency-path: | **/setup.cfg @@ -261,7 +261,7 @@ jobs: 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 + python-version: ${{ matrix.python-version }} # Falls back to 3.x if undefined repository: beeware/briefcase runner-os: ${{ matrix.runner-os }} framework: ${{ matrix.framework }} @@ -270,13 +270,17 @@ jobs: matrix: framework: [ toga, pyside6 ] runner-os: [ macos-latest, windows-latest, ubuntu-22.04 ] + includes: + # Ubuntu apps need to run on the system Python + - runner-os: ubuntu-22.04 + python-version: "system" 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 + python-version: ${{ matrix.python-version }} # Falls back to 3.x if undefined repository: beeware/briefcase runner-os: ${{ matrix.runner-os }} framework: ${{ matrix.framework }} @@ -285,13 +289,17 @@ jobs: matrix: framework: [ toga ] runner-os: [ macos-latest, windows-latest, ubuntu-22.04 ] + includes: + # Ubuntu apps need to run on the system Python + - runner-os: ubuntu-22.04 + python-version: "system" test-verify-apps-briefcase-template: name: Verify Briefcase Template needs: pre-commit uses: ./.github/workflows/app-build-verify.yml with: - python-version: "3.11" + python-version: "3.11" # Explicitly test the python-version override repository: beeware/briefcase-template runner-os: ${{ matrix.runner-os }} framework: ${{ matrix.framework }} @@ -306,7 +314,6 @@ jobs: 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 @@ -323,7 +330,6 @@ jobs: 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 @@ -339,7 +345,8 @@ jobs: needs: pre-commit uses: ./.github/workflows/app-build-verify.yml with: - python-version: "3.10" # must match system python for ubuntu version + # Ubuntu apps need to run on the system Python + python-version: "system" repository: beeware/briefcase-linux-system-template runner-os: ubuntu-22.04 target-platform: linux @@ -355,7 +362,6 @@ jobs: 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 @@ -372,7 +378,6 @@ jobs: 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 @@ -388,7 +393,6 @@ jobs: 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 @@ -405,7 +409,6 @@ jobs: 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 @@ -421,7 +424,6 @@ jobs: 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 diff --git a/.github/workflows/dep-version-bump.yml b/.github/workflows/dep-version-bump.yml index 4721932..42487dc 100644 --- a/.github/workflows/dep-version-bump.yml +++ b/.github/workflows/dep-version-bump.yml @@ -72,7 +72,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.2.0 with: - python-version: 3.X + python-version: "3.x" - name: Install Dependencies run: | diff --git a/.github/workflows/pre-commit-run.yml b/.github/workflows/pre-commit-run.yml index b6f2543..99d27b2 100644 --- a/.github/workflows/pre-commit-run.yml +++ b/.github/workflows/pre-commit-run.yml @@ -9,7 +9,7 @@ on: inputs: python-version: description: "Python version to use; defaults to latest Python release." - default: "3.X" + default: "3.x" type: string repository: description: "GitHub repository to checkout; defaults to repo running this workflow." @@ -44,6 +44,7 @@ jobs: uses: actions/setup-python@v5.2.0 with: python-version: ${{ inputs.python-version }} + allow-prereleases: true cache: pip cache-dependency-path: | **/setup.cfg diff --git a/.github/workflows/pre-commit-update.yml b/.github/workflows/pre-commit-update.yml index 4d67921..ddd4d96 100644 --- a/.github/workflows/pre-commit-update.yml +++ b/.github/workflows/pre-commit-update.yml @@ -75,7 +75,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.2.0 with: - python-version: 3.X + python-version: "3.x" cache: pip cache-dependency-path: | **/setup.cfg diff --git a/.github/workflows/towncrier-run.yml b/.github/workflows/towncrier-run.yml index b51051e..dd6021f 100644 --- a/.github/workflows/towncrier-run.yml +++ b/.github/workflows/towncrier-run.yml @@ -9,7 +9,7 @@ on: inputs: python-version: description: "Python version to use; defaults to latest Python release." - default: "3.X" + default: "3.x" type: string repository: description: "GitHub repository to checkout; defaults to repo running this workflow." @@ -55,6 +55,7 @@ jobs: uses: actions/setup-python@v5.2.0 with: python-version: ${{ inputs.python-version }} + allow-prereleases: true cache: pip cache-dependency-path: | **/setup.cfg