Skip to content

Commit

Permalink
Merge cd95720 into efe579b
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeG committed Jun 22, 2019
2 parents efe579b + cd95720 commit fc6b757
Show file tree
Hide file tree
Showing 20 changed files with 6,834 additions and 4,588 deletions.
27 changes: 12 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,20 @@ python-testing:
POSTGRES_DB: eventol
POSTGRES_USER: eventol
POSTGRES_PASSWORD: secret
image: python:3.6
image: python:3.7
stage: testing
script:
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt install -y nodejs
- npm install -g yarn yarnpkg
- cd eventol/front
- yarn install
- yarn build
- cd -
- ./test.sh -i backend
- make python-image-install-yarn
- make install-js-dependencies
- make build-js
- make python-install-dev
- make python-test
artifacts:
paths:
- eventol/htmlcov

react-testing:
image: node:8
image: node:10
stage: testing
script:
- ./test.sh -i frontend
Expand All @@ -77,14 +74,14 @@ react-testing:
- eventol/front/coverage

python-lint:
image: python:3.5
image: python:3.7
stage: styling
allow_failure: true
script:
- ./test.sh -i pythonlint

react-lint-report:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
Expand All @@ -94,14 +91,14 @@ react-lint-report:
- eventol/front/report.html

react-lint:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
- ./test.sh -i lint

sass-lint-report:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
Expand All @@ -111,7 +108,7 @@ sass-lint-report:
- eventol/front/scss-lint-report.html

sass-lint:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
Expand Down
11 changes: 9 additions & 2 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
esversion: 6

jshint:
enabled: false

python:
enabled: true
config_file: .pylintrc

prettier:
enabled: true
config_file: eventol/front/.prettierrc

eslint:
enabled: true
config_file: eventol/front/.eslintrc.yaml
config_file: eventol/front/.eslintrc.json

javascript:
enable: true
esversion: 6
config_file: eventol/front/.eslintrc.yaml
config_file: eventol/front/.eslintrc.json

