Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 4404 #2

Merged
merged 15 commits into from
Aug 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

### QA

- Instruction 1 (exemple : lancez `python manage.py migrate` et `npm run gulp build`)
- Instruction 1 (exemple : lancez `python manage.py migrate` et `yarn test`)
- Instruction 2
- ...
- Code review
- Code review
161 changes: 101 additions & 60 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,154 @@
dist: trusty
language: python
sudo: required


python:
- 2.7


addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- language-pack-fr
- unzip
- oracle-java8-set-default
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- language-pack-fr
- unzip
- oracle-java8-set-default


git:
depth: 1

language: python

python:
- 2.7
matrix:
fast_finish: true


env:
global:
- secure: "azmDZZQZzf88zpbkYpLpxI66vpEVyv+kniW0QdWAt4qlys8P5OcO3VJBR5YT85vlvnjN9b6raWQAL1ymee0WmVdTmzXed8XjZv7t9QXVw7pfezxMKlEftVp/4Cu4wtvbew0ViZXNWV2hNXHzEqlhgnoIOq94i0UzZ7grMrI0xm0="
matrix:
- TEST_APP="-e back_mysql -- zds.member zds.mp zds.utils zds.forum zds.gallery zds.pages zds.featured zds.notification zds.searchv2"
- TEST_APP="-e back_mysql -- zds.tutorialv2"
- TEST_APP="-e front"
- ZDS_TEST_JOB="zds.tutorialv2"
- ZDS_TEST_JOB="zds.member zds.utils zds.forum"
- ZDS_TEST_JOB="front zds.mp zds.gallery zds.pages zds.featured zds.notification zds.searchv2"


notifications:
webhooks:
urls:
- "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MHNhbmRob3NlJTNBc2FuZGhvc2UuZnIvJTIxd2dlbkt2dHpNY3NYREtiZEhZJTNBbWF0cml4Lm9yZw"
- "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MHNhbmRob3NlJTNBc2FuZGhvc2UuZnIvJTIxd2dlbkt2dHpNY3NYREtiZEhZJTNBbWF0cml4Lm9yZw"
on_success: change
on_failure: always
on_start: never


services:
- memcached
- memcached


cache:
apt: true
pip: true
yarn: true
directories:
- $HOME/.cabal
- $HOME/.fonts
- $HOME/.nvm
- $HOME/.pandoc
- $HOME/.texlive
- $HOME/bin
- node_modules


before_install:
# see https://docs.travis-ci.com/user/database-setup/#Installing-specific-versions-of-ElasticSearch
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.deb && sudo dpkg -i --force-confnew elasticsearch-5.3.0.deb && sudo service elasticsearch start

before_script:
# MySQL config
- sudo sed -i'' 's/\[client\]/\[client\]\ndefault-character-set=utf8mb4/' /etc/mysql/my.cnf
- sudo sed -i'' 's/\[mysql\]/\[mysql\]\ndefault-character-set=utf8mb4/' /etc/mysql/my.cnf
- sudo sed -i'' 's/\[mysqld\]/\[mysqld\]\ninnodb_file_per_table=on\ninnodb_file_format=barracuda\ninnodb_large_prefix=on\ncharacter-set-client-handshake=false\ncharacter-set-server=utf8mb4\ncollation-server=utf8mb4_unicode_ci/' /etc/mysql/my.cnf
- sudo /etc/init.d/mysql restart
# Travis should fail as soon as possible
- mysql -u root -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';"
# Avoid "mysql has gone away" errors
- mysql -u root -e "SET GLOBAL wait_timeout = 36000;"
- mysql -u root -e "SET GLOBAL max_allowed_packet = 134209536;"
# Create database with the correct charset and collation
- mysql -u root -e "CREATE DATABASE zds_test CHARACTER SET = utf8mb4 COLLATE utf8mb4_unicode_ci;"
- mv zds/settings_test_travis.py zds/settings_prod.py
- . ./scripts/ci_turbo.sh # This script exports environment variables, it must be sourced

- travis_retry pip install -q coveralls

- |
# install elasticsearch
if [[ "$ZDS_TEST_JOB" == *"zds.searchv2"* ]]; then
# see https://docs.travis-ci.com/user/database-setup/#Installing-specific-versions-of-ElasticSearch
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.deb \
&& sudo dpkg -i --force-confnew elasticsearch-5.3.0.deb \
&& sudo service elasticsearch start
fi

