-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from lucky9-cyou/ylin/pre-commit
feat: format code, add pre-commit and clang format
- Loading branch information
Showing
115 changed files
with
5,176 additions
and
4,621 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left |
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,16 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.10' | ||
- uses: pre-commit/[email protected] |
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
name: Unit test | ||
on: | ||
push: | ||
pull_request: | ||
branches: ['master'] | ||
push: | ||
pull_request: | ||
branches: [master] | ||
jobs: | ||
unnittest: | ||
name: Unit test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.10' | ||
unnittest: | ||
name: Unit test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependency | ||
run: python -m pip install -r requirements.txt && python -m pip install pytest | ||
- name: Install dependency | ||
run: python -m pip install -r requirements.txt && python -m pip install pytest | ||
|
||
# TODO(zhaoyilun): Build seperate package for pyquafu-torch | ||
- name: Install torch | ||
run: python -m pip install torch torchvision torchaudio | ||
- name: Install torch | ||
run: python -m pip install torch torchvision torchaudio | ||
|
||
- name: Install pyquafu | ||
run: python -m pip install . | ||
- name: Install pyquafu | ||
run: python -m pip install . | ||
|
||
- name: Run unit tests | ||
run: pytest tests/ | ||
- name: Run unit tests | ||
run: pytest tests/ |
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 |
---|---|---|
@@ -1,59 +1,59 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
- "v*" | ||
pull_request: | ||
pull_request_review: | ||
types: [submitted, edited] | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
pull_request_review: | ||
types: [submitted, edited] | ||
workflow_dispatch: | ||
|
||
|
||
|
||
jobs: | ||
build_wheels: | ||
name: Build python wheels | ||
strategy: | ||
matrix: | ||
os-arch: ["manylinux_x86_64", "win_amd64", "macosx_x86_64", "macosx_arm64"] | ||
python-version: ["3.10"] | ||
cibw-python: ["cp38", "cp39", "cp310","cp311"] | ||
include: | ||
- os-arch: "manylinux_x86_64" | ||
os: "ubuntu-20.04" | ||
- os-arch: "win_amd64" | ||
os: "windows-2019" | ||
- os-arch: "macosx_x86_64" | ||
os: "macos-11" | ||
- os-arch: "macosx_arm64" | ||
os: "macos-11" | ||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
CIBW_BUILD: ${{ matrix.cibw-python }}-${{ matrix.os-arch }} | ||
PYTHON: ${{ matrix.python-version }} | ||
TWINE_USERNAME: "__token__" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
build_wheels: | ||
name: Build python wheels | ||
strategy: | ||
matrix: | ||
os-arch: [manylinux_x86_64, win_amd64, macosx_x86_64, macosx_arm64] | ||
python-version: ['3.10'] | ||
cibw-python: [cp38, cp39, cp310, cp311] | ||
include: | ||
- os-arch: manylinux_x86_64 | ||
os: ubuntu-20.04 | ||
- os-arch: win_amd64 | ||
os: windows-2019 | ||
- os-arch: macosx_x86_64 | ||
os: macos-11 | ||
- os-arch: macosx_arm64 | ||
os: macos-11 | ||
runs-on: ${{ matrix.os }} | ||
|
||
# Used to host cibuildwheel | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependence | ||
run: python -m pip install pybind11 cibuildwheel scikit-build twine pytest | ||
|
||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir dist | ||
|
||
- name: Publish package | ||
run: python -m twine upload dist/*.whl | ||
if: ${{ contains(github.ref, '/tags/') }} | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
CIBW_BUILD: ${{ matrix.cibw-python }}-${{ matrix.os-arch }} | ||
PYTHON: ${{ matrix.python-version }} | ||
TWINE_USERNAME: __token__ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Used to host cibuildwheel | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependence | ||
run: python -m pip install pybind11 cibuildwheel scikit-build twine pytest | ||
|
||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir dist | ||
|
||
- name: Publish package | ||
run: python -m twine upload dist/*.whl | ||
if: ${{ contains(github.ref, '/tags/') }} | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
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,53 @@ | ||
repos: | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks.git | ||
rev: v1.5.4 | ||
hooks: | ||
- id: remove-crlf | ||
files: (?!.*third_party)^.*$ | (?!.*book)^.*$ | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: | ||
- --maxkb=20480 | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: detect-private-key | ||
files: (?!.*third_party)^.*$ | (?!.*book)^.*$ | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: requirements-txt-fixer | ||
- id: sort-simple-yaml | ||
- repo: https://github.com/pylint-dev/pylint | ||
rev: v3.0.0a6 | ||
hooks: | ||
- id: pylint | ||
args: | ||
- --disable=all | ||
- --load-plugins=docstring_checker | ||
- --enable=doc-string-one-line,doc-string-end-with,doc-string-with-all-args,doc-string-triple-quotes,doc-string-missing,doc-string-indent-error,doc-string-with-returns,doc-string-with-raises | ||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks.git | ||
rev: v2.10.0 | ||
hooks: | ||
- id: pretty-format-yaml | ||
args: [--autofix, --indent, '4'] | ||
- repo: https://github.com/hadialqattan/pycln | ||
rev: v2.2.2 | ||
hooks: | ||
- id: pycln | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v15.0.7 | ||
hooks: | ||
- id: clang-format | ||
args: [-style=file] | ||
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster | ||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 23.12.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
args: [--profile, black, --filter-files] |
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.