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

Travis utilise install_zds.sh #5299

Merged
merged 69 commits into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
9e24fe0
Travis utilise le même script que nous
A-312 Feb 1, 2019
0a767ca
Bypass la selection Humaine de l'OS...
A-312 Mar 10, 2019
66f069d
Sans hack
A-312 Mar 10, 2019
6e7b980
il manque un 0
A-312 Mar 10, 2019
da710ef
uncomment
A-312 Mar 10, 2019
a9f4614
remet coveralls
A-312 Mar 10, 2019
e816974
Doublon avec ligne 191 "installing `virtualenv 16.2.0`..."
A-312 Mar 10, 2019
0f42955
J'ai oublié de mettre --answer-yes
A-312 Mar 10, 2019
27e3cb2
Affichage le message seulement si nécessaire
A-312 Mar 10, 2019
ba21234
Ajout d'un saut à la ligne
A-312 Mar 10, 2019
b87f1f7
Listen make error and exit 1, if we get one
A-312 Mar 10, 2019
27f6d1d
Change l'opérateur
A-312 Mar 10, 2019
a5a2ca9
Démarre zmd avant d'installer les fixtures
A-312 Mar 10, 2019
32723c7
Positionne correctement la variable
A-312 Mar 11, 2019
8aa2937
Diminue le niveau de log
A-312 Mar 11, 2019
b2df495
Test niveau log différent
A-312 Mar 11, 2019
7302a4b
revert
A-312 Mar 11, 2019
98983cd
Diminue le niveau de log pour diminuer l'output
A-312 Mar 11, 2019
26bcf7e
Nouveau système de log :)
A-312 Mar 11, 2019
2fa1fae
Settings personnalisé
A-312 Mar 11, 2019
f5b4329
Settings personnalisé
A-312 Mar 11, 2019
593d044
Settings personnalisé
A-312 Mar 11, 2019
8233ad0
Change le titre de la catégorie
A-312 Mar 11, 2019
d6ce054
use pip3
A-312 Mar 11, 2019
a2bc17d
unzip n'était pas installé pour tout le monde
A-312 Mar 12, 2019
3ecd901
Améliore la syntaxe
A-312 Mar 12, 2019
b974ac7
Améliore la gestion du virtualenv
A-312 Mar 12, 2019
f899565
Supprime le dossier sans confirmation fichier par fichier
A-312 Mar 12, 2019
7009c19
Gulp n'est jamais installé en global par défaut
A-312 Mar 12, 2019
b877a60
Fix "error: invalid command 'bdist_wheel'" car manquant dans setuptools
A-312 Mar 12, 2019
d01b7d1
Suit la même norme
A-312 Mar 12, 2019
3473e20
Anticipe une possible erreur lors de prochain changement
A-312 Mar 12, 2019
d63fabb
Support pour les VM (+ dossier partagé) avec Windows en host
A-312 Mar 12, 2019
8260d9f
Attend que realpath soit installé s'il ne l'est pas
A-312 Mar 12, 2019
d8ee521
Undo last commit (for shared folder)
A-312 Mar 12, 2019
0864d01
j'ai push un changement qui devait rester en local :/
A-312 Mar 12, 2019
e0c4817
test avec echo
A-312 Mar 22, 2019
b044dbe
essaye avec pip sans travis_retry
A-312 Mar 30, 2019
a62bbb9
Test avec un autre environnement
A-312 Apr 1, 2019
0df31e4
Fix coverage
A-312 Apr 1, 2019
5ffc301
beautify l'affichage
A-312 Apr 1, 2019
90460fe
fix erreur de syntax
A-312 Apr 1, 2019
935e659
unix2dos define_function.sh
A-312 Apr 1, 2019
0364690
Fix les permissions
A-312 Apr 1, 2019
cd54f74
Fix l'erreur de syntax
A-312 Apr 1, 2019
37e10fc
Fix line ending 2ème essai
A-312 Apr 1, 2019
17adac0
add travis_output
A-312 Apr 1, 2019
fd5b46f
Modifie la nomenclature des fichiers
A-312 Apr 1, 2019
fcef658
Rajoute les includes là, où c'est nécessaire
A-312 Apr 1, 2019
689fa96
export les variables
A-312 Apr 1, 2019
58c81f0
corrige une erreur de c/c dans echo (incidence visuelle)
A-312 Apr 1, 2019
70a20dd
J'ai oublié de définir la catégorie de zds_fold pour install_zds.sh
A-312 Apr 1, 2019
eda8b46
(test scope)
A-312 Apr 1, 2019
56dc6ad
(undo test)
A-312 Apr 1, 2019
f11cd4f
export ZDS_ENV
A-312 Apr 1, 2019
5cfd8ba
exit 1 si erreur
A-312 Apr 1, 2019
3a1259a
zds_fold_category n'utilisait pas la bonne variable
A-312 Apr 1, 2019
d769cde
ZDS_ENV, 2ème essai
A-312 Apr 1, 2019
e494a79
Déplace l'error handler dans le script parent
A-312 Apr 1, 2019
b95fdab
Apparement j'avais oublié de mettre le lint du frontend :')
A-312 Apr 1, 2019
80ac3cd
Démarre zmd pour coverage
A-312 Apr 1, 2019
efdde7a
Ajout du chemin relatif, plutôt que la commande global
A-312 Apr 1, 2019
891089d
Undo passage apt-get à pip. On remet comme c'était avant
A-312 Apr 19, 2019
6694eaf
maj versions testées
A-312 Apr 19, 2019
8c7c458
On installe pas tex
A-312 Apr 20, 2019
8191843
Accélère l'installation de latex
A-312 Apr 20, 2019
28fcd34
no fixture
A-312 Apr 20, 2019
f8a5bd0
fix `texhash: command not found`
A-312 Apr 20, 2019
0e60225
texhash est déjà exécuté directement après l'installation
A-312 Apr 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
133 changes: 19 additions & 114 deletions .travis.yml
Expand Up @@ -16,8 +16,6 @@ addons:
- mysql-client-5.6
- libmysqlclient-dev
- language-pack-fr
- unzip
- oracle-java9-set-default


