diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aff7e7a..5fe2f8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,37 +1,49 @@ --- name: build -on: [ - push, - pull_request -] +on: + push: + pull_request: + repository_dispatch: + types: [apb] + +env: + PIP_CACHE_DIR: ~/.cache/pip + PRE_COMMIT_CACHE_DIR: ~/.cache/pre-commit jobs: - build: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: python-version: 3.8 + - name: Store installed Python version + run: | + echo "::set-env name=PY_VERSION::"\ + "$(python -c "import platform;print(platform.python_version())")" - name: Cache pip test requirements uses: actions/cache@v1 with: - path: ~/.cache/pip - key: "${{ runner.os }}-pip-test-\ + path: ${{ env.PIP_CACHE_DIR }} + key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/requirements-test.txt') }}" restore-keys: | + ${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}- ${{ runner.os }}-pip-test- ${{ runner.os }}-pip- - name: Cache pre-commit hooks uses: actions/cache@v1 with: - path: ~/.cache/pre-commit - key: "${{ runner.os }}-pre-commit-\ + path: ${{ env.PRE_COMMIT_CACHE_DIR }} + key: "${{ runner.os }}-pre-commit-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/.pre-commit-config.yaml') }}" - name: Install dependencies run: | python -m pip install --upgrade pip pip install --upgrade --requirement requirements-test.txt + - name: Set up pre-commit hook environments + run: pre-commit install-hooks - name: Run pre-commit on all files run: pre-commit run --all-files diff --git a/.gitignore b/.gitignore index 3cec028..bedb6e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -*.egg-info __pycache__ -.python-version .coverage .mypy_cache .pytest_cache +.python-version +*.egg-info diff --git a/.mdl_config.json b/.mdl_config.json index 492955a..7a6f3f8 100644 --- a/.mdl_config.json +++ b/.mdl_config.json @@ -3,5 +3,8 @@ "code_blocks": false, "tables": false }, + "MD024": { + "allow_different_nesting": true + }, "default": true } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 793b329..daf3dac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: args: - --config=.mdl_config.json - repo: https://github.com/adrienverge/yamllint - rev: v1.20.0 + rev: v1.21.0 hooks: - id: yamllint - repo: https://github.com/detailyang/pre-commit-shell @@ -47,7 +47,7 @@ repos: additional_dependencies: - flake8-docstrings - repo: https://github.com/asottile/pyupgrade - rev: v2.0.0 + rev: v2.1.0 hooks: - id: pyupgrade - repo: https://github.com/PyCQA/bandit @@ -60,12 +60,12 @@ repos: rev: 19.10b0 hooks: - id: black - # Disabling seed-isort-config since it doesn't identifying docopt, et al. - # as third-party libraries. - #- repo: https://github.com/asottile/seed-isort-config - # rev: v1.9.4 - # hooks: - # - id: seed-isort-config + # Disabling seed-isort-config in this project (development-guide) since it + # doesn't identify docopt, et al. as third-party libraries. + # - repo: https://github.com/asottile/seed-isort-config + # rev: v2.1.0 + # hooks: + # - id: seed-isort-config - repo: https://github.com/pre-commit/mirrors-isort # pick the isort version you'd like to use from # https://github.com/pre-commit/mirrors-isort/releases @@ -78,19 +78,19 @@ repos: - id: ansible-lint # files: molecule/default/playbook.yml - repo: https://github.com/antonbabenko/pre-commit-terraform.git - rev: v1.12.0 + rev: v1.29.0 hooks: - id: terraform_fmt - - id: terraform_validate_no_variables + - id: terraform_validate - repo: https://github.com/IamTheFij/docker-pre-commit rev: v1.0.1 hooks: - id: docker-compose-check - repo: https://github.com/prettier/prettier - rev: 1.19.1 + rev: 2.0.4 hooks: - id: prettier - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.761 + rev: v0.770 hooks: - id: mypy