Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolab committed Sep 21, 2022
1 parent 0dd9f60 commit 86a4554
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 235 deletions.
160 changes: 80 additions & 80 deletions wagtail-{{ cookiecutter.project_name_kebab }}/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
version: 2

jobs:
flake8:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run: pip install flake8
- run: flake8 wagtail_{{ cookiecutter.project_name_snake }}

prettier:
docker:
- image: circleci/node:{{ cookiecutter.node_version }}
steps:
- checkout:

- type: cache-restore
keys:
- node-modules-{% raw %}{{ .Branch }}-{{ checksum "package-lock.json" }}{% endraw %}
- node-modules-{% raw %}{{ .Branch }}-{% endraw %}
- node-modules-main-

- run: npm install
- run: npm run lint

- type: cache-save
key: node-modules-{% raw %}{{ .Branch }}-{{ checksum "package-lock.json" }}{% endraw %}
paths:
- "node_modules"

test:
docker:
- image: circleci/python:3.8
steps:
- checkout

- type: cache-restore
keys:
- pip-{% raw %}{{ .Branch }}-{% endraw %}
- pip-main-

- run: pip install -e .[testing]

- type: cache-save
key: pip-{% raw %}{{ .Branch }}-{{ epoch }}{% endraw %}
paths:
- "~/.cache/pip"

- run: python testmanage.py test

nightly-wagtail-test:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run: git clone [email protected]:wagtail/wagtail.git

- run: pip install -e .[testing]
- run: pip install ./wagtail

- run: python testmanage.py test

- run:
when: on_fail
command: python ./.circleci/report_nightly_build_failure.py
flake8:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run: pip install flake8
- run: flake8 wagtail_{{ cookiecutter.project_name_snake }}

prettier:
docker:
- image: circleci/node:{{ cookiecutter.node_version }}
steps:
- checkout:

- type: cache-restore
keys:
- node-modules-{% raw %}{{ .Branch }}-{{ checksum "package-lock.json" }}{% endraw %}
- node-modules-{% raw %}{{ .Branch }}-{% endraw %}
- node-modules-main-

- run: npm install
- run: npm run lint

- type: cache-save
key: node-modules-{% raw %}{{ .Branch }}-{{ checksum "package-lock.json" }}{% endraw %}
paths:
- 'node_modules'

test:
docker:
- image: circleci/python:3.8
steps:
- checkout

- type: cache-restore
keys:
- pip-{% raw %}{{ .Branch }}-{% endraw %}
- pip-main-

- run: pip install -e .[testing]

- type: cache-save
key: pip-{% raw %}{{ .Branch }}-{{ epoch }}{% endraw %}
paths:
- '~/.cache/pip'

- run: python testmanage.py test

nightly-wagtail-test:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run: git clone [email protected]:wagtail/wagtail.git

- run: pip install -e .[testing]
- run: pip install ./wagtail

- run: python testmanage.py test

- run:
when: on_fail
command: python ./.circleci/report_nightly_build_failure.py

workflows:
version: 2
test:
jobs:
- flake8
- prettier
- test

nightly:
jobs:
- nightly-wagtail-test
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- main
version: 2
test:
jobs:
- flake8
- prettier
- test