git:
Expand All @@ -31,12 +29,21 @@ matrix:
env:
global:
- secure: "azmDZZQZzf88zpbkYpLpxI66vpEVyv+kniW0QdWAt4qlys8P5OcO3VJBR5YT85vlvnjN9b6raWQAL1ymee0WmVdTmzXed8XjZv7t9QXVw7pfezxMKlEftVp/4Cu4wtvbew0ViZXNWV2hNXHzEqlhgnoIOq94i0UzZ7grMrI0xm0="
matrix:
- 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"
- ZDS_TEST_JOB="selenium"
- ZDS_TEST_JOB="doc"


jobs:
include:
- name: tuto
env: ZDS_TEST_JOB="zds.tutorialv2"
- name: "test1 : member utils forum"
env: ZDS_TEST_JOB="zds.member zds.utils zds.forum"
- name: "test2 : front mp gallery pages featured notification searchv2"
env: ZDS_TEST_JOB="front zds.mp zds.gallery zds.pages zds.featured zds.notification zds.searchv2"
- name: selenium
env: ZDS_TEST_JOB="selenium"
- name: doc
env: ZDS_TEST_JOB="doc"


notifications:
webhooks:
Expand All @@ -62,120 +69,18 @@ cache:


before_install:
- . ./scripts/ci_turbo.sh # This script exports environment variables, it must be sourced
- export HACK_VIRTUALENV=$VIRTUAL_ENV

- source ./scripts/define_variable.sh
- source ./scripts/travis_header.sh # Need to 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-$ZDS_ELASTIC_VERSION.deb \
&& sudo dpkg -i --force-confnew elasticsearch-$ZDS_ELASTIC_VERSION.deb \
&& sudo service elasticsearch start
fi

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

install:
- |
# install webdriver for selenium.
if [[ "$ZDS_TEST_JOB" == *"selenium"* ]]; then
wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz \
&& mkdir geckodriver \
&& tar -xzf geckodriver-v0.23.0-linux64.tar.gz -C geckodriver \
&& export PATH=$PATH:$PWD/geckodriver \
&& export DISPLAY=:99.0
fi

