Skip to content

Commit

Permalink
build: use complete Python version
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonathanperret committed Oct 29, 2024
1 parent 205d651 commit 491d9a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
20 changes: 10 additions & 10 deletions .github/actions/init-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,18 +29,12 @@ 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: |
echo ${{ steps.vars.outputs.tag }} > src/main/resources/base/ayab/package_version
# 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"
15 changes: 8 additions & 7 deletions .github/workflows/build-multi-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}}
Expand All @@ -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
Expand Down

0 comments on commit 491d9a5

Please sign in to comment.