From 53ad5da1120d4fbb9a8a600666f6d9fcc1580a6e Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 13 Jan 2022 14:01:08 +0200 Subject: [PATCH] Alternative yamlfmt settings --- .github/dependabot.yml | 22 ++-- .github/workflows/main.yml | 238 ++++++++++++++++++------------------- .pre-commit-config.yaml | 127 ++++++++++---------- 3 files changed, 194 insertions(+), 193 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c99eadff..9179b31d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,14 @@ --- version: 2 updates: - - package-ecosystem: pip - directory: / - schedule: - interval: daily - open-pull-requests-limit: 10 - target-branch: master - - package-ecosystem: github-actions - directory: / - schedule: - interval: daily - open-pull-requests-limit: 10 +- package-ecosystem: pip + directory: / + schedule: + interval: daily + open-pull-requests-limit: 10 + target-branch: master +- package-ecosystem: github-actions + directory: / + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a0c9031..901ec10e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,131 +2,131 @@ name: CI on: - push: - branches: [master] - tags: [v*] - pull_request: - branches: [master] - workflow_dispatch: + push: + branches: [master] + tags: [v*] + pull_request: + branches: [master] + workflow_dispatch: jobs: - lint: - name: Run linters - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - prerelease: ${{ steps.version.outputs.prerelease }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install GitHub matcher for ActionLint checker - run: | - echo "::add-matcher::.github/actionlint-matcher.json" - - name: Install check-wheel-content, and twine - run: python -m pip install build check-wheel-contents tox twine - - name: Build package - run: python -m build - - name: Run tox for linter - run: python -m tox -e lint - - name: List result - run: ls -l dist - - name: Check wheel contents - run: check-wheel-contents dist/*.whl - - name: Check long_description - run: python -m twine check dist/* - - name: Get version info - id: version - run: tox -e version-info - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist + lint: + name: Run linters + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + prerelease: ${{ steps.version.outputs.prerelease }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install GitHub matcher for ActionLint checker + run: | + echo "::add-matcher::.github/actionlint-matcher.json" + - name: Install check-wheel-content, and twine + run: python -m pip install build check-wheel-contents tox twine + - name: Build package + run: python -m build + - name: Run tox for linter + run: python -m tox -e lint + - name: List result + run: ls -l dist + - name: Check wheel contents + run: check-wheel-contents dist/*.whl + - name: Check long_description + run: python -m twine check dist/* + - name: Get version info + id: version + run: tox -e version-info + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist - test: - name: Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - env: - USING_COVERAGE: 3.7,3.8,3.9,3.10 + test: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + env: + USING_COVERAGE: 3.7,3.8,3.9,3.10 - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + strategy: + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10'] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - set -xe - python -VV - python -m site - python -m pip install --upgrade pip - python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions - - name: Run tox targets for ${{ matrix.python-version }} - run: python -m tox + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + set -xe + python -VV + python -m site + python -m pip install --upgrade pip + python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions + - name: Run tox targets for ${{ matrix.python-version }} + run: python -m tox - - name: Prepare coverage artifact - if: ${{ contains(env.USING_COVERAGE, matrix.python-version) }} - uses: aio-libs/prepare-coverage@v21.9.1 + - name: Prepare coverage artifact + if: ${{ contains(env.USING_COVERAGE, matrix.python-version) }} + uses: aio-libs/prepare-coverage@v21.9.1 - check: - name: Check - if: always() - needs: [lint, test] - runs-on: ubuntu-latest - steps: - - name: Decide whether the needed jobs succeeded or failed - uses: re-actors/alls-green@release/v1 - with: - jobs: ${{ toJSON(needs) }} - - name: Upload coverage - uses: aio-libs/upload-coverage@v21.9.4 + check: + name: Check + if: always() + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + - name: Upload coverage + uses: aio-libs/upload-coverage@v21.9.4 - deploy: - name: Deploy - environment: release + deploy: + name: Deploy + environment: release # Run only on pushing a tag - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - needs: [lint, check] - runs-on: ubuntu-latest - steps: - - name: Install pandoc - run: | - sudo apt-get install -y pandoc - - name: Checkout - uses: actions/checkout@v2.4.0 - with: - fetch-depth: 0 - - name: Download distributions - uses: actions/download-artifact@v2 - with: - name: dist - path: dist - - name: Collected dists - run: | - tree dist - - name: Convert README.rst to Markdown - run: | - pandoc -s -o README.md README.rst - - name: PyPI upload - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - packages_dir: dist - password: ${{ secrets.PYPI_API_TOKEN }} - - name: GitHub Release - uses: ncipollo/release-action@v1 - with: - name: pytest-asyncio ${{ needs.lint.outputs.version }} - artifacts: dist/* - bodyFile: README.md - prerelease: ${{ needs.lint.outputs.prerelease }} - token: ${{ secrets.GITHUB_TOKEN }} + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + needs: [lint, check] + runs-on: ubuntu-latest + steps: + - name: Install pandoc + run: | + sudo apt-get install -y pandoc + - name: Checkout + uses: actions/checkout@v2.4.0 + with: + fetch-depth: 0 + - name: Download distributions + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - name: Collected dists + run: | + tree dist + - name: Convert README.rst to Markdown + run: | + pandoc -s -o README.md README.rst + - name: PyPI upload + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + packages_dir: dist + password: ${{ secrets.PYPI_API_TOKEN }} + - name: GitHub Release + uses: ncipollo/release-action@v1 + with: + name: pytest-asyncio ${{ needs.lint.outputs.version }} + artifacts: dist/* + bodyFile: README.md + prerelease: ${{ needs.lint.outputs.prerelease }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a085f108..bf5f9e2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,66 +1,67 @@ --- repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 - hooks: - - id: check-merge-conflict - exclude: rst$ - - repo: https://github.com/asottile/yesqa - rev: v1.3.0 - hooks: - - id: yesqa - - repo: https://github.com/Zac-HD/shed - rev: 0.6.0 # 0.7 does not support Python 3.7 - hooks: - - id: shed - args: - - --refactor - - --py37-plus - types_or: - - python - - markdown - - rst - - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt - rev: 0.1.0 - hooks: - - id: yamlfmt - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: fix-encoding-pragma - args: [--remove] - - id: check-case-conflict - - id: check-json - - id: check-xml - - id: check-yaml - - id: debug-statements - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - language_version: python3 - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 - hooks: - - id: python-use-type-annotations - - repo: https://github.com/rhysd/actionlint - rev: v1.6.8 - hooks: - - id: actionlint-docker - args: - - -ignore - - 'SC2155:' - - -ignore - - 'SC2086:' - - -ignore - - 'SC1004:' - - repo: https://github.com/sirosen/check-jsonschema - rev: 0.9.1 - hooks: - - id: check-github-actions +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-merge-conflict + exclude: rst$ +- repo: https://github.com/asottile/yesqa + rev: v1.3.0 + hooks: + - id: yesqa +- repo: https://github.com/Zac-HD/shed + rev: 0.6.0 # 0.7 does not support Python 3.7 + hooks: + - id: shed + args: + - --refactor + - --py37-plus + types_or: + - python + - markdown + - rst +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.1.0 + hooks: + - id: yamlfmt + args: [--mapping, '2', --sequence, '2', --offset, '0'] +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-encoding-pragma + args: [--remove] + - id: check-case-conflict + - id: check-json + - id: check-xml + - id: check-yaml + - id: debug-statements +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + language_version: python3 +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.9.0 + hooks: + - id: python-use-type-annotations +- repo: https://github.com/rhysd/actionlint + rev: v1.6.8 + hooks: + - id: actionlint-docker + args: + - -ignore + - 'SC2155:' + - -ignore + - 'SC2086:' + - -ignore + - 'SC1004:' +- repo: https://github.com/sirosen/check-jsonschema + rev: 0.9.1 + hooks: + - id: check-github-actions ci: - skip: - - actionlint-docker - - check-github-actions + skip: + - actionlint-docker + - check-github-actions