- |
# setup mysql
if [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
# MySQL config
./scripts/ci_mysql_setup.sh
fi


install:
- mkdir -p $HOME/bin
- ./scripts/install_texlive.sh
- |
# cache these no matter what
if ls $HOME/.nvm/alias/lts/\* 1> /dev/null 2>&1; then
echo "Using cached nvm"
else
touch $HOME/.cache_updated
nvm install 'lts/*'
# install frontend dependencies
if [[ "$ZDS_TEST_JOB" == *"front"* ]]; then
nvm install 8 \
&& nvm use 8 \
&& npm i -g yarn \
&& yarn --silent
fi

- |
# install latex
if [[ "$ZDS_TEST_JOB" == *"zds.tutorialv2"* ]]; then
mkdir -p $HOME/bin \
&& ./scripts/install_texlive.sh \
&& ./scripts/install_resources.sh \
&& export PATH=$HOME/.texlive/bin/x86_64-linux:$PATH \
&& export PATH=$PATH:$HOME/bin
fi

# only for front tests
if [[ "$TEST_APP" == *"front"* ]]; then
nvm use 'lts/*'
npm install -g npm
- |
# install backend dependencies
if [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
pip install -q -rrequirements.txt -rrequirements-dev.txt -rrequirements-prod.txt
fi
- ./scripts/install_resources.sh
- export PATH=$HOME/.texlive/bin/x86_64-linux:$PATH
- export PATH=$PATH:$HOME/bin
# Python dependencies
- travis_retry pip install coveralls
- travis_retry pip install tox==2.0.1


script:
- ./scripts/no_import_zds_settings.sh
- tox $TEST_APP
- |
# avoid cache update & upload when we didn't explicitely change its content
if [[ -f "$HOME/.cache_updated" ]]; then
echo "Cache updated."
else
echo "Cache not updated."
rm -rf $HOME/.cabal $HOME/.fonts $HOME/.nvm $HOME/.pandoc $HOME/.texlive $HOME/bin
# lint backend
if [[ "$ZDS_TEST_JOB" == *"zds.gallery"* ]]; then
./scripts/no_import_zds_settings.sh \
&& flake8
fi

- |
# test and build frontend
if [[ "$ZDS_TEST_JOB" == *"front"* ]]; then
yarn test
yarn build # we need to upload the assets later
fi

- |
# test backend
if [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
coverage run --source='.' manage.py \
test \
--keepdb \
--settings zds.settings_test_travis \
${ZDS_TEST_JOB/front/}
fi


after_success:
- coveralls
- du -sh $HOME/.texlive 2>/dev/null | true

- |
# upload coverage
if [[ "$ZDS_TEST_JOB" != "none" ]]; then
coveralls
fi

- |
# upload compiled assets
COMMIT_MSG=`git rev-list --format=%B --max-count=1 $TRAVIS_COMMIT`
if [[ "$TEST_APP" == *"front"* ]] && [[ "$TRAVIS_PULL_REQUEST" == false ]] && [[ ! -z "$TRAVIS_TAG" ]] && [[ ! "$TRAVIS_TAG" == *"-build" ]]
if [[ "$ZDS_TEST_JOB" == *"front"* ]] && [[ "$TRAVIS_PULL_REQUEST" == false ]] && [[ ! -z "$TRAVIS_TAG" ]] && [[ ! "$TRAVIS_TAG" == *"-build" ]]
then
# Adding GitHub OAuth token to login
echo -e "machine github.com login $BOT_LOGIN\n password $BOT_PASSWORD" > $HOME/.netrc
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Les contributions externes sont les bienvenues !
3. Ajoutez un test pour votre modification. Seules les modifications de documentation et les réusinages n'ont pas besoin de nouveaux tests.
4. Assurez-vous que l'intégralité des tests passent : `python manage.py test`.
5. Assurez-vous que le code suit la [PEP-8](http://legacy.python.org/dev/peps/pep-0008/) : `tox -e flake8`.
6. Si vous avez fait des modifications du _front_, jouez les tests associés : `npm test`.
6. Si vous avez fait des modifications du _frontend_, jouez les tests associés : `yarn test`.
7. Si vous modifiez le modèle (les fichiers models.py), n'oubliez pas de créer les fichiers de migration : `python manage.py makemigrations`.
8. Si votre travail nécessite des actions spécifiques lors du déploiement, précisez-les dans le fichier [update.md](update.md).
9. Poussez votre travail et faites une _pull request_.
Expand Down Expand Up @@ -51,7 +51,7 @@ Tous les détails sur le workflow se trouvent [sur la page dédiée](http://zds-
| Nouvelle Fonctionnalité ? | [oui|non]
| Tickets (_issues_) concernés | [Liste de tickets séparés par des virgules]
```
* Ajoutez des notes de QA (Quality Assurance). Ces notes doivent permettent à un testeur de comprendre ce que vous avez modifié, ce qu'il faut tester en priorité et les pièges auxquels il doit s'attendre et donc sur lesquels porter une attention particulière. Précisez tout particulièrement s'il est nécessaire d'effectuer une action de gestion préalable, comme `python manage.py migrate --fake-initial`, `python manage.py loaddata fixture/*.yaml` ou `npm run gulp -- build`.
* Ajoutez des notes de QA (Quality Assurance). Ces notes doivent permettent à un testeur de comprendre ce que vous avez modifié, ce qu'il faut tester en priorité et les pièges auxquels il doit s'attendre et donc sur lesquels porter une attention particulière. Précisez tout particulièrement s'il est nécessaire d'effectuer une action de gestion préalable, comme `python manage.py migrate --fake-initial`, `python manage.py loaddata fixture/*.yaml` ou `yarn run build`.

## Les commits

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ install-archlinux:
sudo pacman -Sy git python2 python2-setuptools python2-pip libxml2 python2-lxml libxslt zlib python2-sqlparse libffi libjpeg-turbo freetype2 python2-tox base-devel

install-osx:
brew install gettext cairo --without-x11 py2cairo node && \
pip install virtualenv virtualenvwrapper
brew install gettext cairo --without-x11 py2cairo node && \
pip install virtualenv virtualenvwrapper

# dev back
## django
Expand Down Expand Up @@ -65,19 +65,19 @@ test-back:
## front-utils

build-front:
npm run build
yarn run build

clean-front:
npm run clean
yarn run clean

install-front:
npm install
yarn

lint-front:
npm run lint
yarn run lint

watch-front:
npm run gulp
yarn run gulp

# generic utils

Expand Down
Binary file modified assets/images/sprite/zform-smilies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/sprite/zform-smilies@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 24 additions & 24 deletions assets/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,34 @@

smilies: {
0: {
smiley_sm: { title: ":)", start: ":)", end: "", image: "https://zestedesavoir.com/static/smileys/smile.png" },
smiley_he: { title: ":D", start: ":D", end: "", image: "https://zestedesavoir.com/static/smileys/heureux.png" },
smiley_cl: { title: ";)", start: ";)", end: "", image: "https://zestedesavoir.com/static/smileys/clin.png" },
smiley_la: { title: ":p", start: ":p", end: "", image: "https://zestedesavoir.com/static/smileys/langue.png" },
smiley_ri: { title: ":lol:", start: ":lol:", end: "", image: "https://zestedesavoir.com/static/smileys/rire.gif" },
smiley_un: { title: ":euh:", start: ":euh:", end: "", image: "https://zestedesavoir.com/static/smileys/unsure.gif" },
smiley_tr: { title: ":(", start: ":(", end: "", image: "https://zestedesavoir.com/static/smileys/triste.png" },
smiley_hu: { title: ":o", start: ":o", end: "", image: "https://zestedesavoir.com/static/smileys/huh.png" }
smiley_sm: { title: ":)", start: ":)", end: "", image: "/static/smileys/smile.png" },
smiley_he: { title: ":D", start: ":D", end: "", image: "/static/smileys/heureux.png" },
smiley_cl: { title: ";)", start: ";)", end: "", image: "/static/smileys/clin.png" },
smiley_la: { title: ":p", start: ":p", end: "", image: "/static/smileys/langue.png" },
smiley_ri: { title: ":lol:", start: ":lol:", end: "", image: "/static/smileys/rire.gif" },
smiley_un: { title: ":euh:", start: ":euh:", end: "", image: "/static/smileys/unsure.gif" },
smiley_tr: { title: ":(", start: ":(", end: "", image: "/static/smileys/triste.png" },
smiley_hu: { title: ":o", start: ":o", end: "", image: "/static/smileys/huh.png" }
},
1: {
smiley_c1: { title: ":colere2:", start: ":colere2:", end: "", image: "https://zestedesavoir.com/static/smileys/mechant.png" },
smiley_oo: { title: "o_O", start: "o_O", end: "", image: "https://zestedesavoir.com/static/smileys/blink.gif" },
smiley_uu: { title: "^^", start: "^^", end: "", image: "https://zestedesavoir.com/static/smileys/hihi.png" },
smiley_si: { title: ":-°", start: ":-°", end: "", image: "https://zestedesavoir.com/static/smileys/siffle.png" },
smiley_an: { title: ":ange:", start: ":ange:", end: "", image: "https://zestedesavoir.com/static/smileys/ange.png" },
smiley_c2: { title: ":colere:", start: ":colere:", end: "", image: "https://zestedesavoir.com/static/smileys/angry.gif" },
smiley_di: { title: ":diable:", start: ":diable:", end: "", image: "https://zestedesavoir.com/static/smileys/diable.png" },
smiley_ma: { title: ":magicien:", start: ":magicien:", end: "", image: "https://zestedesavoir.com/static/smileys/magicien.png" }
smiley_c1: { title: ":colere2:", start: ":colere2:", end: "", image: "/static/smileys/mechant.png" },
smiley_oo: { title: "o_O", start: "o_O", end: "", image: "/static/smileys/blink.gif" },
smiley_uu: { title: "^^", start: "^^", end: "", image: "/static/smileys/hihi.png" },
smiley_si: { title: ":-°", start: ":-°", end: "", image: "/static/smileys/siffle.png" },
smiley_an: { title: ":ange:", start: ":ange:", end: "", image: "/static/smileys/ange.png" },
smiley_c2: { title: ":colere:", start: ":colere:", end: "", image: "/static/smileys/angry.gif" },
smiley_di: { title: ":diable:", start: ":diable:", end: "", image: "/static/smileys/diable.png" },
smiley_ma: { title: ":magicien:", start: ":magicien:", end: "", image: "/static/smileys/magicien.png" }
},
2: {
smiley_ni: { title: ":ninja:", start: ":ninja:", end: "", image: "https://zestedesavoir.com/static/smileys/ninja.png" },
smiley_gd: { title: ">_<", start: ">_<", end: "", image: "https://zestedesavoir.com/static/smileys/pinch.png" },
smiley_pi: { title: ":pirate:", start: ":pirate:", end: "", image: "https://zestedesavoir.com/static/smileys/pirate.png" },
smiley_pl: { title: ":'(", start: ":'(", end: "", image: "https://zestedesavoir.com/static/smileys/pleure.png" },
smiley_ro: { title: ":honte:", start: ":honte:", end: "", image: "https://zestedesavoir.com/static/smileys/rouge.png" },
smiley_so: { title: ":soleil:", start: ":soleil:", end: "", image: "https://zestedesavoir.com/static/smileys/soleil.png" },
smiley_ww: { title: ":waw:", start: ":waw:", end: "", image: "https://zestedesavoir.com/static/smileys/waw.png" },
smiley_zz: { title: ":zorro:", start: ":zorro:", end: "", image: "https://zestedesavoir.com/static/smileys/zorro.png" }
smiley_ni: { title: ":ninja:", start: ":ninja:", end: "", image: "/static/smileys/ninja.gif" },
smiley_gd: { title: ">_<", start: ">_<", end: "", image: "/static/smileys/pinch.png" },
smiley_pi: { title: ":pirate:", start: ":pirate:", end: "", image: "/static/smileys/pirate.png" },
smiley_pl: { title: ":'(", start: ":'(", end: "", image: "/static/smileys/pleure.png" },
smiley_ro: { title: ":honte:", start: ":honte:", end: "", image: "/static/smileys/rouge.png" },
smiley_so: { title: ":soleil:", start: ":soleil:", end: "", image: "/static/smileys/soleil.png" },
smiley_ww: { title: ":waw:", start: ":waw:", end: "", image: "/static/smileys/waw.png" },
smiley_zz: { title: ":zorro:", start: ":zorro:", end: "", image: "/static/smileys/zorro.png" }
}
},

Expand Down
Loading