Skip to content

Commit

Permalink
Merge pull request #369 from nai1ka/master
Browse files Browse the repository at this point in the history
Fixed make pipeline for Linux
  • Loading branch information
yegor256 authored Sep 21, 2024
2 parents 648f459 + 4c457b0 commit 60e0198
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
AllCops:
SuggestExtensions: false
NewCops: enable
Exclude:
- 'venv/**/*'

Layout/EmptyLineAfterGuardClause:
Enabled: false
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ define step
set -e
start=$$(date +%s%N)
echo -e "\n\n\n+++ $(1) +++\n"
if [ -d "$(LOCAL)/venv" ]; then
source "$(LOCAL)/venv/bin/activate"
fi
@bash $(LOCAL)/steps/$(1).sh
echo "Finished$$("$${LOCAL}/help/tdiff.sh" "$${start}")"
endef
Expand Down
8 changes: 6 additions & 2 deletions installs/install-pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ set -o pipefail
"${LOCAL}/help/assert-tool.sh" python3 --version
"${LOCAL}/help/assert-tool.sh" pip3 --version

# see https://stackoverflow.com/a/76641565/187141
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
if [ ! -d "venv" ]; then
python3 -m venv venv
fi

# shellcheck source=/dev/null
source venv/bin/activate

pip3 install -r "${LOCAL}/requirements.txt"
File renamed without changes.
2 changes: 1 addition & 1 deletion steps/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ env

bash_version=${BASH_VERSINFO:-0}
if [ "${bash_version}" -lt 5 ]; then
"${SHELL}" -version
"${SHELL}" --version
ps -p $$
echo "${SHELL} version is older than five: ${bash_version}"
exit 1
Expand Down
10 changes: 10 additions & 0 deletions steps/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ if ! inkscape --version >/dev/null 2>&1; then
fi
fi

if ! xmllint --version >/dev/null 2>&1; then
if "${LOCAL}/help/is-linux.sh"; then
"${LOCAL}/help/sudo.sh" apt-get install -y libxml2-utils
elif "${LOCAL}/help/is-macos.sh"; then
"${LOCAL}/help/sudo.sh" --as-user brew install libxml2
else
"${LOCAL}/help/assert-tool.sh" xmllint --version
fi
fi

find "${LOCAL}/installs" -name 'install-*' | sort | while IFS= read -r i; do
"${i}"
done
Expand Down
9 changes: 5 additions & 4 deletions steps/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ cffconvert --validate

mypy --strict "${LOCAL}/"

flake8 --max-line-length=140 "${LOCAL}/"
flake8 --max-line-length=140 --exclude venv "${LOCAL}/"

export PYTHONPATH="${PYTHONPATH}:${LOCAL}/pylint_plugins/"

find "${LOCAL}" -type f -name '*.py' -print0 | xargs -0 -n1 pylint --enable-all-extensions --load-plugins=custom_checkers \
find "${LOCAL}" -type f -name '*.py' -not -path "${LOCAL}/venv/**" -print0 | xargs -0 -n1 pylint --enable-all-extensions --load-plugins=custom_checkers \
--disable=empty-comment \
--disable=missing-module-docstring \
--disable=invalid-name \
Expand All @@ -53,7 +53,7 @@ bibcop tex/report.bib

while IFS= read -r sh; do
shellcheck --shell=bash --severity=style "${sh}"
done < <(find "$(realpath "${LOCAL}")" -name '*.sh' -type f -not -path "$(realpath "${TARGET}")/**")
done < <(find "$(realpath "${LOCAL}")" -name '*.sh' -type f -not -path "$(realpath "${TARGET}")/**" -not -path "$(realpath "${LOCAL}")/venv/**")

header="Copyright (c) 2021-$(date +%Y) Yegor Bugayenko"
failed="false"
Expand All @@ -66,6 +66,7 @@ for mask in *.sh *.py *.rb *.yml *.java Makefile; do
done < <(find "$(realpath "${LOCAL}")" -type f -name "${mask}" \
-not -path "$(realpath "${TARGET}")/**" \
-not -path "$(realpath "${LOCAL}")/fixtures/filters/unparseable/**" \
-not -path "$(realpath "${LOCAL}")/test-zone/**")
-not -path "$(realpath "${LOCAL}")/test-zone/**" \
-not -path "$(realpath "${LOCAL}")/venv/**")
done
if [[ "${failed}" = "true" ]]; then exit; fi

0 comments on commit 60e0198

Please sign in to comment.