Skip to content

Commit

Permalink
Init code (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
qianduoduo0904 authored Mar 14, 2023
1 parent abd6b76 commit 963b688
Show file tree
Hide file tree
Showing 32 changed files with 3,366 additions and 53 deletions.
58 changes: 8 additions & 50 deletions .github/workflows/build-wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,21 @@ concurrency:
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [auto]
requires-python: [">=3.8,<3.10", ">=3.10,<3.12"]
include:
- os: ubuntu-latest
arch: aarch64
requires-python: ">=3.8,<3.9"
- os: ubuntu-latest
arch: aarch64
requires-python: ">=3.9,<3.10"
- os: ubuntu-latest
arch: aarch64
requires-python: ">=3.10,<3.11"
- os: ubuntu-latest
arch: aarch64
requires-python: ">=3.11,<3.12"
- os: macos-latest
arch: universal2
requires-python: ">=3.8,<3.10"
- os: macos-latest
arch: universal2
requires-python: ">=3.10,<3.12"

build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_PROJECT_REQUIRES_PYTHON: ${{ matrix.requires-python }}
CIBW_BEFORE_BUILD_MACOS: pip install -r CI/requirements-wheel.txt
CIBW_BEFORE_BUILD_WINDOWS: pip install -r CI/requirements-wheel.txt
CIBW_TEST_COMMAND: pytest {project}/CI/test_functionality.py
CIBW_TEST_REQUIRES: pytest requests
CIBW_BUILD_VERBOSITY: 1
with:
package-dir: .
- name: Build wheel
run: python setup.py bdist_wheel --python-tag py3

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
path: ./dist/*.whl

build_sdist:
name: Build source distribution
Expand All @@ -81,14 +39,14 @@ jobs:
submodules: recursive

- name: Build sdist
run: cd python && pipx run build --sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
needs: [build_wheel, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: mypy
run: pip install mypy && mypy xoscar_ray
- name: codespell
run: pip install codespell && cd python && codespell xoscar_ray
run: pip install codespell && codespell xoscar_ray

build_test_job:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -77,6 +77,13 @@ jobs:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}

- name: Install Xoscar
env:
MODULE: ${{ matrix.module }}
run: |
git clone https://github.com/xprobe-inc/xoscar
cd xoscar/python && pip install -e "."
- name: Install dependencies
env:
MODULE: ${{ matrix.module }}
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
import sys

from setuptools import Extension, setup
from setuptools import setup


repo_root = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -28,7 +28,7 @@

# build long description
def build_long_description():
readme_path = os.path.join(os.path.dirname(os.path.abspath(repo_root)), "README.md")
readme_path = os.path.join(repo_root, "README.md")

with open(readme_path, encoding="utf-8") as f:
return f.read()
Expand Down
30 changes: 30 additions & 0 deletions xoscar_ray/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022-2023 XProbe Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from . import _version

__version__ = _version.get_versions()["version"]


def init():
# register ray backend
from .backends import ray
from .metrics.backends import ray
from .serialization import ray

del ray

from . import debug

del debug
Loading

0 comments on commit 963b688

Please sign in to comment.