release_wheel #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A workflow to build wheel packages and create a draft release. | |
name: release_wheel | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'release*' | |
jobs: | |
create-release: | |
name: Create new draft release | |
runs-on: 'ubuntu-22.04' | |
timeout-minutes: 30 | |
outputs: | |
upload-url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false | |
build-wheel: | |
name: Build-wheel ${{ matrix.cfg.name }} for Python ${{ matrix.py.version }} | |
runs-on: ${{ matrix.cfg.os }} | |
needs: create-release | |
strategy: | |
matrix: | |
cfg: | |
- { name: 'ManyLinux 2.35 LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld } | |
- { name: 'ManyLinux 2.31 LLVM+libstdc++', os: 'ubuntu-20.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld } | |
- { 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 14 x86_64 LLVM+libc++', os: 'macos-14', 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', cc: clang, cxx: clang++, | |
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 } | |
- { name: 'MacOS 14 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, | |
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_14_0_arm64 } | |
python-version: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- '3.13' | |
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.python-version }} | |
- name: Install Python Dependencies | |
run: pip3 install --upgrade pip packaging check-wheel-contents setuptools | |
- 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/${{ env.WHEEL_NAME }} | |
asset_name: ${{ env.WHEEL_NAME }} | |
asset_content_type: application/zip |