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 test --incompatible_use_python_toolchains=false --python_path=$(which python) //libs/wrappers/python:rtbot_test
5450 - name : Test javascript
5551 run : |
5652 bazelisk test //libs/wrappers/javascript:test
@@ -93,13 +89,12 @@ jobs:
9389 path : dist/bin/libs/api/jsonschema
9490
9591 build_wheels :
96- name : Build wheel on ${{ matrix.os }}
92+ name : Build wheel on ${{ matrix.os }} Python ${{ matrix.python-version }}
9793 runs-on : ${{ matrix.os }}
9894 strategy :
9995 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]
96+ os : [ubuntu-20.04, macOS-12]
97+ python-version : ["3.10", "3.11", "3.12", "3.13"]
10398 steps :
10499 - uses : actions/checkout@v3
105100@@ -109,21 +104,49 @@ jobs:
109104 - args: [--frozen-lockfile]
110105 - uses : actions/setup-python@v4
111106 with :
112- python-version : 3.11 # ${{ matrix.python }}
107+ python-version : ${{ matrix.python-version }}
113108 - name : Mount bazel caches
114109 uses : actions/cache@v3
115110 with :
116111 path : |
117112 "~/.cache/bazel"
118- key : bazel-cache-${{ matrix.os }}
113+ key : bazel-cache-${{ matrix.os }}-py${{ matrix.python-version }}
119114 - uses : bazelbuild/setup-bazelisk@v2
120115 - name : Build wheel
121116 run : |
122117 bazelisk build --stamp //libs/wrappers/python:rtbot_wheel
118+ - name : Rename wheel with platform tag
119+ run : |
120+ cd dist/bin/libs/wrappers/python/
121+ WHEEL_FILE="rtbot.whl"
122+ if [ -f "$WHEEL_FILE" ]; then
123+ # Extract version from wheel metadata
124+ VERSION=$(python -c "
125+ import zipfile, re
126+ with zipfile.ZipFile('$WHEEL_FILE', 'r') as z :
127+ for name in z.namelist() :
128+ if '.dist-info/METADATA' in name :
129+ # Extract version from rtbot-VERSION.dist-info/METADATA
130+ dist_info_dir = name.split('/')[0]
131+ version = dist_info_dir.replace('rtbot-', '').replace('.dist-info', '')
132+ print(version)
133+ break
134+ " )
135+ # Determine platform tag
136+ if [ " ${{ runner.os }}" = "Linux" ]; then
137+ PLATFORM="manylinux2014_x86_64"
138+ else
139+ PLATFORM="macosx_10_9_x86_64"
140+ fi
141+ # Create properly named wheel
142+ NEW_NAME="rtbot-${VERSION}-py3-none-${PLATFORM}.whl"
143+ cp "$WHEEL_FILE" "$NEW_NAME"
144+ echo "Created wheel : $NEW_NAME"
145+ fi
123146 - uses : actions/upload-artifact@v3
124147 with :
125- name : wheel-${{ matrix.os }}.tar
126- path : dist/bin/libs/wrappers/python/rtbot-*.whl
148+ name : wheel-${{ matrix.os }}-py${{ matrix.python-version }}
149+ path : dist/bin/libs/wrappers/python/rtbot-*-py3-none-* .whl
127150
128151 publish :
129152 needs :
@@ -149,18 +172,12 @@ jobs:
149172 run : |
150173 GIT_TAG=${{ github.ref_name }}
151174 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
175+ # Download all wheel artifacts
176+ - name : Download all wheel artifacts
177+ uses : actions/download-artifact@v3
161178 with :
162- name : wheel-windows-2019.tar
163- path : wheel-windows
179+ path : wheels/
180+ pattern : wheel-*
164181 - uses : actions/download-artifact@v3
165182 with :
166183 name : npm-wasm.tar
@@ -173,18 +190,14 @@ jobs:
173190 with :
174191 name : jsonschema.tar
175192 path : jsonschema
176- - name : Patch files before publishing
193+ - name : Organize wheels for release
177194 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 ..
195+ ls -la wheels/
196+ # Create directories for organizing wheels
197+ mkdir -p wheel-organized
198+ # Copy all wheels to organized directory
199+ find wheels/ -name "*.whl" -exec cp {} wheel-organized/ \;
200+ ls -la wheel-organized/
188201 # copy repo readme to main npm package
189202 cp README.md ./npm-rtbot
190203 # package npm files, which will be used on the github release
@@ -208,7 +221,5 @@ jobs:
208221 files : |
209222 *.tar.gz
210223 jsonschema/*
211- wheel-linux/*
212- wheel-macos/*
213- wheel-windows/*
224+ wheel-organized/*
214225 fail_on_unmatched_files : true
0 commit comments