Skip to content

Commit

Permalink
Ubuntu 24.04 and Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
entorb committed May 14, 2024
1 parent 1d1f5a2 commit 4ed9bcc
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 42 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

jobs:
check:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
Expand All @@ -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
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

jobs:
release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
# - name: test print
Expand All @@ -31,6 +31,9 @@ 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: caching LaTeX files
uses: actions/cache@v4
with:
Expand All @@ -48,14 +51,8 @@ jobs:
- 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
run: python3 scripts/check_chapters.py
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: checkout repository
Expand All @@ -19,6 +19,9 @@ 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: caching LaTeX files
uses: actions/cache@v4
with:
Expand All @@ -36,14 +39,8 @@ jobs:
- 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: |
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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]
Expand All @@ -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
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -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"])
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

# base image
FROM ubuntu:22.04
FROM ubuntu:24.04

# set timezone
ENV TZ=Europe/Berlin
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/ebook/step_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions scripts/ebook/step_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'(<html [^>]*) lang="" xml:lang=""',
Expand Down Expand Up @@ -102,13 +102,13 @@ def fix_ellipsis(s: str) -> str:

# remove ids from chapters since umlaute cause problem
cont = re.sub(
r'(<h\d) id="[^"]+"',
r'(<h\d)\s+id="[^"]+"',
r"\1",
cont,
flags=re.DOTALL | re.IGNORECASE,
)
cont = re.sub(
r'(<h\d class="unnumbered") id="[^"]+"',
r'(<h\d\s+class="unnumbered")\s+id="[^"]+"',
r"\1",
cont,
flags=re.DOTALL | re.IGNORECASE,
Expand Down
7 changes: 4 additions & 3 deletions scripts/install_requirements.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh

# update apt list
sudo apt update --fix-missing
sudo apt-get update --fix-missing

# pdf
sudo apt install texlive-xetex latexmk
sudo apt-get install texlive-xetex texlive-lang-greek latexmk

# ebook
sudo apt install pandoc calibre texlive-extra-utils
sudo apt-get install pandoc calibre texlive-extra-utils imagemagick ghostscript
# texlive-extra-utils for latexpand
# imagemagick ghostscript : for pdf title page to image conversion

0 comments on commit 4ed9bcc

Please sign in to comment.