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 b12bcca
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 62 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
33 changes: 15 additions & 18 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 @@ -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: |
Expand All @@ -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/[email protected]

- 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 }}"
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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/[email protected]

- 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
Expand All @@ -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
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 b12bcca

Please sign in to comment.