nightly:
jobs:
- nightly-wagtail-test
triggers:
- schedule:
cron: '0 0 * * *'
filters:
branches:
only:
- main
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
This reports an error to the #nightly-build-failures Slack channel.
"""
import os

import requests

if 'SLACK_WEBHOOK_URL' in os.environ:

if "SLACK_WEBHOOK_URL" in os.environ:
print("Reporting to #nightly-build-failures slack channel")
response = requests.post(os.environ['SLACK_WEBHOOK_URL'], json={
"text": "A Nightly build failed. See " + os.environ['CIRCLE_BUILD_URL'],
})
response = requests.post(
os.environ["SLACK_WEBHOOK_URL"],
json={
"text": "A Nightly build failed. See " + os.environ["CIRCLE_BUILD_URL"],
},
)

print("Slack responded with:", response)

else:
print("Unable to report to #nightly-build-failures slack channel because SLACK_WEBHOOK_URL is not set")
print(
"Unable to report to #nightly-build-failures slack channel because SLACK_WEBHOOK_URL is not set"
)
2 changes: 1 addition & 1 deletion wagtail-{{ cookiecutter.project_name_kebab }}/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ cookiecutter.node_version }}
{{ cookiecutter.node_version }}
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
ci:
autofix_prs: false
autofix_prs: false

default_language_version:
python: python3
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
args: ['--unsafe']
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
language_version: python3
args: ['--target-version', 'py37']
- repo: https://github.com/pycqa/isort
# isort config is in setup.cfg
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
# flake8 config is in setup.cfg
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- repo: https://github.com/pre-commit/mirrors-prettier
# note: keep in sync with the version from package.json
rev: 'v1.18.2'
hooks:
- id: prettier
types_or: [css, scss, javascript, ts, tsx, json, yaml]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.8.0]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
args: ['--unsafe']
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
language_version: python3
args: ['--target-version', 'py37']
- repo: https://github.com/pycqa/isort
# isort config is in setup.cfg
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
# flake8 config is in setup.cfg
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- repo: https://github.com/pre-commit/mirrors-prettier
# note: keep in sync with the version from package.json
rev: 'v1.18.2'
hooks:
- id: prettier
types_or: [css, scss, javascript, ts, tsx, json, yaml]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.8.0]
2 changes: 1 addition & 1 deletion wagtail-{{ cookiecutter.project_name_kebab }}/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ...
-->
-->
2 changes: 1 addition & 1 deletion wagtail-{{ cookiecutter.project_name_kebab }}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ tox
or, you can run them for a specific environment `tox -e python3.8-django3.2-wagtail2.15` or specific test
`tox -e python3.9-django3.2-wagtail2.15-sqlite {{ cookiecutter.project_name_kebab }}.tests.test_file.TestClass.test_method`

To run the test app interactively, use `tox -e interactive`, visit `http://127.0.0.1:8020/admin/` and log in with `admin`/`changeme`.
To run the test app interactively, use `tox -e interactive`, visit `http://127.0.0.1:8020/admin/` and log in with `admin`/`changeme`.
86 changes: 43 additions & 43 deletions wagtail-{{ cookiecutter.project_name_kebab }}/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"name": "wagtail-{{ cookiecutter.project_name_kebab }}",
"version": "1.0.0",
"description": "",
"main": "wagtail_{{ cookiecutter.project_name_snake }}/static_src/main.tsx",
"scripts": {
"build": "webpack --mode=production",
"start": "webpack --mode=development --watch",
"format": "prettier --write wagtail_{{ cookiecutter.project_name_snake }}/**/*.{ts,tsx,scss}",
"lint": "prettier --check wagtail_{{ cookiecutter.project_name_snake }}/**/*.{ts,tsx,scss}"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@svgr/webpack": "^5.4.0",
"@types/react": "^16.8.19",
"@types/react-dom": "^16.8.19",
"@types/styled-components": "^5.1.2",
"@typescript-eslint/eslint-plugin": "^1.12.0",
"@typescript-eslint/parser": "^1.12.0",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-prettier": "^6.0.0",
"eslint-config-torchbox": "^0.2.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
"file-loader": "^3.0.1",
"node-sass": "^4.13.1",
"prettier": "1.18.2",
"sass": "^1.20.3",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"ts-loader": "^6.0.2",
"typescript": "^3.5.1",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.1.1"
}
"name": "wagtail-{{ cookiecutter.project_name_kebab }}",
"version": "1.0.0",
"description": "",
"main": "wagtail_{{ cookiecutter.project_name_snake }}/static_src/main.tsx",
"scripts": {
"build": "webpack --mode=production",
"start": "webpack --mode=development --watch",
"format": "prettier --write wagtail_{{ cookiecutter.project_name_snake }}/**/*.{ts,tsx,scss}",
"lint": "prettier --check wagtail_{{ cookiecutter.project_name_snake }}/**/*.{ts,tsx,scss}"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@svgr/webpack": "^5.4.0",
"@types/react": "^16.8.19",
"@types/react-dom": "^16.8.19",
"@types/styled-components": "^5.1.2",
"@typescript-eslint/eslint-plugin": "^1.12.0",
"@typescript-eslint/parser": "^1.12.0",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-prettier": "^6.0.0",
"eslint-config-torchbox": "^0.2.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
"file-loader": "^3.0.1",
"node-sass": "^4.13.1",
"prettier": "1.18.2",
"sass": "^1.20.3",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"ts-loader": "^6.0.2",
"typescript": "^3.5.1",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.1.1"
}
}
Loading

0 comments on commit 86a4554

Please sign in to comment.