Skip to content

Commit 885bd32

Browse files
committed
first commit
0 parents  commit 885bd32

30 files changed

+828
-0
lines changed

.circleci/config.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: 2
2+
3+
jobs:
4+
flake8:
5+
docker:
6+
- image: circleci/python:3.8
7+
steps:
8+
- checkout
9+
- run: pip install flake8
10+
- run: flake8 wagtail_xmlimport
11+
12+
prettier:
13+
docker:
14+
- image: circleci/node:14
15+
steps:
16+
- checkout:
17+
18+
- type: cache-restore
19+
keys:
20+
- node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
21+
- node-modules-{{ .Branch }}-
22+
- node-modules-master-
23+
24+
- run: npm install
25+
- run: npm run lint
26+
27+
- type: cache-save
28+
key: node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
29+
paths:
30+
- "node_modules"
31+
32+
test:
33+
docker:
34+
- image: circleci/python:3.8
35+
steps:
36+
- checkout
37+
38+
- type: cache-restore
39+
keys:
40+
- pip-{{ .Branch }}-
41+
- pip-master-
42+
43+
- run: pip install -e .[testing]
44+
45+
- type: cache-save
46+
key: pip-{{ .Branch }}-{{ epoch }}
47+
paths:
48+
- "~/.cache/pip"
49+
50+
- run: python testmanage.py test
51+
52+
nightly-wagtail-test:
53+
docker:
54+
- image: circleci/python:3.8
55+
steps:
56+
- checkout
57+
- run: git clone [email protected]:wagtail/wagtail.git
58+
59+
- run: pip install -e .[testing]
60+
- run: pip install ./wagtail
61+
62+
- run: python testmanage.py test
63+
64+
- run:
65+
when: on_fail
66+
command: python ./.circleci/report_nightly_build_failure.py
67+
68+
workflows:
69+
version: 2
70+
test:
71+
jobs:
72+
- flake8
73+
- prettier
74+
- test
75+
76+
nightly:
77+
jobs:
78+
- nightly-wagtail-test
79+
triggers:
80+
- schedule:
81+
cron: "0 0 * * *"
82+
filters:
83+
branches:
84+
only:
85+
- master
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Called by CircleCI when the nightly build fails.
3+
4+
This reports an error to the #nightly-build-failures Slack channel.
5+
"""
6+
import os
7+
import requests
8+
9+
if 'SLACK_WEBHOOK_URL' in os.environ:
10+
print("Reporting to #nightly-build-failures slack channel")
11+
response = requests.post(os.environ['SLACK_WEBHOOK_URL'], json={
12+
"text": "A Nightly build failed. See " + os.environ['CIRCLE_BUILD_URL'],
13+
})
14+
15+
print("Slack responded with:", response)
16+
17+
else:
18+
print("Unable to report to #nightly-build-failures slack channel because SLACK_WEBHOOK_URL is not set")

.circleci/trigger-nightly-build.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# Triggers a test run against the master version of Wagtail
3+
4+
# This job will is scheduled in the config.yml, this script is here to help test the job
5+
6+
curl -u ${CIRCLE_API_USER_TOKEN}: \
7+
-d build_parameters[CIRCLE_JOB]=nightly-wagtail-test \
8+
https://circleci.com/api/v1.1/project/github/wagtail/wagtail-xmlimport/tree/master

.coveragerc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[run]
2+
branch = True
3+
include = wagtail_xmlimport/*
4+
omit = */migrations/*,*/tests/*
5+
6+
[report]
7+
# Regexes for lines to exclude from consideration
8+
exclude_lines =
9+
# Have to re-enable the standard pragma
10+
pragma: no cover
11+
12+
# Don't complain about missing debug-only code:
13+
def __repr__
14+
if self\.debug
15+
16+
# Don't complain if tests don't hit defensive assertion code:
17+
raise AssertionError
18+
raise NotImplementedError
19+
20+
# Don't complain if non-runnable code isn't run:
21+
if 0:
22+
if __name__ == .__main__.:
23+
24+
ignore_errors = True

.eslintrc.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: [
4+
'torchbox',
5+
'plugin:@typescript-eslint/recommended',
6+
],
7+
parserOptions: {
8+
ecmaVersion: 2018,
9+
sourceType: 'module',
10+
},
11+
rules: {
12+
'@typescript-eslint/explicit-member-accessibility': 'off',
13+
'@typescript-eslint/explicit-function-return-type': 'off',
14+
'@typescript-eslint/no-explicit-any': 'off',
15+
'react/jsx-filename-extension': [1, { 'extensions': ['.jsx', '.tsx'] }],
16+
},
17+
settings: {
18+
'import/resolver': {
19+
'node': {
20+
'extensions': ['.js', '.jsx', '.ts', '.tsx']
21+
}
22+
}
23+
},
24+
};

.github/workflows/test.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: xmlimport CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- 'stable/**'
9+
10+
pull_request:
11+
12+
jobs:
13+
test-sqlite:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python: ['3.7', '3.8']
18+
django: ['2.2', '3.0', '3.1']
19+
wagtail: ['2.11']
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python ${{ matrix.python }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python }}
27+
- name: Install Tox
28+
run: |
29+
python -m pip install tox
30+
- name: Test
31+
run: |
32+
tox
33+
env:
34+
TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-sqlite
35+
36+
test-postgres:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
python: ['3.7', '3.8']
41+
django: ['2.2', '3.0', '3.1']
42+
wagtail: ['2.11']
43+
postgres: ['10.8']
44+
45+
services:
46+
postgres:
47+
image: postgres:${{ matrix.postgres }}
48+
ports:
49+
- 5432:5432
50+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
51+
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Set up Python ${{ matrix.python }}
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: ${{ matrix.python }}
58+
- name: Install Tox
59+
run: |
60+
python -m pip install tox
61+
- name: Test
62+
run: |
63+
tox
64+
env:
65+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/wagtail_xmlimport
66+
TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-postgres

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.pyc
2+
/build
3+
/dist
4+
/wagtail_xmlimport.egg-info
5+
/.coverage
6+
/htmlcov
7+
/.tox
8+
/venv
9+
/.vscode
10+
/site
11+
/test_wagtail_xmlimport.db
12+
/node_modules
13+
/test-static
14+
/test-media

.prettierrc.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tabWidth = 4
2+
singleQuote = true

LICENSE

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
MIT License
3+
4+
Copyright (c) 2021, Nick Moreton
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include LICENSE *.rst *.txt *.md
2+
graft wagtail_xmlimport
3+
global-exclude __pycache__
4+
global-exclude *.py[co]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Wagtail xmlimport

package.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "wagtail-xmlimport",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "wagtail_xmlimport/static_src/main.tsx",
6+
"scripts": {
7+
"build": "webpack --mode=production",
8+
"start": "webpack --mode=development --watch",
9+
"format": "prettier --write wagtail_xmlimport/**/*.{ts,tsx,scss}",
10+
"lint": "prettier --check wagtail_xmlimport/**/*.{ts,tsx,scss}"
11+
},
12+
"author": "",
13+
"license": "ISC",
14+
"devDependencies": {
15+
"@svgr/webpack": "^5.4.0",
16+
"@types/react": "^16.8.19",
17+
"@types/react-dom": "^16.8.19",
18+
"@types/styled-components": "^5.1.2",
19+
"@typescript-eslint/eslint-plugin": "^1.12.0",
20+
"@typescript-eslint/parser": "^1.12.0",
21+
"css-loader": "^2.1.1",
22+
"eslint": "^5.16.0",
23+
"eslint-config-airbnb": "^17.1.1",
24+
"eslint-config-prettier": "^6.0.0",
25+
"eslint-config-torchbox": "^0.2.0",
26+
"eslint-plugin-import": "^2.18.0",
27+
"eslint-plugin-jsx-a11y": "^6.2.3",
28+
"eslint-plugin-react": "^7.14.2",
29+
"file-loader": "^3.0.1",
30+
"node-sass": "^4.13.1",
31+
"prettier": "1.18.2",
32+
"sass": "^1.20.3",
33+
"sass-loader": "^7.1.0",
34+
"style-loader": "^0.23.1",
35+
"ts-loader": "^6.0.2",
36+
"typescript": "^3.5.1",
37+
"webpack": "^4.32.2",
38+
"webpack-cli": "^3.3.2"
39+
},
40+
"dependencies": {
41+
"react": "^16.13.1",
42+
"react-dom": "^16.13.1",
43+
"styled-components": "^5.1.1"
44+
}
45+
}

setup.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python
2+
3+
from os import path
4+
5+
from setuptools import find_packages, setup
6+
7+
from wagtail_xmlimport import __version__
8+
9+
10+
this_directory = path.abspath(path.dirname(__file__))
11+
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
12+
long_description = f.read()
13+
14+
setup(
15+
name="wagtail-xmlimport",
16+
version=__version__,
17+
description="Import XML data into wagtail to create pages and content",
18+
long_description=long_description,
19+
long_description_content_type='text/markdown',
20+
author="Nick Moreton",
21+
author_email="[email protected]",
22+
url="",
23+
packages=find_packages(),
24+
include_package_data=True,
25+
license="BSD",
26+
classifiers=[
27+
"Development Status :: 3 - Alpha",
28+
"Intended Audience :: Developers",
29+
"License :: OSI Approved :: BSD License",
30+
"Operating System :: OS Independent",
31+
"Programming Language :: Python",
32+
"Programming Language :: Python :: 3",
33+
"Programming Language :: Python :: 3.7",
34+
"Programming Language :: Python :: 3.8",
35+
"Framework :: Django",
36+
"Framework :: Django :: 2.2",
37+
"Framework :: Django :: 3.0",
38+
"Framework :: Django :: 3.1",
39+
"Framework :: Wagtail",
40+
"Framework :: Wagtail :: 2",
41+
],
42+
install_requires=["Django>=2.2,<3.2", "Wagtail>=2.11,<2.12"],
43+
extras_require={
44+
"testing": ["dj-database-url==0.5.0", "freezegun==0.3.15"],
45+
},
46+
zip_safe=False,
47+
)

0 commit comments

Comments
 (0)