mirror of
https://github.com/ru-de/faq.git
synced 2024-11-22 18:32:19 +00:00
исправление travis и локальный docker-compose для проверок (#327)
This commit is contained in:
parent
723634d04e
commit
5e51dc9f51
13
.travis.yml
13
.travis.yml
@ -3,19 +3,10 @@ sudo: required
|
|||||||
before_install:
|
before_install:
|
||||||
- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace:$GOPATH"
|
- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace:$GOPATH"
|
||||||
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"
|
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"
|
||||||
- sudo apt-get -qq update
|
- sudo env PATH=$PATH GOPATH=$GOPATH sh files/check-install.sh
|
||||||
- sudo apt-get install -y hunspell hunspell-ru hunspell-en-us hunspell-de-de
|
|
||||||
- curl -s https://extensions.libreoffice.org/extensions/russian-spellcheck-dictionary.-based-on-works-of-aot-group > .dict_page
|
|
||||||
- cat .dict_page | grep -oP "<a href.+title=\"Current release for the project\"" | grep -oP "https://extensions.libreoffice.org/extensions/russian-spellcheck-dictionary.-based-on-works-of-aot-group/[^\"]+" > .current_release
|
|
||||||
- echo -n $(cat .current_release) > .current_release
|
|
||||||
- echo -n "/@@download[^\"]+" >> .current_release
|
|
||||||
- cat .dict_page | grep -oP -f .current_release | wget -q -i - -O dictionary.otx
|
|
||||||
- unzip dictionary.otx
|
|
||||||
- git config core.quotepath false
|
|
||||||
- go get -u github.com/russross/blackfriday-tool
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sh files/.travis.sh
|
- sh files/check.sh
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
9
files/Dockerfile
Normal file
9
files/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# check https://docs.travis-ci.com/user/common-build-problems/#Running-a-Container-Based-Docker-Image-Locally
|
||||||
|
FROM travisci/ci-garnet:packer-1512502276-986baf0
|
||||||
|
MAINTAINER Evgenii Sokolov <e.sokolov@sevensenders.com>
|
||||||
|
|
||||||
|
ENV GOPATH "/home/travis/gopath"
|
||||||
|
ENV GOROOT "/home/travis/.gimme/versions/go1.7.4.linux.amd64"
|
||||||
|
ENV PATH "$GOPATH/bin:$GOROOT/bin:$PATH"
|
||||||
|
COPY check-install.sh /tmp
|
||||||
|
RUN sh /tmp/check-install.sh
|
32
files/check-install.sh
Normal file
32
files/check-install.sh
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
apt-get install -y hunspell hunspell-ru hunspell-en-us hunspell-de-de
|
||||||
|
curl -s https://extensions.libreoffice.org/extensions/russian-spellcheck-dictionary.-based-on-works-of-aot-group > .dict_page
|
||||||
|
cat .dict_page | grep -oP "<a href.+title=\"Current release for the project\"" | grep -oP "https://extensions.libreoffice.org/extensions/russian-spellcheck-dictionary.-based-on-works-of-aot-group/[^\"]+" > .current_release
|
||||||
|
echo -n $(cat .current_release) > .current_release
|
||||||
|
echo -n "/@@download[^\"]+" >> .current_release
|
||||||
|
cat .dict_page | grep -oP -f .current_release | wget -q -i - -O /tmp/dictionary.otx
|
||||||
|
unzip /tmp/dictionary.otx -d /tmp
|
||||||
|
cp /tmp/*.dic /usr/share/hunspell
|
||||||
|
cp /tmp/*.aff /usr/share/hunspell
|
||||||
|
chmod +r /usr/share/hunspell/*
|
||||||
|
|
||||||
|
dicList=""russian-aot""
|
||||||
|
for dic in $dicList
|
||||||
|
do
|
||||||
|
cat /usr/share/hunspell/$dic.dic | iconv --from KOI8-R --to UTF-8 > /usr/share/hunspell/$dic-utf8.dic
|
||||||
|
cat /usr/share/hunspell/$dic.aff | iconv --from KOI8-R --to UTF-8 | sed 's/SET KOI8-R/SET UTF-8/' > /usr/share/hunspell/$dic-utf8.aff
|
||||||
|
done
|
||||||
|
|
||||||
|
dicList=""de_DE" "en_US""
|
||||||
|
for dic in $dicList
|
||||||
|
do
|
||||||
|
cat /usr/share/hunspell/$dic.dic | iconv --from ISO8859-1 --to UTF-8 > /usr/share/hunspell/$dic-utf8.dic
|
||||||
|
cat /usr/share/hunspell/$dic.aff | iconv --from ISO8859-1 --to UTF-8 | sed 's/SET ISO8859-1/SET UTF-8/' > /usr/share/hunspell/$dic-utf8.aff
|
||||||
|
done
|
||||||
|
|
||||||
|
git config --global core.quotepath false
|
||||||
|
go get -u github.com/russross/blackfriday-tool
|
@ -3,21 +3,20 @@
|
|||||||
DIR=`dirname $0`
|
DIR=`dirname $0`
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
|
|
||||||
find *.md -exec blackfriday-tool {} {}.html \;
|
cat $DIR/dictionary.dic | tr '\n' '|' | sed 's/\x27/\\x27/g' > /tmp/dictionary_processed
|
||||||
go build -o $DIR/spell-checker $DIR/spell-checker.go
|
|
||||||
|
|
||||||
cat $DIR/dictionary.dic | tr '\n' '|' | sed 's/\x27/\\x27/g' > dictionary_processed
|
DICT_REGEXP=$(cat /tmp/dictionary_processed | sed 's/|/[^[:alnum:]]\\|/g')
|
||||||
|
DICT_REGEXP_EOF=$(cat /tmp/dictionary_processed | sed 's/|$//g' | sed 's/|/$\\|/g')
|
||||||
DICT_REGEXP=$(cat dictionary_processed | sed 's/|/[^[:alnum:]]\\|/g')
|
|
||||||
DICT_REGEXP_EOF=$(cat dictionary_processed | sed 's/|$//g' | sed 's/|/$\\|/g')
|
|
||||||
DICT_REGEXP="$DICT_REGEXP$DICT_REGEXP_EOF$"
|
DICT_REGEXP="$DICT_REGEXP$DICT_REGEXP_EOF$"
|
||||||
|
|
||||||
git diff HEAD^ --name-status | grep "^D" -v | sed 's/^.\t//g' | grep "\.md$" > changed_files
|
git diff HEAD^ --name-status | grep "^D" -v | sed 's/^.\t//g' | grep "\.md$" > /tmp/changed_files
|
||||||
|
|
||||||
|
go build -o /tmp/spell-checker $DIR/spell-checker.go
|
||||||
|
|
||||||
while read FILE; do
|
while read FILE; do
|
||||||
echo -n "Проверка файла $FILE на опечатки... ";
|
echo -n "Проверка файла $FILE на опечатки... ";
|
||||||
|
|
||||||
OUTPUT=$(cat "$FILE" | sed "s/$DICT_REGEXP//gi" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d russian-aot,ru_RU,de_DE,en_US | $DIR/spell-checker);
|
OUTPUT=$(cat "$FILE" | sed "s/$DICT_REGEXP//gi" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d russian-aot-utf8,ru_RU,de_DE-utf8,en_US-utf8 | /tmp/spell-checker);
|
||||||
OUTPUT_EXIT_CODE=$?
|
OUTPUT_EXIT_CODE=$?
|
||||||
|
|
||||||
if [ $OUTPUT_EXIT_CODE -ne 0 ]; then
|
if [ $OUTPUT_EXIT_CODE -ne 0 ]; then
|
||||||
@ -28,14 +27,13 @@ while read FILE; do
|
|||||||
echo "пройдена";
|
echo "пройдена";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
rm -f /tmp/file.html
|
||||||
done < changed_files
|
blackfriday-tool $FILE /tmp/file.html
|
||||||
|
|
||||||
while read FILE; do
|
if [ -f "/tmp/file.html" ]; then
|
||||||
if [ -f "${FILE}.html" ]; then
|
grep -Po '(?<=href=")http[^"]*(?=")' "/tmp/file.html" > /tmp/links
|
||||||
grep -Po '(?<=href=")http[^"]*(?=")' "${FILE}.html" > links
|
|
||||||
|
|
||||||
if [ -s links ]; then
|
if [ -s /tmp/links ]; then
|
||||||
echo "Проверка файла $FILE на недоступные ссылки... ";
|
echo "Проверка файла $FILE на недоступные ссылки... ";
|
||||||
|
|
||||||
while read LINK; do
|
while read LINK; do
|
||||||
@ -54,11 +52,13 @@ while read FILE; do
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < links
|
done < /tmp/links
|
||||||
|
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < changed_files
|
|
||||||
|
echo
|
||||||
|
done < /tmp/changed_files
|
||||||
|
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
12
files/docker-compose.yml
Normal file
12
files/docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: "3.2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
ru_de_checker:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: ru_de_checker
|
||||||
|
user: travis
|
||||||
|
command: bash -c "env && cd /home/travis/ru-de-faq && sh files/check.sh"
|
||||||
|
volumes:
|
||||||
|
- ../.:/home/travis/ru-de-faq
|
Loading…
Reference in New Issue
Block a user