-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump version, merge pull request #37 from AMYPAD/pybind11
- Loading branch information
Showing
36 changed files
with
1,222 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,42 +3,17 @@ on: | |
push: | ||
pull_request: | ||
schedule: [{cron: '30 23 * * 6'}] # M H d m w (Sat at 23:30) | ||
workflow_dispatch: | ||
jobs: | ||
check: | ||
clang-format: | ||
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
- name: set PYSHA | ||
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: dependencies | ||
run: | | ||
pip install -U pre-commit | ||
sudo apt-get install -yqq clang-format | ||
- uses: reviewdog/action-setup@v1 | ||
- if: github.event_name == 'push' || github.event_name == 'pull_request' | ||
name: comment | ||
run: | | ||
if [[ $EVENT == pull_request ]]; then | ||
REPORTER=github-pr-review | ||
else | ||
REPORTER=github-check | ||
fi | ||
pre-commit run -a todo | reviewdog -efm="%f:%l: %m" -name=TODO -tee -reporter=$REPORTER -filter-mode nofilter | ||
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter | ||
pre-commit run -a mypy | reviewdog -efm="%f:%l: %m" -name=mypy -tee -reporter=$REPORTER -filter-mode nofilter | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
EVENT: ${{ github.event_name }} | ||
- run: pre-commit run -a --show-diff-on-failure | ||
with: {python-version: '3.x'} | ||
- run: sudo apt-get install -yqq clang-format | ||
- uses: pre-commit/[email protected] | ||
with: {extra_args: --all-files clang-format} | ||
test: | ||
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) | ||
name: py${{ matrix.python }} | ||
|
@@ -48,31 +23,18 @@ jobs: | |
python: [3.7, 3.11] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
with: {fetch-depth: 0} | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: pip install -U -e .[dev] | ||
# in-place for pytest (-e . doesn't work yet for scikit-build-core) | ||
run: | | ||
pip install toml | ||
python -c 'import toml; c=toml.load("pyproject.toml") | ||
print("\0".join(c["build-system"]["requires"] + ["cmake>=" + c["tool"]["scikit-build"]["cmake"]["minimum-version"]]), end="")' \ | ||
| xargs -0 pip install ninja | ||
pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1 | ||
git restore cuvec/src | ||
python -c 'import toml; c=toml.load("pyproject.toml") | ||
print("\0".join(c["project"]["dependencies"] + c["project"]["optional-dependencies"]["dev"]), end="")' \ | ||
| xargs -0 pip install | ||
- run: pytest | ||
- uses: codecov/codecov-action@v3 | ||
run: make CXX_FLAGS='' deps-build build-editable deps-run | ||
- run: make test | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: compile -Wall | ||
run: | | ||
git clean -Xdf | ||
pip install build | ||
python -m build -n -w \ | ||
-Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" | ||
run: make clean build-wheel | ||
cuda: | ||
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) | ||
name: CUDA py${{ matrix.python }} | ||
|
@@ -82,57 +44,38 @@ jobs: | |
python: [3.7, 3.11] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
with: {fetch-depth: 0} | ||
- name: Run setup-python | ||
run: setup-python -p${{ matrix.python }} 'cuda-version<12' cupy | ||
run: setup-python -p${{ matrix.python }} 'cuda-version<12' 'cupy<13' | ||
- name: pip install -U -e .[dev] | ||
# in-place for pytest (-e . doesn't work yet for scikit-build-core) | ||
run: | | ||
pip install toml | ||
python -c 'import toml; c=toml.load("pyproject.toml") | ||
print("\0".join(c["build-system"]["requires"] + ["cmake>=" + c["tool"]["scikit-build"]["cmake"]["minimum-version"]]), end="")' \ | ||
| xargs -0 pip install ninja | ||
pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1 | ||
git restore cuvec/src | ||
python -c 'import toml; c=toml.load("pyproject.toml") | ||
print("\0".join(c["project"]["dependencies"] + c["project"]["optional-dependencies"]["dev"]), end="")' \ | ||
| xargs -0 pip install | ||
- run: pytest | ||
- uses: codecov/codecov-action@v3 | ||
run: make CXX_FLAGS='' deps-build build-editable deps-run | ||
- run: make test | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: compile -Wall | ||
run: | | ||
git clean -Xdf | ||
pip install build | ||
python -m build -n -w \ | ||
-Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" \ | ||
-Ccmake.define.CMAKE_CUDA_ARCHITECTURES=all | ||
run: make CUDA_ARCHITECTURES=all clean build-wheel | ||
- name: Post Run setup-python | ||
run: setup-python -p${{ matrix.python }} -Dr | ||
if: ${{ always() }} | ||
deploy: | ||
needs: [check, test, cuda] | ||
needs: [clang-format, test, cuda] | ||
name: PyPI Deploy | ||
environment: pypi | ||
permissions: | ||
contents: write | ||
id-token: write | ||
permissions: {contents: write, id-token: write} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GH_TOKEN || github.token }} | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
with: {python-version: '3.x'} | ||
- id: dist | ||
uses: casperdcl/deploy-pypi@v2 | ||
with: | ||
build: -s | ||
upload: false | ||
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | ||
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
name: Release | ||
run: | | ||
|
@@ -142,11 +85,7 @@ jobs: | |
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }} | ||
- name: Docs | ||
run: | | ||
pushd docs | ||
pip install -U -r requirements.txt | ||
PYTHONPATH=. pydoc-markdown --build --site-dir=../../../dist/site | ||
popd | ||
run: make deps-docs docs | ||
- if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' }} | ||
uses: casperdcl/push-dir@v1 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# NOTE: cannot `pip install -U -e .[dev]` (install in-place for pytest) | ||
# since `-e .` doesn't work yet (https://github.com/scikit-build/scikit-build-core/issues/114). | ||
# Instead, do `make deps-build build-editable deps-run` | ||
CUVEC_DEBUG=0 | ||
CXX_FLAGS=-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type | ||
CUDA_ARCHITECTURES=native | ||
BUILD_CMAKE_FLAGS=-Ccmake.define.CUVEC_DEBUG=$(CUVEC_DEBUG) -Ccmake.define.CMAKE_CXX_FLAGS="$(CXX_FLAGS)" -Ccmake.define.CMAKE_CUDA_ARCHITECTURES=$(CUDA_ARCHITECTURES) | ||
CCACHE= | ||
ifneq ($(CCACHE),) | ||
BUILD_CMAKE_FLAGS+= -Ccmake.define.CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
endif | ||
.PHONY: build-editable clean deps-build deps-run build-wheel deps-docs docs docs-serve | ||
build-editable: | ||
git diff --exit-code --quiet '*/src/**' || (echo "Uncommitted changes in */src"; exit 1) | ||
pip install --no-build-isolation --check-build-dependencies -Cbuild-dir=build --no-deps -t . -U -v . $(BUILD_CMAKE_FLAGS) | ||
git restore '*/src/**' | ||
test: | ||
pytest -k "not perf" -n=3 | ||
pytest -k "perf" -n=0 --cov-append | ||
clean: | ||
git clean -Xdf | ||
deps-build: | ||
pip install toml | ||
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"] + ["cmake>=" + c["tool"]["scikit-build"]["cmake"]["minimum-version"]]), end="")' | xargs -0 pip install ninja | ||
deps-run: | ||
pip install toml | ||
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["project"]["dependencies"] + c["project"]["optional-dependencies"]["dev"]), end="")' | xargs -0 pip install | ||
build-wheel: | ||
pip install build | ||
python -m build -n -w $(BUILD_CMAKE_FLAGS) | ||
deps-docs: | ||
cd docs && pip install -r requirements.txt | ||
docs: | ||
cd docs && PYTHONPATH=. pydoc-markdown --build --site-dir=../../../dist/site | ||
docs-serve: docs | ||
python -m http.server -d dist/site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.