Skip to content

Commit

Permalink
Setup GitHub Workflows linter and yaml-reformatter (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 12, 2022
1 parent d28b826 commit 2eb12a7
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 109 deletions.
23 changes: 12 additions & 11 deletions .github/dependabot.yml
@@ -1,13 +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
120 changes: 60 additions & 60 deletions .github/workflows/main.yml
Expand Up @@ -2,72 +2,72 @@
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:

jobs:
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"
- 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
- 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: [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: [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

package:
name: "Build & verify package"
runs-on: "ubuntu-latest"
package:
name: Build & verify package
runs-on: ubuntu-latest

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "3.9"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: "Install poetry, check-wheel-content, and twine"
run: "python -m pip install build check-wheel-contents twine"
- name: "Build package"
run: "python -m build"
- 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: Install poetry, check-wheel-content, and twine
run: python -m pip install build check-wheel-contents twine
- name: Build package
run: python -m build
- 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/*
103 changes: 65 additions & 38 deletions .pre-commit-config.yaml
@@ -1,39 +1,66 @@
---
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/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-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/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
ci:
skip:
- actionlint-docker
- check-github-actions

0 comments on commit 2eb12a7

Please sign in to comment.