@@ -44,13 +44,10 @@ jobs:
4444 - name : Test finance
4545 run : |
4646 bazelisk test //libs/finance/test
47- # - name: Test python
48- # run: |
49- # # TODO: make sure we don't have to build the wheel and install it
50- # # in order to make the test to pass
51- # bazelisk build //libs/core/wrappers/python:rtbot_wheel
52- # pip install --force-reinstall dist/bin/libs/core/wrappers/python/rtbot-_VERSION_-py3-none-manylinux2014_x86_64.whl
53- # bazelisk test //libs/core/wrappers/python:rtbot_test
47+ - name : Test python
48+ run : |
49+ bazelisk build --stamp //libs/wrappers/python:rtbot_wheel
50+ bazelisk test --incompatible_use_python_toolchains=false --python_path=$(which python) //libs/wrappers/python:rtbot_test
5451 - name : Test javascript
5552 run : |
5653 bazelisk test //libs/wrappers/javascript:test
@@ -93,13 +90,12 @@ jobs:
9390 path : dist/bin/libs/api/jsonschema
9491
9592 build_wheels :
96- name : Build wheel on ${{ matrix.os }}
93+ name : Build wheel on ${{ matrix.os }} Python ${{ matrix.python-version }}
9794 runs-on : ${{ matrix.os }}
9895 strategy :
9996 matrix :
100- os : [ubuntu-20.04, macOS-11, windows-2019]
101- # TODO: add more python versions later, when we can afford the cost
102- # python: [3.11]
97+ os : [ubuntu-20.04, macOS-12]
98+ python-version : ["3.10", "3.11", "3.12", "3.13"]
10399 steps :
104100 - uses : actions/checkout@v3
105101 - uses : pnpm/action-setup@v2.2.4
@@ -109,21 +105,49 @@ jobs:
109105 - args: [--frozen-lockfile]
110106 - uses : actions/setup-python@v4
111107 with :
112- python-version : 3.11 # ${{ matrix.python }}
108+ python-version : ${{ matrix.python-version }}
113109 - name : Mount bazel caches
114110 uses : actions/cache@v3
115111 with :
116112 path : |
117113 "~/.cache/bazel"
118- key : bazel-cache-${{ matrix.os }}
114+ key : bazel-cache-${{ matrix.os }}-py${{ matrix.python-version }}
119115 - uses : bazelbuild/setup-bazelisk@v2
120116 - name : Build wheel
121117 run : |
122118 bazelisk build --stamp //libs/wrappers/python:rtbot_wheel
119+ - name : Rename wheel with platform tag
120+ run : |
121+ cd dist/bin/libs/wrappers/python/
122+ WHEEL_FILE="rtbot.whl"
123+ if [ -f "$WHEEL_FILE" ]; then
124+ # Extract version from wheel metadata
125+ VERSION=$(python -c "
126+ import zipfile, re
127+ with zipfile.ZipFile('$WHEEL_FILE', 'r') as z :
128+ for name in z.namelist() :
129+ if '.dist-info/METADATA' in name :
130+ # Extract version from rtbot-VERSION.dist-info/METADATA
131+ dist_info_dir = name.split('/')[0]
132+ version = dist_info_dir.replace('rtbot-', '').replace('.dist-info', '')
133+ print(version)
134+ break
135+ " )
136+ # Determine platform tag
137+ if [ " ${{ runner.os }}" = "Linux" ]; then
138+ PLATFORM="manylinux2014_x86_64"
139+ else
140+ PLATFORM="macosx_10_9_x86_64"
141+ fi
142+ # Create properly named wheel
143+ NEW_NAME="rtbot-${VERSION}-py3-none-${PLATFORM}.whl"
144+ cp "$WHEEL_FILE" "$NEW_NAME"
145+ echo "Created wheel : $NEW_NAME"
146+ fi
123147 - uses : actions/upload-artifact@v3
124148 with :
125- name : wheel-${{ matrix.os }}.tar
126- path : dist/bin/libs/wrappers/python/rtbot-*.whl
149+ name : wheel-${{ matrix.os }}-py${{ matrix.python-version }}
150+ path : dist/bin/libs/wrappers/python/rtbot-*-py3-none-* .whl
127151
128152 publish :
129153 needs :
@@ -149,18 +173,12 @@ jobs:
149173 run : |
150174 GIT_TAG=${{ github.ref_name }}
151175 echo "version=${GIT_TAG:1}" >> $GITHUB_OUTPUT
152- - uses : actions/download-artifact@v3
153- with :
154- name : wheel-ubuntu-20.04.tar
155- path : wheel-linux
156- - uses : actions/download-artifact@v3
157- with :
158- name : wheel-macOS-11.tar
159- path : wheel-macos
160- - uses : actions/download-artifact@v3
176+ # Download all wheel artifacts
177+ - name : Download all wheel artifacts
178+ uses : actions/download-artifact@v3
161179 with :
162- name : wheel-windows-2019.tar
163- path : wheel-windows
180+ path : wheels/
181+ pattern : wheel-*
164182 - uses : actions/download-artifact@v3
165183 with :
166184 name : npm-wasm.tar
@@ -173,18 +191,14 @@ jobs:
173191 with :
174192 name : jsonschema.tar
175193 path : jsonschema
176- - name : Patch files before publishing
194+ - name : Organize wheels for release
177195 run : |
178- ls -l
179- cd wheel-linux
180- mv rtbot-_VERSION_-py3-none-manylinux2014_x86_64.whl rtbot-${{ steps.version.outputs.version }}-py3-none-manylinux2014_x86_64.whl
181- cd ..
182- cd wheel-macos
183- mv rtbot-_VERSION_-py3-none-macosx_10_7_x86_64.whl rtbot-${{ steps.version.outputs.version }}-py3-none-macosx_10_7_x86_64.whl
184- cd ..
185- cd wheel-windows
186- mv rtbot-_VERSION_-py3-none-win_amd64.whl rtbot-${{ steps.version.outputs.version }}-py3-none-win_amd64.whl
187- cd ..
196+ ls -la wheels/
197+ # Create directories for organizing wheels
198+ mkdir -p wheel-organized
199+ # Copy all wheels to organized directory
200+ find wheels/ -name "*.whl" -exec cp {} wheel-organized/ \;
201+ ls -la wheel-organized/
188202 # copy repo readme to main npm package
189203 cp README.md ./npm-rtbot
190204 # package npm files, which will be used on the github release
@@ -208,7 +222,5 @@ jobs:
208222 files : |
209223 *.tar.gz
210224 jsonschema/*
211- wheel-linux/*
212- wheel-macos/*
213- wheel-windows/*
225+ wheel-organized/*
214226 fail_on_unmatched_files : true
0 commit comments