Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kaedroho committed Nov 3, 2020
0 parents commit 167dbd9
Show file tree
Hide file tree
Showing 26 changed files with 784 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: 2

jobs:
flake8:
docker:
- image: circleci/python:3.8
steps:
- checkout
- run: pip install flake8
- run: flake8 wagtail_ab_testing

prettier:
docker:
- image: circleci/node:14
steps:
- checkout:

- type: cache-restore
keys:
- node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
- node-modules-{{ .Branch }}-
- node-modules-master-

- run: npm install
- run: npm run lint

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

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

- type: cache-restore
keys:
- pip-{{ .Branch }}-
- pip-master-

- run: pip install -e .[testing]

- type: cache-save
key: pip-{{ .Branch }}-{{ epoch }}
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

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

nightly:
jobs:
- nightly-wagtail-test
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
8 changes: 8 additions & 0 deletions .circleci/trigger-nightly-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Triggers a test run against the master version of Wagtail

# This job will is scheduled in the config.yml, this script is here to help test the job

curl -u ${CIRCLE_API_USER_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=nightly-wagtail-test \
https://circleci.com/api/v1.1/project/github/wagtail/wagtail-ab-testing}/tree/master
24 changes: 24 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[run]
branch = True
include = wagtail_ab_testing/*
omit = */migrations/*,*/tests/*

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'torchbox',
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'react/jsx-filename-extension': [1, { 'extensions': ['.jsx', '.tsx'] }],
},
settings: {
'import/resolver': {
'node': {
'extensions': ['.js', '.jsx', '.ts', '.tsx']
}
}
},
};
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.pyc
/build
/dist
/wagtail_ab_testing.egg-info
/.coverage
/htmlcov
/.tox
/venv
/.vscode
/site
/test_wagtail_ab_testing.db
/node_modules
2 changes: 2 additions & 0 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tabWidth = 4
singleQuote = true
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
dist: focal
language: python
cache: pip

services:
- postgresql

matrix:
include:
- env: TOXENV=py37-dj22-wamaster-postgres
python: 3.7

- env: TOXENV=py38-dj22-wamaster-postgres
python: 3.8

- env: TOXENV=py38-dj22-wamaster-sqlite
python: 3.8

- env: TOXENV=py37-dj30-wamaster-postgres
python: 3.7

- env: TOXENV=py38-dj30-wamaster-postgres
python: 3.8

- env: TOXENV=py38-dj31-wamaster-postgres
python: 3.8

- env: TOXENV=py38-dj31-wamaster-sqlite
python: 3.8

# Not currently needed as we test against Wagtail master anyway
# When Wagtail 2.11 is released and the above environments are updated. Uncomment this.
#
# - env: TOXENV=py38-dj31-wamaster-postgres
# python: 3.8
#
# allow_failures:
# - env: TOXENV=py38-dj31-wamaster-postgres

install:
- pip install tox

script:
- tox
33 changes: 33 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@



BSD License

Copyright (c) 2020, Karl Hobley
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE *.rst *.txt *.md
graft wagtail_ab_testing
global-exclude __pycache__
global-exclude *.py[co]
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "wagtail-ab-testing",
"version": "1.0.0",
"description": "",
"main": "wagtail_ab_testing/static_src/main.tsx",
"scripts": {
"build": "webpack --mode=production",
"start": "webpack --mode=development --watch",
"format": "prettier --write wagtail_ab_testing/**/*.{ts,tsx,scss}",
"lint": "prettier --check wagtail_ab_testing/**/*.{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"
}
}
47 changes: 47 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python

import sys, os

from setuptools import setup, find_packages

# Hack to prevent "TypeError: 'NoneType' object is not callable" error
# in multiprocessing/util.py _exit_function when setup.py exits
# (see http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
try:
import multiprocessing
except ImportError:
pass


setup(
name="wagtail-ab-testing",
version="0.1",
description="A/B Testing for Wagtail",
author="Karl Hobley",
author_email="[email protected]",
url="",
packages=find_packages(),
include_package_data=True,
license="BSD",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
],
install_requires=["Django>=2.2,<3.2", "Wagtail>=2.11,<2.12"],
extras_require={
"testing": ["dj-database-url==0.5.0", "freezegun==0.3.15"],
},
zip_safe=False,
)
Loading

0 comments on commit 167dbd9

Please sign in to comment.