diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a0f44b3..bf2698e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,26 +8,25 @@ on: - main release: types: - - published + - published jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Build wheel and SDist - run: pipx run build + - name: Build wheel and SDist + run: pipx run build - - uses: actions/upload-artifact@v3 - with: - path: dist/* - - - name: Check metadata - run: pipx run twine check dist/* + - uses: actions/upload-artifact@v3 + with: + path: dist/* + - name: Check metadata + run: pipx run twine check dist/* publish: needs: [dist] @@ -35,11 +34,11 @@ jobs: if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.5.1 - with: - password: ${{ secrets.pypi_password }} + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@v1.5.1 + with: + password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d955660..51bf388 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,20 +5,19 @@ on: push: branches: [master] - jobs: pre-commit: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - name: Check manifest - uses: pre-commit/action@v3.0.0 - with: - extra_args: --hook-stage manual + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Check manifest + uses: pre-commit/action@v3.0.0 + with: + extra_args: --hook-stage manual checks: runs-on: ubuntu-latest @@ -26,26 +25,26 @@ jobs: fail-fast: false matrix: python-version: - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - "3.11-dev" + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11-dev" name: Check Python ${{ matrix.python-version }} steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-python@v4 - with: - python-version: "3.x" + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" - - name: Install package - run: python -m pip install -e .[test] + - name: Install package + run: python -m pip install -e .[test] - - name: Test package - run: python -m pytest --doctest-modules --cov=src/hepunits --cov-report=xml + - name: Test package + run: python -m pytest --doctest-modules --cov=src/hepunits --cov-report=xml - - name: Test coverage with Codecov - uses: codecov/codecov-action@v3 + - name: Test coverage with Codecov + uses: codecov/codecov-action@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f507def..4a004bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,62 +3,75 @@ ci: autofix_commit_msg: "style: pre-commit fixes" repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 - hooks: - - id: debug-statements - - id: end-of-file-fixer - - id: mixed-line-ending - - id: requirements-txt-fixer - - id: trailing-whitespace - - id: check-added-large-files - - id: check-case-conflict - - id: check-merge-conflict - - id: check-symlinks - - id: check-yaml + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml -- repo: https://github.com/asottile/pyupgrade - rev: v3.1.0 - hooks: - - id: pyupgrade - args: [--py37-plus] + - repo: https://github.com/asottile/pyupgrade + rev: v3.1.0 + hooks: + - id: pyupgrade + args: [--py37-plus] -- repo: https://github.com/psf/black - rev: 22.10.0 - hooks: - - id: black-jupyter + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black-jupyter -- repo: https://github.com/pycqa/flake8 - rev: 5.0.4 - hooks: - - id: flake8 - additional_dependencies: [flake8-bugbear, flake8-print] + - repo: https://github.com/pycqa/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + additional_dependencies: [flake8-bugbear, flake8-print] -- repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 - hooks: - - id: mypy - files: src - args: [] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.982 + hooks: + - id: mypy + files: src + args: [] -- repo: https://github.com/PyCQA/isort - rev: 5.10.1 - hooks: - - id: isort + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort -- repo: https://github.com/codespell-project/codespell - rev: v2.2.2 - hooks: - - id: codespell + - repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell -- repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 - hooks: - - id: python-check-blanket-noqa - - id: python-check-blanket-type-ignore - - id: python-no-log-warn - - id: python-no-eval - - id: python-use-type-annotations - - id: rst-backticks - - id: rst-directive-colons - - id: rst-inline-touching-normal + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.0-alpha.2" + hooks: + - id: prettier + types_or: [yaml, markdown, html, css, scss, javascript, json] + + - repo: https://github.com/asottile/blacken-docs + rev: v1.12.1 + hooks: + - id: blacken-docs + args: ["-E"] + additional_dependencies: [black==22.8.0] + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.9.0 + hooks: + - id: python-check-blanket-noqa + - id: python-check-blanket-type-ignore + - id: python-no-log-warn + - id: python-no-eval + - id: python-use-type-annotations + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal