Skip to content

Commit

Permalink
Merge pull request #71 from opendilab/dev/constraint
Browse files Browse the repository at this point in the history
dev(hansbug): add constraint feature
  • Loading branch information
HansBug committed Dec 10, 2022
2 parents 7acf130 + b3d7ee2 commit df273ba
Show file tree
Hide file tree
Showing 15 changed files with 1,974 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- '3.8'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download cloc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- 18080:8080

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
strategy:
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
python-version:
- '3.8'

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up python dependences
Expand Down Expand Up @@ -58,9 +58,9 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
- 'windows-2019'
- 'macos-10.15'
- 'macos-12'
python:
- '3.7'
- '3.8'
Expand All @@ -73,30 +73,30 @@ jobs:
- x86
- AMD64
exclude:
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: arm64
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: x86
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: AMD64
- os: windows-2019
architecture: x86_64
- os: windows-2019
architecture: arm64
- os: windows-2019
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: x86
- os: macos-10.15
- os: macos-12
architecture: AMD64
- python: '3.7'
architecture: arm64

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20

Expand Down Expand Up @@ -125,16 +125,16 @@ jobs:
# the publishing can only be processed on linux system
wheel_publish:
name: Publish the wheels to pypi
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs:
- wheel_build
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
- 'windows-2019'
- 'macos-10.15'
- 'macos-12'
python:
- '3.7'
- '3.8'
Expand All @@ -147,23 +147,23 @@ jobs:
- x86
- AMD64
exclude:
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: arm64
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: x86
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: AMD64
- os: windows-2019
architecture: x86_64
- os: windows-2019
architecture: arm64
- os: windows-2019
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: x86
- os: macos-10.15
- os: macos-12
architecture: AMD64
- python: '3.7'
architecture: arm64
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
python-version:
- '3.8'

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up python dependences
Expand Down Expand Up @@ -48,9 +48,9 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
- 'windows-2019'
- 'macos-10.15'
- 'macos-12'
python:
- '3.7'
- '3.8'
Expand All @@ -63,30 +63,30 @@ jobs:
- x86
- AMD64
exclude:
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: arm64
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: x86
- os: ubuntu-18.04
- os: ubuntu-20.04
architecture: AMD64
- os: windows-2019
architecture: x86_64
- os: windows-2019
architecture: arm64
- os: windows-2019
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: aarch64
- os: macos-10.15
- os: macos-12
architecture: x86
- os: macos-10.15
- os: macos-12
architecture: AMD64
- python: '3.7'
architecture: arm64

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
python-version:
- '3.7'
- '3.8'
Expand All @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20
- name: Set up system dependences on linux
Expand All @@ -33,7 +33,7 @@ jobs:
sudo apt-get install -y libxml2-dev libxslt-dev python-dev # need by pypy3
dot -V
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ jobs:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
- 'ubuntu-20.04'
- 'windows-2019' # need to be fixed, see: https://github.com/opendilab/treevalue/issues/41
- 'macos-10.15'
- 'macos-12'
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
exclude:
- os: 'windows-2019'
python-version: '3.11'
- os: 'macos-12'
python-version: '3.11'

steps:
- name: Get system version for Linux
Expand Down Expand Up @@ -59,7 +65,7 @@ jobs:
run: |
echo "IS_PYPY=1" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 20
- name: Set up system dependences on linux
Expand All @@ -82,7 +88,7 @@ jobs:
brew install tree cloc wget curl make zip graphviz
dot -V
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -110,7 +116,7 @@ jobs:
run: |
make clean build unittest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.PHONY: docs test unittest build clean benchmark zip

PYTHON := $(shell which python)
NO_DEBUG ?=
NO_DOCSTRING ?=
NO_DEBUG_CMD := $(if ${NO_DOCSTRING},-OO,$(if ${NO_DEBUG},-O,))
PYTHON := $(shell which python) ${NO_DEBUG_CMD}

DOC_DIR := ./docs
DIST_DIR := ./dist
Expand Down Expand Up @@ -39,29 +42,30 @@ clean:
rm -rf $(shell find ${SRC_DIR} -name '*.so') \
$(shell ls $(addsuffix .c, $(basename ${CYTHON_FILES})) \
$(addsuffix .cpp, $(basename ${CYTHON_FILES})) \
$(addsuffix .h, $(basename ${CYTHON_FILES})) \
2> /dev/null)
rm -rf ${DIST_DIR} ${WHEELHOUSE_DIR}

test: unittest benchmark

unittest:
pytest "${RANGE_TEST_DIR}" \
$(PYTHON) -m pytest "${RANGE_TEST_DIR}" \
-sv -m unittest \
$(shell for type in ${COV_TYPES}; do echo "--cov-report=$$type"; done) \
--cov="${RANGE_SRC_DIR}" \
$(if ${MIN_COVERAGE},--cov-fail-under=${MIN_COVERAGE},) \
$(if ${WORKERS},-n ${WORKERS},)

benchmark:
pytest "${RANGE_TEST_DIR}" \
$(PYTHON) -m pytest "${RANGE_TEST_DIR}" \
-sv -m benchmark \
--benchmark-columns=min,max,mean,median,IQR,ops,rounds,iterations \
--benchmark-disable-gc \
--benchmark-sort=mean \
$(if ${WORKERS},-n ${WORKERS},)

compare:
pytest "${RANGE_BENCH_DIR}" \
$(PYTHON) -m pytest "${RANGE_BENCH_DIR}" \
-sv -m benchmark \
--benchmark-columns=min,max,mean,median,IQR,ops,rounds,iterations \
--benchmark-disable-gc \
Expand Down
Loading

0 comments on commit df273ba

Please sign in to comment.