From b12bccacc91f05dd667ab992d3d3baff35b6ba1f Mon Sep 17 00:00:00 2001 From: Torben <59419684+entorb@users.noreply.github.com> Date: Tue, 14 May 2024 19:42:41 +0200 Subject: [PATCH] Ubuntu 24.04 and Python 3.12 --- .github/workflows/check-pr.yml | 15 +++++------ .github/workflows/create-release.yml | 33 +++++++++++-------------- .github/workflows/make.yml | 37 +++++++++++++--------------- .pre-commit-config.yaml | 8 +++--- .ruff.toml | 2 +- Dockerfile | 6 ++--- scripts/ebook/step_3.py | 2 +- scripts/ebook/step_6.py | 6 ++--- scripts/install_requirements.sh | 7 +++--- 9 files changed, 54 insertions(+), 62 deletions(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 64c97b459..4d1372920 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -14,7 +14,7 @@ permissions: jobs: check: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout repository @@ -23,17 +23,14 @@ jobs: persist-credentials: false fetch-depth: 1 # 0 if you want to push to repo + - name: Touch requirements.txt for pip caching + run: touch requirements.txt + - name: Python set up uses: actions/setup-python@v5 with: - python-version: "3.10" - # cache: "pip" - - - name: Python cache set up - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-py-cache + python-version: "3.12" + cache: "pip" - name: Check of chapters for known issues run: python3 scripts/check_chapters.py diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index c8b97f401..b12b59c95 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -15,7 +15,7 @@ on: jobs: release: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: # - name: test print @@ -25,13 +25,16 @@ jobs: # steps are copied from make.yml - - name: checkout repository + - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 1 # 0 if you want to push to repo - - name: caching LaTeX files + - name: Touch requirements.txt for pip caching + run: touch requirements.txt + + - name: Cache LaTeX files uses: actions/cache@v4 with: path: | @@ -45,34 +48,28 @@ jobs: hpmor*.xdv key: tex-cache - - name: python set up + - name: Python set up uses: actions/setup-python@v5 with: - python-version: "3.10" - # cache: "pip" - - - name: python cache set up - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-py-cache + python-version: "3.12" + cache: "pip" - - name: check chapters for known issues + - name: Check chapters for known issues run: python3 scripts/check_chapters.py - - name: check pre-commit tests + - name: Check pre-commit tests uses: pre-commit/action@v3.0.1 - - name: install requirements + - name: Install requirements run: sh scripts/install_requirements.sh > /dev/null - - name: make PDFs + - name: Make PDFs run: sh scripts/make_pdfs.sh > /dev/null - - name: make eBooks + - name: Make eBooks run: sh scripts/make_ebooks.sh - - name: publish release + - name: Publish release uses: softprops/action-gh-release@v2 with: tag_name: "${{ inputs.version_number }}" diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 904b09c5c..92806d0b9 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -10,16 +10,19 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - name: checkout repository + - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 1 # 0 if you want to push to repo - - name: caching LaTeX files + - name: Touch requirements.txt for pip caching + run: touch requirements.txt + + - name: Caching LaTeX files uses: actions/cache@v4 with: path: | @@ -33,33 +36,27 @@ jobs: hpmor*.xdv key: tex-cache - - name: python set up + - name: Python set up uses: actions/setup-python@v5 with: - python-version: "3.10" - # cache: "pip" - - - name: python cache set up - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-py-cache + python-version: "3.12" + cache: "pip" # - name: test ls before # run: | # pwd # ls -al - - name: check chapters for known issues + - name: Check chapters for known issues run: python3 scripts/check_chapters.py - - name: check pre-commit tests + - name: Check pre-commit tests uses: pre-commit/action@v3.0.1 - - name: install requirements + - name: Install requirements run: sh scripts/install_requirements.sh > /dev/null - - name: print versions + - name: Print versions run: | cat /etc/os-release xelatex -v @@ -68,18 +65,18 @@ jobs: ebook-convert --version python3 --version - - name: make PDFs + - name: Make PDFs run: sh scripts/make_pdfs.sh > /dev/null - - name: make eBooks + - name: Make eBooks run: sh scripts/make_ebooks.sh - - name: test ls after + - name: Test ls after run: | pwd ls -al - - name: upload files to release WorkInProgress + - name: Upload files to release WorkInProgress uses: softprops/action-gh-release@v2 with: tag_name: WorkInProgress diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11c31da54..a70b5e72e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files args: ["--maxkb=500"] @@ -62,7 +62,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.3.4" + rev: "v0.4.4" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -84,10 +84,10 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.39.0 + rev: v0.40.0 hooks: - id: markdownlint args: ["--disable", "MD013"] default_language_version: - python: python3.10 + python: python3.12 diff --git a/.ruff.toml b/.ruff.toml index 074665cf1..fa7b32fd4 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,6 +1,6 @@ fix = true # auto-fix findings line-length = 88 # same as Black -target-version = "py310" # Python 3.10 +target-version = "py312" # Python 3.12 [lint] # comment this out to use only default rules (["E4", "E7", "E9", "F"]) diff --git a/Dockerfile b/Dockerfile index 5830c75ee..e4aa8fc8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # base image -FROM ubuntu:22.04 +FROM ubuntu:24.04 # set timezone ENV TZ=Europe/Berlin @@ -15,7 +15,7 @@ RUN apt-get dist-upgrade -y RUN apt-get install -y python3 git # for pdf, copied from scripts/install_requirements_pdf.sh -RUN apt-get install -y texlive-xetex texlive-lang-german latexmk +RUN apt-get install -y texlive-xetex texlive-lang-greek texlive-lang-german latexmk # for ebook, copied from scripts/install_requirements_ebook.sh RUN apt-get install -y texlive-extra-utils pandoc calibre imagemagick ghostscript @@ -30,7 +30,7 @@ VOLUME /app # 1. preparation # 1.1 build/update image from Dockerfile -# docker build -t hpmor +# docker build -t hpmor . # 1.2 create container that mounts current working dir to /app # docker run --name hpmor-en -it --mount type=bind,src="$(pwd)",dst=/app hpmor bash diff --git a/scripts/ebook/step_3.py b/scripts/ebook/step_3.py index 21da654a1..337f2faf0 100755 --- a/scripts/ebook/step_3.py +++ b/scripts/ebook/step_3.py @@ -22,7 +22,7 @@ cont = fh_in.read() # \today - date_str = dt.datetime.now(dt.timezone.utc).date().strftime("%d.%m.%Y") + date_str = dt.datetime.now(dt.UTC).date().strftime("%d.%m.%Y") cont = cont.replace("\\today{}", date_str) # writtenNote env -> \writtenNoteA diff --git a/scripts/ebook/step_6.py b/scripts/ebook/step_6.py index 7a6b06d6d..cdbc412b4 100755 --- a/scripts/ebook/step_6.py +++ b/scripts/ebook/step_6.py @@ -71,7 +71,7 @@ def fix_ellipsis(s: str) -> str: count=7, ) - # now done via pandoc -V lang=en in 5.sh + # now done via pandoc -V lang=en in step_5.sh # # set language # cont = re.sub( # r'(]*) lang="" xml:lang=""', @@ -102,13 +102,13 @@ def fix_ellipsis(s: str) -> str: # remove ids from chapters since umlaute cause problem cont = re.sub( - r'(