- |
if [[ "$ZDS_TEST_JOB" == *"zds.tutorialv2"* ]]; then
# install latex
git clone $ZDS_LATEX_REPO
TEMPLATEDIR=$HOME/.texlive/texmf-local/tex/latex/
./latex-template/scripts/install_font.sh \
&& ./latex-template/scripts/install_texlive.sh \
&& export PATH=$HOME/.texlive/bin/x86_64-linux:$PATH \
&& rm -rf $TEMPLATEDIR/latex-template \
&& mkdir -p $TEMPLATEDIR && cp -r ./latex-template $TEMPLATEDIR && texhash
fi

- |
# install and run zmarkdown
nvm install $ZDS_NODE_VERSION \
&& nvm use $ZDS_NODE_VERSION \
&& npm i -g pm2 zmarkdown \
&& cd "$(nvm which current | sed s/bin/lib/)_modules/zmarkdown/" \
&& npm run server \
&& cd $TRAVIS_BUILD_DIR

- |
# install frontend dependencies
npm i -g yarn \
&& yarn --silent

- |
# install backend dependencies
if [[ "$ZDS_TEST_JOB" == *"zds."* ]] || [[ "$ZDS_TEST_JOB" == *"selenium"* ]] || [[ "$ZDS_TEST_JOB" == *"doc"* ]]; then
pip install -q -r requirements-dev.txt -r requirements-prod.txt
fi
- ./scripts/install_zds.sh --answer-yes --detect-os-version --travis-output $zds_install_argument


script:
- |
# lint backend
if [[ "$ZDS_TEST_JOB" == *"zds.gallery"* ]]; then
./scripts/no_import_zds_settings.sh \
&& flake8 \
&& flake8 --config=zds/settings/.flake8 zds/settings
fi

