Skip to content

Commit e66c0eb

Browse files
jagapioutkoeppe
authored andcommitted
[make_wheel.yml] Add some basic testing of the built wheels
Wheels are tested with check-wheel-contents and by installing the wheel locally and importing the module from a small demo program.
1 parent 777e2aa commit e66c0eb

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

.github/workflows/make_wheel.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,66 @@ jobs:
4141
strategy:
4242
matrix:
4343
cfg:
44-
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', platform: 'manylinux_2_35_x86_64', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
45-
- { name: 'MacOS 11 x86_64 LLVM+libc++', os: 'macos-11', platform: 'macosx_11_0_x86_64', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
46-
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', platform: 'macosx_12_0_x86_64', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
47-
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', platform: 'macosx_13_0_x86_64', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
48-
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', platform: 'macosx_12_0_arm64', cc: clang, cxx: clang++,
44+
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
45+
- { name: 'MacOS 11 x86_64 LLVM+libc++', os: 'macos-11', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
46+
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
47+
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
48+
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++,
4949
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_12_0_arm64 }
50-
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', platform: 'macosx_13_0_arm64', cc: clang, cxx: clang++,
50+
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++,
5151
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 }
52-
py:
53-
- { version: '3.8', interp: 'cp38', abi: 'cp38' }
54-
- { version: '3.9', interp: 'cp39', abi: 'cp39' }
55-
- { version: '3.10', interp: 'cp310', abi: 'cp310' }
56-
- { version: '3.11', interp: 'cp311', abi: 'cp311' }
52+
python-version:
53+
- '3.8'
54+
- '3.9'
55+
- '3.10'
56+
- '3.11'
5757

5858
env:
5959
CC: ${{ matrix.cfg.cc }}
6060
CXX: ${{ matrix.cfg.cxx }}
61+
WHEEL_NAME: ''
6162

6263
steps:
6364
- uses: actions/checkout@v3
6465

6566
- uses: actions/setup-python@v3
6667
with:
67-
python-version: ${{ matrix.py.version }}
68+
python-version: ${{ matrix.python-version }}
6869

6970
- name: Install Python Dependencies
70-
run: pip3 install --upgrade pip packaging
71+
run: pip3 install --upgrade pip packaging check-wheel-contents
7172

72-
- name: Build for Python ${{ matrix.py.version }}
73+
- name: Build for Python ${{ matrix.python-version }}
7374
run: bazel --bazelrc=.bazelrc build --compilation_mode=opt --dynamic_mode=off --config=luajit ${{ matrix.cfg.config }} //dmlab2d:dmlab2d_wheel
7475

76+
- name: Get built wheel name
77+
working-directory: bazel-bin/dmlab2d
78+
run: |
79+
WHEEL_NAME="$(ls *.whl)"
80+
echo WHEEL_NAME="${WHEEL_NAME}" >> "${GITHUB_ENV}"
81+
82+
- name: Check wheel contents
83+
run: check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
84+
85+
- name: Test wheel
86+
if: (!contains(env.WHEEL_NAME, 'arm64'))
87+
run: |
88+
pip install bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
89+
python -I - <<'____HERE'
90+
import dmlab2d
91+
import dmlab2d.runfiles_helper
92+
93+
lab = dmlab2d.Lab2d(dmlab2d.runfiles_helper.find(), {"levelName": "chase_eat"})
94+
env = dmlab2d.Environment(lab, ["WORLD.RGB"])
95+
env.step({})
96+
____HERE
97+
7598
- name: Upload Release Asset
7699
uses: actions/upload-release-asset@v1
77100
env:
78101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79102
with:
80103
upload_url: ${{ needs.create-release.outputs.upload-url }}
81-
asset_path: bazel-bin/dmlab2d/dmlab2d-1.0-${{ matrix.py.interp }}-${{ matrix.py.abi }}-${{ matrix.cfg.platform }}.whl
82-
asset_name: dmlab2d-1.0-${{ matrix.py.interp }}-${{ matrix.py.abi }}-${{ matrix.cfg.platform }}.whl
104+
asset_path: bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
105+
asset_name: ${{ env.WHEEL_NAME }}
83106
asset_content_type: application/zip

0 commit comments

Comments
 (0)