diff --git a/.ci/script.sh b/.ci/script.sh index 0cb1cfd16..499b8b0a9 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -14,6 +14,10 @@ done file_list_jq=$(jq -r '.[].filename' "$search_dir/languages.json" | grep -v '@none' | grep -v '@algorithm' | grep -v '@softhyphens') +# Sort to ensure they're in exactly the same order. +file_list=$(echo "$file_list"|tr " " "\n"|sort -u|tr "\n" " ") +file_list_jq=$(echo "$file_list_jq"|tr " " "\n"|sort -u|tr "\n" " ") + if [ ! "$file_list" = "$file_list_jq" ]; then echo "Warning, json should reflect hyphenation patterns. Diff:" diff <(echo "$file_list") <(echo "$file_list_jq") @@ -26,7 +30,7 @@ for pattern in "${pattern_files[@]}"; do xmllint "$pattern" >/dev/null || SHELLSCRIPT_ERROR=1 done -changed_files="$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep -E '\.([CcHh]|[ch]pp)$')" +changed_files="$(git diff --name-only origin/master HEAD | grep -E '\.([CcHh]|[ch]pp)$')" if [ -n "${changed_files}" ]; then echo "Running cppcheck on ${changed_files}" @@ -58,7 +62,7 @@ if [ -n "${changed_files}" ]; then # ignore header files in clang-tidy for now # @TODO rename to *.hpp (or *.hxx)? # see https://github.com/koreader/crengine/pull/130#issuecomment-373823848 - changed_files="$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep -E '\.([Cc]|[c]pp)$')" + changed_files="$(git diff --name-only origin/master HEAD | grep -E '\.([Cc]|[c]pp)$')" # To check them all, uncomment this: # changed_files="$(find crengine/src | grep -E '\.([Cc]|[c]pp)$')" echo "Running clang-tidy on ${changed_files}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..2e622e9cd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: CI +on: push + +jobs: + linux: + name: Static linting + runs-on: ubuntu-latest + + steps: + - name: Install prerequisites + run: sudo apt-get install clang-tidy-10 cppcheck jq libxml2-utils + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Lint + run: .ci/script.sh