- |
# test and build frontend
if [[ "$ZDS_TEST_JOB" == *"front"* ]]; then
yarn run lint && yarn run build # we need to upload the assets later
fi
- |
# test backend
if [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
python manage.py makemigrations --dry-run --check \
&& coverage run --source='.' manage.py \
test -v=2\
--keepdb \
--settings zds.settings.ci_test \
--exclude-tag=front \
${ZDS_TEST_JOB/front/}
fi
- source ./scripts/travis_run.sh

- |
# show zmarkdown logs
if [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
pm2 logs --nostream --raw --lines 1000
fi

- |
# selenium tests
if [[ "$ZDS_TEST_JOB" == *"selenium"* ]]; then
yarn run build
xvfb-run --server-args="-screen 0 1280x720x8" python manage.py \
test -v=2\
--settings zds.settings.ci_test \
--tag=front \
--keepdb
fi

- |
# build documentation
if [[ "$ZDS_TEST_JOB" == *"doc"* ]]; then
make --directory doc html
fi

after_success:
- du -sh $HOME/.texlive 2>/dev/null | true
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Expand Up @@ -21,7 +21,10 @@ clean: clean-back clean-front ## Clean everything (`clean-back` & `clean-front`)
## ~ Backend

install-back: ## Install the Python packages for the backend
pip3 install --upgrade -r requirements-dev.txt
pip install --upgrade -r requirements-dev.txt

install-back-with-prod:
pip install --upgrade -r requirements-dev.txt -r requirements-prod.txt

run-back: zmd-check ## Run the backend server
python manage.py runserver
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -9,11 +9,11 @@
"node": ">=8.0.0"
},
"scripts": {
"gulp": "gulp",
"build": "gulp build",
"watch": "gulp watch",
"lint": "gulp js:lint",
"clean": "gulp clean"
"gulp": "node_modules/gulp/bin/gulp.js",
"build": "node_modules/gulp/bin/gulp.js build",
"watch": "node_modules/gulp/bin/gulp.js watch",
"lint": "node_modules/gulp/bin/gulp.js js:lint",
"clean": "node_modules/gulp/bin/gulp.js clean"
},
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion scripts/ci_turbo.sh
Expand Up @@ -16,7 +16,6 @@ fi
changed_files=$(git --no-pager diff --name-only $TRAVIS_COMMIT $(git merge-base $TRAVIS_COMMIT origin/$default_branch))
echo "changed files:"
echo $changed_files
echo

if ! echo "$changed_files" | egrep -v "^assets"
then
Expand Down
67 changes: 67 additions & 0 deletions scripts/define_function.sh
@@ -0,0 +1,67 @@
#!/bin/bash


function _in {
# credits: https://stackoverflow.com/a/8574392
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}


## start fold for travis
ZDS_SHOW_TRAVIS_FOLD=0
if $(_in "--travis-output" $@); then
ZDS_SHOW_TRAVIS_FOLD=1
fi


zds_fold_current_cat="default"
function zds_fold_category {
zds_fold_current_cat="$1"
}


zds_fold_current=""
function zds_fold_start {
if [[ $ZDS_SHOW_TRAVIS_FOLD == 1 ]]; then
if [[ $zds_fold_current == $1 ]]; then # for virtualenv fold
return
fi

zds_fold_current="$1"
echo "travis_fold:start:${zds_fold_current_cat}_${zds_fold_current}"
echo -en "\033[0K"
fi

print_info "$2" --bold
}


function zds_fold_end {
if [[ $ZDS_SHOW_TRAVIS_FOLD == 1 ]] && [[ $zds_fold_current =~ "" ]]; then
echo "travis_fold:end:${zds_fold_current_cat}_${zds_fold_current}"
echo -en "\033[0K"
zds_fold_current=""
fi
}
## end


function print_info {
if [[ "$2" == "--bold" ]]; then
echo -en "\033[36;1m"
else
echo -en "\033[0;36m"
fi
echo "$1"
echo -en "\033[00m"
}


function print_error {
echo -en "\033[31;1m"
echo "$1"
echo -en "\033[00m"
}
7 changes: 7 additions & 0 deletions scripts/define_variable.sh
100644 → 100755
Expand Up @@ -19,3 +19,10 @@ fi
if [[ $ZDS_LATEX_REPO == "" ]]; then
ZDS_LATEX_REPO="https://github.com/zestedesavoir/latex-template.git"
fi

if [[ $ZDS_JDK_HASH == "" ]]; then
ZDS_JDK_HASH="f51449fcd52f4d52b93a989c5c56ed3c"
# shellcheck disable=SC2034
ZDS_JDK_VERSION="11.0.2"
ZDS_JDK_REV="+9"
fi
20 changes: 20 additions & 0 deletions scripts/dependencies/arch.txt
@@ -0,0 +1,20 @@
#title=Arch
#desc=Utilisation de pacman
#installcmd=pacman -Syu
git
wget
curl
unzip
realpath
python
python-setuptools
python-sqlparse
python3-pip
libxml2
python-lxml
libxslt
zlib
libffi
libjpeg-turbo
freetype2
base-devel
26 changes: 26 additions & 0 deletions scripts/dependencies/debian.txt
@@ -0,0 +1,26 @@
#title=Debian
#desc=Utilisation de apt-get / Testé sur : Debian Jessie (8), Debian Stretch (9.8).
#installcmd=apt-get -y install
git
wget
curl
unzip
realpath
python3-dev
python3-pip
python3-venv
python3-setuptools
python3-sqlparse
python3-lxml
libxml2-dev
libxslt-dev
libz-dev
libjpeg62-turbo
libjpeg62-turbo-dev
libfreetype6
libfreetype6-dev
libffi-dev
build-essential
imagemagick
librsvg2-bin
xzdec
23 changes: 23 additions & 0 deletions scripts/dependencies/fedora.txt
@@ -0,0 +1,23 @@
#title=Fedora
#desc=Utilisation de dnf
#installcmd=dnf -y install
git
wget
curl
unzip
realpath
python3-devel
python3-setuptools
python3-lxml
libxml2-devel
libxslt-devel
zlib-devel
python3-sqlparse
libjpeg-turbo-devel
freetype
freetype-devel
libffi-devel
python3-pip
python-virtualenv
gcc
redhat-rpm-config
26 changes: 26 additions & 0 deletions scripts/dependencies/ubuntu.txt
@@ -0,0 +1,26 @@
#title=Ubuntu
#desc=Utilisation de apt-get / Testé sur : Ubuntu 14.04
#installcmd=apt-get -y install
git
wget
curl
unzip
realpath
python3-dev
python3-pip
python3-venv
python3-setuptools
python3-sqlparse
python3-lxml
libxml2-dev
libxslt1-dev
zlib1g-dev
libjpeg8
libjpeg8-dev
libfreetype6
libfreetype6-dev
libffi-dev
build-essential
imagemagick
librsvg2-bin
xzdec