Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CI #2

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xoscar_ray/_version.py export-subst
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
assignees: ''

---

### Describe the bug
A clear and concise description of what the bug is.

### To Reproduce
To help us to reproduce this bug, please provide information below:

1. Your Python version
2. The version of Xoscar you use
3. Versions of crucial packages, such as numpy, scipy and pandas
4. Full stack of the error.
5. Minimized code to reproduce the error.

### Expected behavior
A clear and concise description of what you expected to happen.

### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context or screenshots about the feature request here.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Other
about: Submit other issues here.
title: ''
labels: ''
assignees: ''

---

Note that the issue tracker is NOT the place for general support. For
discussions about development, questions about usage, or any general questions,
contact us on https://discuss.xorbits.io/.
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Thank you for your contribution!
-->

## What do these changes do?

<!-- Please give a short brief about these changes. -->

## Related issue number

<!-- Are there any issues opened that will be resolved by merging this change? -->
Fixes #xxxx

## Check code requirements

- [ ] tests added / passed (if needed)
- [ ] Ensure all linting tests pass
6 changes: 6 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 90%
threshold: 1%
21 changes: 21 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pull_request_rules:
- name: automatic update
conditions:
- -conflict # skip PRs with conflicts
- -draft # filter-out GH draft PRs
actions:
update:
- name: Automatic merge
conditions:
- "#approved-reviews-by>=2"
- check-success=lint (ubuntu-latest, 3.10)
- check-success=build_test_job (ubuntu-latest, 3.8, ray)
- check-success=build_test_job (ubuntu-latest, 3.9, ray)
- check-success=build_test_job (ubuntu-latest, 3.10, ray)
- check-success=build_test_job (ubuntu-latest, 3.11, ray)
- check-success=codecov/project
# - check-success=docs/readthedocs.org:xoscar
- base=main
actions:
merge:
method: squash
19 changes: 19 additions & 0 deletions .github/workflows/assign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Assign
on:
issue_comment:
types: created

permissions:
contents: read

jobs:
issue_assign:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- if: github.event.comment.body == 'take'
run: |
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
117 changes: 117 additions & 0 deletions .github/workflows/build-wheel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build and upload to PyPI

on:
schedule:
# trigger build every day at 4:30 UTC
- cron: '30 4 * * *'
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
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"

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/cibuildwheel@v2.11.3
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: .

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

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

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

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

upload_pypi:
needs: [build_wheels, 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')
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist

# if is xprobe repo, upload to pypi
- uses: pypa/gh-action-pypi-publish@v1.5.0
if: github.repository == 'xprobe-inc/xoscar_ray'
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}

# if is not xprobe repo, upload to test
- uses: pypa/gh-action-pypi-publish@v1.5.0
if: github.repository != 'xprobe-inc/xoscar_ray'
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
verbose: true
repository_url: https://test.pypi.org/legacy/
100 changes: 100 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Python CI

on:
push:
branches:
- '*'
pull_request:
types: ['opened', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: "xoscar_ray"
args: "--config setup.cfg"
- name: black
uses: psf/black@stable
with:
src: "xoscar_ray"
options: "--check"
- uses: isort/isort-action@master
with:
sortPaths: "xoscar_ray"
configuration: "--check-only --diff --sp setup.cfg"
- name: mypy
run: pip install mypy && mypy xoscar_ray
- name: codespell
run: pip install codespell && cd python && codespell xoscar_ray

build_test_job:
runs-on: ${{ matrix.os }}
needs: lint
env:
CONDA_ENV: xoscar_ray-test
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
module: ["ray"]

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}

- name: Install dependencies
env:
MODULE: ${{ matrix.module }}
run: |
pip install numpy scipy cython coverage flaky
pip install -e ".[dev,extra]"
working-directory: .

- name: Test with pytest
env:
MODULE: ${{ matrix.module }}
run: |
pytest --cov-config=setup.cfg --cov-report=xml --cov=xoscar_ray --durations=0 \
--log-level=DEBUG --timeout=200 xoscar_ray -m ray
working-directory: .

- name: Report coverage data
uses: codecov/codecov-action@v3
with:
working-directory: .
flags: unittests
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

.idea
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
files: xoscar_ray
repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config, setup.cfg]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--sp, setup.cfg]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
hooks:
- id: mypy
additional_dependencies: [tokenize-rt==3.2.0]
args: [--ignore-missing-imports, --follow-imports, skip]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
args: [ --config, setup.cfg]
Loading