From 491d9a52e58e72a1cda3407470be08207364f838 Mon Sep 17 00:00:00 2001 From: Jonathan Perret Date: Mon, 28 Oct 2024 23:37:19 +0100 Subject: [PATCH] build: use complete Python version This should give us more control over which exact Python version we're using for the build (i.e. 3.11.9 vs. 3.11.10). For the Linux build, this also lets us select a version which has a `python-appimage` build available. --- .github/actions/init-environment/action.yml | 20 ++++++++++---------- .github/workflows/build-multi-os.yml | 15 ++++++++------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/actions/init-environment/action.yml b/.github/actions/init-environment/action.yml index 6cdfc092..aa6038d2 100644 --- a/.github/actions/init-environment/action.yml +++ b/.github/actions/init-environment/action.yml @@ -8,13 +8,19 @@ outputs: value: ${{steps.vars.outputs.draft}} manifest: value: ${{steps.vars.outputs.manifest}} - python: - value: ${{steps.vars.outputs.python}} + python-minor: + value: ${{steps.vars.outputs.python-minor}} python-appimage: value: ${{steps.vars.outputs.python-appimage}} runs: using: "composite" steps: + - name: Set up Python ${{ matrix.python-version }} + id: py + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" - name: Set variables id: vars shell: bash @@ -23,8 +29,8 @@ runs: echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT echo "draft=$(git describe --tags | sed -e 's/^test.*/true/;s/^v.*/false/')" >> $GITHUB_OUTPUT echo "manifest=$(cat src/main/resources/base/ayab/firmware/manifest.txt)" >> $GITHUB_OUTPUT - echo "python=python${{matrix.python-version}}" >> $GITHUB_OUTPUT - echo "python-appimage=python${{matrix.python-version}}.9-cp311-cp311-manylinux_2_28_x86_64.AppImage" >> $GITHUB_OUTPUT + echo "python-minor=$(echo '${{steps.py.outputs.python-version}}' | sed -e 's/\.[^.]*$//')" >> $GITHUB_OUTPUT + echo "python-appimage=python${{steps.py.outputs.python-version}}-cp311-cp311-manylinux_2_28_x86_64.AppImage" >> $GITHUB_OUTPUT - name: Set PACKAGE_VERSION shell: bash run: | @@ -32,9 +38,3 @@ runs: # remove suffix from semver tag, as fbs does not support them version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^v?([0-9]+\.[0-9]+\.[0-9]+).*$/\1/') sed -i -e s/PACKAGE_VERSION/$version_without_suffix/ src/build/settings/base.json - - name: Set up Python ${{ matrix.python-version }} - id: py - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" diff --git a/.github/workflows/build-multi-os.yml b/.github/workflows/build-multi-os.yml index 3a1d0146..0e62195d 100644 --- a/.github/workflows/build-multi-os.yml +++ b/.github/workflows/build-multi-os.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: [3.11] + python-version: [3.11.9] steps: - name: Checkout code uses: actions/checkout@v4 @@ -173,7 +173,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: [3.11] + python-version: [3.11.9] steps: - name: Checkout code uses: actions/checkout@v4 @@ -301,7 +301,7 @@ jobs: runs-on: macos-14 strategy: matrix: - python-version: [3.11] + python-version: [3.11.9] steps: - name: Checkout code uses: actions/checkout@v4 @@ -424,7 +424,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: [3.11] + # Using Python 3.11.10 specifically for Linux builds due to python-appimage availability + python-version: [3.11.10] steps: - name: Checkout repo into AppDir uses: actions/checkout@v4 @@ -440,7 +441,7 @@ jobs: cp -r !(git) git shopt -u dotglob - name: Download AppImage of Python designed for manylinux - run: wget -c https://github.com/niess/python-appimage/releases/download/${{steps.vars.outputs.python}}/${{steps.vars.outputs.python-appimage}} + run: wget -c https://github.com/niess/python-appimage/releases/download/python${{steps.vars.outputs.python-minor}}/${{steps.vars.outputs.python-appimage}} - name: Extract the AppImage run: | chmod +x ${{steps.vars.outputs.python-appimage}} @@ -454,12 +455,12 @@ jobs: ./AppRun -m pip install --upgrade pip ./AppRun -m pip install --upgrade setuptools # hack to fix setup.py script with faulty include - ./AppRun -m pip install --global-option=build_ext --global-option="-I$(pwd)/opt/${{steps.vars.outputs.python}}/include/${{steps.vars.outputs.python}}" simpleaudio + ./AppRun -m pip install --global-option=build_ext --global-option="-I$(pwd)/opt/${{steps.vars.outputs.python-minor}}/include/${{steps.vars.outputs.python-minor}}" simpleaudio ./AppRun -m pip install -r requirements.build.txt - name: Add AppDir subdirectories to PATH run: | echo "usr/bin" >> $GITHUB_PATH - echo "opt/${{steps.vars.outputs.python}}/bin" >> $GITHUB_PATH + echo "opt/${{steps.vars.outputs.python-minor}}/bin" >> $GITHUB_PATH - name: Restore cached firmware id: firmware-cache uses: actions/cache@v4