diff --git a/.github/workflows/make_wheel.yml b/.github/workflows/make_wheel.yml index 395b9e4..d1431b0 100644 --- a/.github/workflows/make_wheel.yml +++ b/.github/workflows/make_wheel.yml @@ -41,43 +41,86 @@ 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++, - 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: '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', 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 - - 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: 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 + + - name: Check wheel contents + run: | + pip install --upgrade check-wheel-contents + check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }} + + - name: Upload wheel as artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: bazel-bin/dmlab2d/${{ env.WHEEL_NAME }} + retention-days: 1 + + upload-wheel-to-pypi: + name: Upload wheel to Pypi + runs-on: ubuntu-latest + needs: build-wheel + timeout-minutes: 30 + + steps: + - name: Download all wheels + uses: actions/download-artifact@v3 + + - name: Publish package to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TESTPYPI_API_TOKEN }} + packages-dir: dist + repository-url: https://test.pypi.org/legacy/ + + - name: Publish package to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages-dir: dist diff --git a/dmlab2d/BUILD b/dmlab2d/BUILD index 407dd03..a6e1408 100644 --- a/dmlab2d/BUILD +++ b/dmlab2d/BUILD @@ -113,6 +113,8 @@ py_package( ], ) +VERSION = "1.0.0-dev.8" # http://semver.org + py_wheel( name = "dmlab2d_wheel", abi = PY_TAGS.abi, @@ -130,7 +132,7 @@ py_wheel( "dm_env", "numpy", ], - version = "1.0", + version = VERSION, deps = [":dmlab2d_pkg"], ) @@ -153,7 +155,7 @@ py_wheel( "dm_env", "numpy", ], - version = "1.0", + version = VERSION, deps = [":dmlab2d_pkg"], )