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

Enable allow-prereleases on all Python installs. #172

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/app-build-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -111,11 +111,15 @@ 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, we can use the system python as-is. On macOS/Windows, install
# a Python that matches the version provided as a system default. This is
# to avoid issues with trying to install packages into homebrew's python
# without requiring sudo.
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 == 'system' && steps.config.outputs.system-python-version || inputs.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: |
**/setup.cfg
Expand Down Expand Up @@ -222,7 +226,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 }}
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/app-create-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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.0
Expand All @@ -68,10 +73,12 @@ jobs:
path: briefcase-template

- name: Set up Python
# Always set up a Python, so that dependencies can be installed without sudo access
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ inputs.python-version }}
python-version: ${{ inputs.python-version == 'system' && steps.config.outputs.system-python-version || inputs.python-version }}
cache: pip
allow-prereleases: true
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/ci.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few thoughts reviewing this workflow:

  • All the testing of app-build-verify.yml explicitly specifies python-version; this seems unnecessary and should probably just use the default 3.x
  • For the Linux System builds, I think we should update app-build-verify.yml to allow the value system for python-version; that would signal app-build-verify.yml to skip actions/setup-python without the caller needing to explicitly specify the version of Python for the runner.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few thoughts reviewing this workflow:

  • All the testing of app-build-verify.yml explicitly specifies python-version; this seems unnecessary and should probably just use the default 3.x

I must be looking at something else, because to my eye, all the tests of app-build-verify (in ci.yml) explicitly set a python version:

  • test-verify-apps-briefcase - 3.10
  • test-verify-apps-briefcase-template - 3.11
  • test-verify-apps-android-templates - 3.11
  • test-verify-apps-iOS-templates - 3.11
  • test-verify-apps-linux-system-templates - 3.10
  • test-verify-apps-appimage-templates - 3.11
  • test-verify-apps-flatpak-templates - 3.11
  • test-verify-apps-macOS-templates - 3.11
  • test-verify-apps-web-templates - 3.11
  • test-verify-apps-windows-templates - 3.11
  • For the Linux System builds, I think we should update app-build-verify.yml to allow the value system for python-version; that would signal app-build-verify.yml to skip actions/setup-python without the caller needing to explicitly specify the version of Python for the runner.

Agreed this would be a useful feature to add.

To "yes-and" this - should we replace the existing system-python handling? The current handling has a bunch of "if the selected python version is the system python, don't install/do run this step" etc; should we replace that with "if the selected python version is system", and if the user happens to select a version of Python that happens to be the system python, then they get a "normal" python install?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must be looking at something else, because to my eye, all the tests of app-build-verify (in ci.yml) explicitly set a python version:

Right; I'm just saying I think we should not set python-version in ci.yml and instead just let it fallback to the default (i.e. 3.x) specified in app-build-verify.yml.

To "yes-and" this - should we replace the existing system-python handling?

Yeah; this has all grown organically a bit and these simplifications definitely make sense to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right; I'm just saying I think we should not set python-version in ci.yml and instead just let it fallback to the default (i.e. 3.x) specified in app-build-verify.yml.

Ah - agreed, except for keeping one as a token check of the "explicitly asking for a python version" case.

To "yes-and" this - should we replace the existing system-python handling?

Yeah; this has all grown organically a bit and these simplifications definitely make sense to me.

Ok - I've made these two changes - let me know what you think.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: "system" # must match system python for ubuntu version
repository: beeware/briefcase
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
Expand All @@ -276,7 +276,7 @@ jobs:
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: "system" # must match system python for ubuntu version
repository: beeware/briefcase
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
Expand All @@ -291,7 +291,7 @@ jobs:
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 }}
Expand All @@ -306,7 +306,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
Expand All @@ -323,7 +322,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
Expand All @@ -339,7 +337,7 @@ jobs:
needs: pre-commit
uses: ./.github/workflows/app-build-verify.yml
with:
python-version: "3.10" # must match system python for ubuntu version
python-version: "system" # must match system python for ubuntu version
repository: beeware/briefcase-linux-system-template
runner-os: ubuntu-22.04
target-platform: linux
Expand All @@ -355,7 +353,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
Expand All @@ -372,7 +369,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
Expand All @@ -388,7 +384,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
Expand All @@ -405,7 +400,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
Expand All @@ -421,7 +415,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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dep-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pre-commit-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/towncrier-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down
Loading