Skip to content

Commit

Permalink
[make_wheel.yml] Add some basic testing of the built wheels
Browse files Browse the repository at this point in the history
Wheels are tested with check-wheel-contents and by installing the
wheel locally and importing the module from a small demo program.
  • Loading branch information
jagapiou authored and tkoeppe committed Jun 9, 2023
1 parent 777e2aa commit e66c0eb
Showing 1 changed file with 39 additions and 16 deletions.
55 changes: 39 additions & 16 deletions .github/workflows/make_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,66 @@ jobs:
strategy:
matrix:
cfg:
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', platform: 'manylinux_2_35_x86_64', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
- { 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 }
- { 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 }
- { 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 }
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', platform: 'macosx_12_0_arm64', cc: clang, cxx: clang++,
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
- { name: 'MacOS 11 x86_64 LLVM+libc++', os: 'macos-11', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_12_0_arm64 }
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', platform: 'macosx_13_0_arm64', cc: clang, cxx: clang++,
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 }
py:
- { version: '3.8', interp: 'cp38', abi: 'cp38' }
- { version: '3.9', interp: 'cp39', abi: 'cp39' }
- { version: '3.10', interp: 'cp310', abi: 'cp310' }
- { version: '3.11', interp: 'cp311', abi: 'cp311' }
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'

env:
CC: ${{ matrix.cfg.cc }}
CXX: ${{ matrix.cfg.cxx }}
WHEEL_NAME: ''

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py.version }}
python-version: ${{ matrix.python-version }}

- name: Install Python Dependencies
run: pip3 install --upgrade pip packaging
run: pip3 install --upgrade pip packaging check-wheel-contents

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

- name: Get built wheel name
working-directory: bazel-bin/dmlab2d
run: |
WHEEL_NAME="$(ls *.whl)"
echo WHEEL_NAME="${WHEEL_NAME}" >> "${GITHUB_ENV}"
- name: Check wheel contents
run: check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}

- name: Test wheel
if: (!contains(env.WHEEL_NAME, 'arm64'))
run: |
pip install bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
python -I - <<'____HERE'
import dmlab2d
import dmlab2d.runfiles_helper
lab = dmlab2d.Lab2d(dmlab2d.runfiles_helper.find(), {"levelName": "chase_eat"})
env = dmlab2d.Environment(lab, ["WORLD.RGB"])
env.step({})
____HERE
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload-url }}
asset_path: bazel-bin/dmlab2d/dmlab2d-1.0-${{ matrix.py.interp }}-${{ matrix.py.abi }}-${{ matrix.cfg.platform }}.whl
asset_name: dmlab2d-1.0-${{ matrix.py.interp }}-${{ matrix.py.abi }}-${{ matrix.cfg.platform }}.whl
asset_path: bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
asset_name: ${{ env.WHEEL_NAME }}
asset_content_type: application/zip

0 comments on commit e66c0eb

Please sign in to comment.