-
Notifications
You must be signed in to change notification settings - Fork 54
106 lines (85 loc) · 3.51 KB
/
make_wheel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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: 'Linux LLVM+libstdc++', os: 'ubuntu-20.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', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 }
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.python-version }}
- name: Install Python Dependencies
run: pip3 install --upgrade pip packaging check-wheel-contents
- 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