Skip to content

Commit

Permalink
Merge branch 'yegor256:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Raleksan authored Sep 22, 2024
2 parents cae8673 + f397f4c commit 8f7ab70
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: Python-Flake8-Linter
name: flake8
'on':
push:
branches:
Expand All @@ -30,17 +30,11 @@ name: Python-Flake8-Linter
- master
jobs:
flake8:
name: Flake8
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: pip install flake8
- name: Run Flake8
run: |
flake8 --max-line-length=120 .
- run: pip install flake8
- run: flake8 --max-line-length=120 .
3 changes: 1 addition & 2 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ concurrency:
jobs:
make:
runs-on: ubuntu-24.04
container: yegor256/cam:0.9.2
steps:
- uses: actions/checkout@v4
- run: make install
- run: sudo make install
- run: make env lint test
make-macos:
runs-on: macos-14
Expand Down
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
2 changes: 2 additions & 0 deletions DEPENDS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ hard changepage
hard cjk
hard cleveref
hard cm-super
hard cmap
hard comment
hard csquotes
hard currfile
Expand Down Expand Up @@ -45,6 +46,7 @@ hard preprint
hard silence
hard stmaryrd
hard svg
hard textcase
hard textpos
hard titlesec
hard titling
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ RUN add-apt-repository -y ppa:deadsnakes/ppa \

WORKDIR /cam
COPY Makefile /cam
COPY requirements.txt /cam
COPY DEPENDS.txt /cam
COPY steps/install.sh /cam/steps/
COPY help/* /cam/help/

Expand All @@ -123,11 +121,13 @@ RUN installs/install-jpeek.sh
COPY installs/install-poppler.sh installs/
RUN installs/install-poppler.sh

COPY requirements.txt /cam
COPY installs/install-pip.sh installs/
RUN installs/install-pip.sh

COPY installs/install-texlive.sh installs/
RUN installs/install-texlive.sh
COPY DEPENDS.txt /cam
COPY installs/install-texlive-depends.sh installs/
RUN installs/install-texlive-depends.sh

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
2 changes: 1 addition & 1 deletion help/texlive-bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [ ! -e "${root}" ]; then
exit 1
fi
year=$(find "${root}/" -maxdepth 1 -type d -name '[0-9][0-9][0-9][0-9]' -exec basename {} \;)
arc=$(find "${root}/${year}/bin/" -type d -maxdepth 1 -name '*-*' -exec basename {} \;)
arc=$(find "${root}/${year}/bin/" -maxdepth 1 -type d -name '*-*' -exec basename {} \;)
bin=${root}/${year}/bin/${arc}
if [ ! -e "${bin}" ]; then
echo "The directory with TeXLive does not exist: ${bin}"
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 /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"
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if ! "${LOCAL}/help/texlive-bin.sh"; then
unzip install-tl.zip -d install-tl
name=$(find install-tl/ -type d -name "install-tl-*" -exec basename {} \;)
perl "./install-tl/${name}/install-tl" --scheme=scheme-minimal --no-interaction
rm -rf install-tl
rm -rf install-tl install-tl.zip
fi

if ! tlmgr --version >/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion installs/install-texlive-depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ elif "${LOCAL}/help/is-linux.sh"; then
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
fi
"${LOCAL}/help/sudo.sh" tlmgr option repository ctan
"${LOCAL}/help/sudo.sh" tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --self
packages=()
while IFS= read -r p; do
Expand Down
3 changes: 2 additions & 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 All @@ -58,6 +58,7 @@ pdflatex --version
pdftotext -v
inkscape --version
aspell --version
latexmk --version

xmlstarlet --version

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
1 change: 1 addition & 0 deletions tests/steps/test-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fi
{
pdflatex -v
pdftotext -v
latexmk --version
} > "${stdout}" 2>&1
echo "👍🏻 Dependencies are available"

Expand Down

0 comments on commit 8f7ab70

Please sign in to comment.