scss:
enabled: true
Expand Down
51 changes: 7 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
sudo: required
dist: xenial
language: python
python:
- "3.6"
- "3.7"
env:
global:
- DB=postgres
- PSQL_PORT=5000
- PSQL_VERSION=9.6
- PSQL_USER=eventol
- NODE_VERSION=10.15
- YARN_VERSION=1.13.0
- PSQL_DBNAME=eventol
- PSQL_HOST=localhost
- PSQL_PASSWORD=secret
- CC_TEST_REPORTER_ID=74cbdb599d4cabc78a5dd07f26f1ddcc36910ffca3104c35c2ba66603818031c
matrix:
- DJANGO=1.11.20
- DJANGO=1.11.21
services:
- docker
cache:
Expand All @@ -24,42 +19,10 @@ cache:
directories:
- eventol/front/node_modules
before_install:
- docker run --name eventol-postgres -e POSTGRES_PASSWORD=$PSQL_PASSWORD -e POSTGRES_USER=$PSQL_USER -e POSTGRES_DB=$PSQL_DBNAME -p $PSQL_PORT:5432 -d postgres:$PSQL_VERSION
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
- export PATH=$HOME/.yarn/bin:$PATH
- nvm install $NODE_VERSION
- make travis-before
install:
- pip install -U pip wheel
- pip install coverage coveralls
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- make python-install-dev
script:
- cd eventol/front
- yarn install
- yarn build
- cd -
- mkdir -p eventol/static
- cd eventol
- python manage.py makemigrations manager
- python manage.py migrate
- python manage.py collectstatic --noinput
- py.test --cov-report xml --cov-report term-missing --cov-report html --cov --cov-branch
- cd -
- cd eventol/front
- yarn install
- yarn test
- cd -
- make travis-script
after_success:
- cd eventol
- coverage report
- coveralls
- cd -
- mv cc-test-reporter eventol/cc-test-reporter
- cd eventol
- ./cc-test-reporter format-coverage -d -t coverage.py -o coverage/python.json --add-prefix eventol
- ./cc-test-reporter format-coverage ./front/coverage/lcov.info -d -t lcov -o ./coverage/javascript.json --add-prefix eventol
- ./cc-test-reporter sum-coverage --output coverage/codeclimate.json -d -p 2 coverage/python.json coverage/javascript.json
- ./cc-test-reporter upload-coverage -d
- make travis-after
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ RUN apk add --upgrade --no-cache --repository http://dl-cdn.alpinelinux.org/alpi
## Install system dependencies
RUN apk --update add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
bash wget dpkg-dev libffi nodejs nodejs-npm git gcc musl-dev gettext \
postgresql-dev libffi-dev py3-setuptools jpeg-dev make \
postgresql-dev libffi-dev py3-setuptools jpeg-dev make autoconf automake \
zlib-dev freetype-dev lcms2-dev openjpeg-dev libxslt-dev alpine-sdk \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /tmp/* /var/tmp/*

## Install react dependencies
RUN npm install -g npm
RUN npm install -g yarn webpack@^1.12.13 bower less
RUN npm install -g yarn bower less

## Install python dependencies
RUN pip3 install --no-cache-dir cffi cairocffi psycopg2
Expand Down Expand Up @@ -50,7 +50,7 @@ RUN pip3 install --no-cache-dir -r requirements-dev.txt
COPY ./eventol/front/package.json ${APP_ROOT}/eventol/front/
COPY ./eventol/front/yarn.lock ${APP_ROOT}/eventol/front/
RUN cd ${APP_ROOT}/eventol/front && yarn install
RUN cd ${APP_ROOT}/eventol/front && npm rebuild node-sass --force
# RUN cd ${APP_ROOT}/eventol/front && npm rebuild node-sass --force

# Install bower dependencies
COPY ./eventol/front/bower.json ${APP_ROOT}/eventol/front/
Expand All @@ -75,7 +75,7 @@ COPY ./deploy/docker/scripts/wait-for-it.sh ${APP_ROOT}/wait-for-it.sh
COPY ./deploy/docker/scripts/start_eventol.sh ${APP_ROOT}/start_eventol.sh

# Compile reactjs code
RUN cd ${APP_ROOT}/eventol/front && webpack --config webpack.prod.config.js
RUN cd ${APP_ROOT}/eventol/front && yarn build

# Collect statics
RUN mkdir -p ${APP_ROOT}/eventol/static
Expand Down
75 changes: 75 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
THIS_FILE := $(lastword $(MAKEFILE_LIST))
SHELL := /bin/bash

.PHONY: help travis-ci gitlab

.DEFAULT: help

.EXPORT_ALL_VARIABLES:
NODE_VERSION = 10.x
YARN_VERSION = 1.13.0
PSQL_DBNAME = eventol
PSQL_PASSWORD = secret
PSQL_USER = eventol
PSQL_VERSION = 9.6
PATH = $(shell printenv PATH):~/.yarn/bin:$(HOME)/.yarn/bin:$(HOME)/.config/yarn/global/node_modules/.bin


help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

python-image-install-node: ## Install node in python image
curl -sL https://deb.nodesource.com/setup_$$NODE_VERSION | bash -
apt install -y nodejs

python-image-install-yarn: ## Install yarn and node in python image if node is not installed
if which node > /dev/null; then \
node -v; \
echo "node is installed, skipping..."; \
else \
curl -sL https://deb.nodesource.com/setup_$$NODE_VERSION | bash -; \
apt install -y nodejs; \
fi
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $$YARN_VERSION

install-js-dependencies: ## Install dev dependencies
cd eventol/front && yarn install

build-js: ## Build js code for production environment
cd eventol/front && yarn build

travis-before: ## Travis before commands
docker run --name eventol-postgres -e POSTGRES_PASSWORD=$$PSQL_PASSWORD -e POSTGRES_USER=$$PSQL_USER -e POSTGRES_DB=$$PSQL_DBNAME -p $$PSQL_PORT:5432 -d postgres:$$PSQL_VERSION
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
@$(MAKE) -f $(THIS_FILE) python-image-install-yarn

python-install-dev: ## Python install dev dependencies
pip install -U pip wheel
pip install coverage coveralls
pip install -r requirements.txt
pip install -r requirements-dev.txt

python-test: ## Python run test with coverage
cd eventol && py.test --cov-report xml --cov-report term-missing --cov-report html --cov --cov-branch

travis-script: install-js-dependencies build-js ## Travis script for run tests (python and react)
mkdir -p eventol/static
cd eventol && python manage.py makemigrations manager
cd eventol && python manage.py migrate
cd eventol && python manage.py collectstatic --noinput
@$(MAKE) -f $(THIS_FILE) python-test
cd eventol/front && yarn install
cd eventol/front && yarn test

travis-after: ## Travis after script for success case
cd eventol && coverage report
cd eventol && coveralls
mv cc-test-reporter eventol/cc-test-reporter
cd eventol && ./cc-test-reporter format-coverage -d -t coverage.py -o coverage/python.json --add-prefix eventol
cd eventol && ./cc-test-reporter format-coverage ./front/coverage/lcov.info -d -t lcov -o ./coverage/javascript.json --add-prefix eventol
cd eventol && ./cc-test-reporter sum-coverage --output coverage/codeclimate.json -d -p 2 coverage/python.json coverage/javascript.json
cd eventol && ./cc-test-reporter upload-coverage -d


6 changes: 0 additions & 6 deletions eventol/front/.babelrc

This file was deleted.

96 changes: 96 additions & 0 deletions eventol/front/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"parser": "babel-eslint",
"extends": ["airbnb", "prettier", "plugin:react/all"],
"plugins": ["prettier", "react", "react-hooks"],
"settings": {
"react": {
"version": "detect"
}
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
}
},
"globals": {
"gettext": true,
"$": true,
"L": true,
"module": true,
"process": true,
"__dirname": true,
"global": true,
"window": true,
"document": true,
"console": true
},
"env": {
"browser": true,
"node": true
},
"rules": {
"prettier/prettier": ["error", {
"singleQuote": true,
"bracketSpacing": false,
"trailingComma": "es5"
}],
"arrow-parens": ["error", "as-needed"],
"object-curly-spacing": ["error", "never"],
"quotes": ["error", "single"],
"no-prototype-builtins": "off",
"no-underscore-dangle": ["error", {"allow": ["__REDUX_DEVTOOLS_EXTENSION_COMPOSE__"]}],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/jsx-no-literals": "off",
"react/jsx-max-depth": ["error", {"max": 5}],
"react/state-in-constructor": ["error", "never"],
"react/no-set-state": "off",
"react/boolean-prop-naming": ["error", { "rule": "^(is|has|show|use|focus)([A-Z]?)([A-Za-z0-9]?)+"}],
"react/jsx-props-no-spreading": ["error", {
"exceptions": ["WrappedComponent"]
}],
"import/no-extraneous-dependencies": ["error", {"devDependencies": [
"src/**/*.{spec,test}.{js,jsx}",
"src/**/__mocks__/*.{js,jsx}",
"src/setupTests.{js,jsx}",
"src/**/*.stories.{js,jsx}"
]}]
},
"overrides": [{
"files": [
"src/**/*.{spec,test}.{js,jsx}",
"src/**/__mocks__/*.{js,jsx}",
"src/setupTests.js"
],
"globals": {
"document": true,
"jest": true
},
"env": {
"jest": true,
"browser": true
},
"plugins": ["jest"],
"rules": {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
"no-underscore-dangle": "off",
"import/first": "off"
}
}, {
"files": [
"src/**/*.stories.{js,jsx}",
"src/utils/stories.{js,jsx}"
],
"rules": {
"import/first": "off"
}
}]
}
Loading

0 comments on commit fc6b757

Please sign in to comment.